]> git.basschouten.com Git - openhab-addons.git/blob
d8882afacd1ac47adc8e371fc46c38e9a300a731
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.netatmo.internal.handler.channelhelper;
14
15 import static org.openhab.binding.netatmo.internal.NetatmoBindingConstants.CHANNEL_FLOODLIGHT;
16 import static org.openhab.binding.netatmo.internal.utils.ChannelTypeUtils.toStringType;
17
18 import java.util.Set;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.binding.netatmo.internal.api.dto.HomeStatusModule;
23 import org.openhab.binding.netatmo.internal.api.dto.NAThing;
24 import org.openhab.core.config.core.Configuration;
25 import org.openhab.core.types.State;
26
27 /**
28  * The {@link PresenceChannelHelper} handles specific channels of Presence external cameras
29  *
30  * @author GaĆ«l L'hopital - Initial contribution
31  *
32  */
33 @NonNullByDefault
34 public class PresenceChannelHelper extends CameraChannelHelper {
35
36     public PresenceChannelHelper(Set<String> providedGroups) {
37         super(providedGroups);
38     }
39
40     @Override
41     protected @Nullable State internalGetProperty(String channelId, NAThing naThing, Configuration config) {
42         if (naThing instanceof HomeStatusModule) {
43             HomeStatusModule camera = (HomeStatusModule) naThing;
44             switch (channelId) {
45                 case CHANNEL_FLOODLIGHT:
46                     return toStringType(camera.getFloodlight());
47             }
48         }
49         return super.internalGetProperty(channelId, naThing, config);
50     }
51 }