]> git.basschouten.com Git - openhab-addons.git/blob
2616b84eaae3e6adf98c6ac8bb46e476ed99ee0f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.tapocontrol.internal.devices.rf.wheatersensor;
14
15 import static org.openhab.binding.tapocontrol.internal.constants.TapoThingConstants.*;
16 import static org.openhab.binding.tapocontrol.internal.helpers.utils.TypeUtils.*;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.openhab.binding.tapocontrol.internal.devices.dto.TapoChildDeviceData;
20 import org.openhab.binding.tapocontrol.internal.devices.rf.TapoChildDeviceHandler;
21 import org.openhab.core.library.unit.SIUnits;
22 import org.openhab.core.thing.Thing;
23
24 /**
25  * TAPO Smart-Contact-Device.
26  *
27  * @author Christian Wild - Initial contribution
28  */
29 @NonNullByDefault
30 public class TapoWheaterSensorHandler extends TapoChildDeviceHandler {
31     /**
32      * Constructor
33      *
34      * @param thing Thing object representing device
35      */
36     public TapoWheaterSensorHandler(Thing thing) {
37         super(thing);
38     }
39
40     /**
41      * Update properties
42      */
43     @Override
44     protected void devicePropertiesChanged(TapoChildDeviceData deviceInfo) {
45         super.devicePropertiesChanged(deviceInfo);
46
47         updateState(getChannelID(CHANNEL_GROUP_SENSOR, CHANNEL_TEMPERATURE),
48                 getTemperatureType(deviceInfo.getTemperature(), SIUnits.CELSIUS));
49         updateState(getChannelID(CHANNEL_GROUP_SENSOR, CHANNEL_HUMIDITY), getPercentType(deviceInfo.getHumidity()));
50     }
51 }