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.List;
16 import java.util.Optional;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.openhab.binding.netatmo.internal.handler.CommonInterface;
20 import org.openhab.binding.netatmo.internal.handler.channelhelper.ChannelHelper;
21 import org.openhab.binding.netatmo.internal.handler.channelhelper.EventChannelHelper;
22 import org.openhab.binding.netatmo.internal.providers.NetatmoDescriptionProvider;
25 * {@link HomeSecurityThingCapability} is the ancestor of capabilities hosted by a security home
26 * e.g. person and camera capabilities
28 * @author Gaƫl L'hopital - Initial contribution
32 public class HomeSecurityThingCapability extends Capability {
33 protected final NetatmoDescriptionProvider descriptionProvider;
34 protected final EventChannelHelper eventHelper;
36 protected Optional<SecurityCapability> securityCapability = Optional.empty();
37 protected Optional<HomeCapability> homeCapability = Optional.empty();
39 public HomeSecurityThingCapability(CommonInterface handler, NetatmoDescriptionProvider descriptionProvider,
40 List<ChannelHelper> channelHelpers) {
42 this.descriptionProvider = descriptionProvider;
43 this.eventHelper = (EventChannelHelper) channelHelpers.stream().filter(c -> c instanceof EventChannelHelper)
44 .findFirst().orElseThrow(() -> new IllegalArgumentException(
45 "HomeSecurityThingCapability must find an EventChannelHelper, please file a bug report."));
46 eventHelper.setModuleType(moduleType);
50 public void initialize() {
52 securityCapability = handler.getHomeCapability(SecurityCapability.class);
53 homeCapability = handler.getHomeCapability(HomeCapability.class);