2 * Copyright (c) 2010-2022 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.netatmo.internal.handler.capability;
15 import java.util.ArrayList;
16 import java.util.Collection;
17 import java.util.List;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.netatmo.internal.api.dto.HomeEvent;
21 import org.openhab.binding.netatmo.internal.api.dto.NAObject;
22 import org.openhab.binding.netatmo.internal.handler.CommonInterface;
23 import org.openhab.binding.netatmo.internal.handler.channelhelper.ChannelHelper;
24 import org.openhab.binding.netatmo.internal.providers.NetatmoDescriptionProvider;
27 * {@link SmokeCapability} gives the ability to handle Smoke detector specifics
29 * @author Gaƫl L'hopital - Initial contribution
33 public class SmokeCapability extends HomeSecurityThingCapability {
35 public SmokeCapability(CommonInterface handler, NetatmoDescriptionProvider descriptionProvider,
36 List<ChannelHelper> channelHelpers) {
37 super(handler, descriptionProvider, channelHelpers);
41 public List<NAObject> updateReadings() {
42 List<NAObject> result = new ArrayList<>();
43 securityCapability.ifPresent(cap -> {
44 Collection<HomeEvent> events = cap.getDeviceEvents(handler.getId(), moduleType.apiName);
45 if (!events.isEmpty()) {
46 result.add(events.iterator().next());