]> git.basschouten.com Git - openhab-addons.git/blob
69634d32921913a7da25e9e74785953d1a4368ea
[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.deconz.internal.dto;
14
15 import java.util.Arrays;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 /**
21  * The {@link SensorState} is send by the websocket connection as well as the Rest API.
22  * It is part of a {@link SensorMessage}.
23  *
24  * This should be in sync with the supported sensors from
25  * https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Supported-Devices.
26  *
27  * @author David Graeff - Initial contribution
28  */
29 @NonNullByDefault
30 public class SensorState {
31     /** Some presence sensors, the daylight sensor and all light sensors provide the "dark" boolean. */
32     public @Nullable Boolean dark;
33     /** The daylight sensor and all light sensors provides the "daylight" boolean. */
34     public @Nullable Boolean daylight;
35     /** Light sensors provide a light level value. */
36     public @Nullable Integer lightlevel;
37     /** Light sensors provide a lux value. */
38     public @Nullable Integer lux;
39     /** Temperature sensors provide a degrees value. */
40     public @Nullable Float temperature;
41     /** Humidity sensors provide a percent value. */
42     public @Nullable Float humidity;
43     /** OpenClose sensors provide a boolean value. */
44     public @Nullable Boolean open;
45     /** fire sensors provide a boolean value. */
46     public @Nullable Boolean fire;
47     /** water sensors provide a boolean value. */
48     public @Nullable Boolean water;
49     /** alarm sensors provide a boolean value. */
50     public @Nullable Boolean alarm;
51     /** IAS Zone sensors provide a boolean value. */
52     public @Nullable Boolean tampered;
53     /** vibration sensors provide a boolean value. */
54     public @Nullable Boolean vibration;
55     /** carbonmonoxide sensors provide a boolean value. */
56     public @Nullable Boolean carbonmonoxide;
57     /** airquality sensors provide a string value. */
58     public @Nullable String airquality;
59     /** airquality sensors provide an integer value. */
60     public @Nullable Integer airqualityppb;
61     /** Pressure sensors provide a hPa value. */
62     public @Nullable Integer pressure;
63     /** Presence sensors provide this boolean. */
64     public @Nullable Boolean presence;
65     /** Power sensors provide this value in Watts. */
66     public @Nullable Float power;
67     /** Batttery sensors provide this value */
68     public @Nullable Integer battery;
69     /**
70      * Some battery sensors (especially Tuya driven devices) provide this boolean
71      * instead of battery level
72      */
73     public @Nullable Boolean lowbattery;
74     /** Consumption sensors provide this value in Watts/hour. */
75     public @Nullable Float consumption;
76     /** Power sensors provide this value in Volt. */
77     public @Nullable Float voltage;
78     /** Power sensors provide this value in Milliampere. */
79     public @Nullable Float current;
80     /** Light sensors and the daylight sensor provide a status integer that can have various semantics. */
81     public @Nullable Integer status;
82     /** Switches provide this value. */
83     public @Nullable Integer buttonevent;
84     /** Switches may provide this value. */
85     public @Nullable Integer gesture;
86     /** Thermostat may provide this value. */
87     public @Nullable Integer valve;
88     /** Thermostats may provide this value */
89     public @Nullable String windowopen;
90     /** deCONZ sends a last update string with every event. */
91     public @Nullable String lastupdated;
92     /** color controllers send xy values */
93     public double @Nullable [] xy;
94
95     @Override
96     public String toString() {
97         return "SensorState{" + "dark=" + dark + ", daylight=" + daylight + ", lightlevel=" + lightlevel + ", lux="
98                 + lux + ", temperature=" + temperature + ", humidity=" + humidity + ", open=" + open + ", fire=" + fire
99                 + ", water=" + water + ", alarm=" + alarm + ", tampered=" + tampered + ", vibration=" + vibration
100                 + ", carbonmonoxide=" + carbonmonoxide + ", airquality=" + airquality + ", airqualityppb="
101                 + airqualityppb + ", pressure=" + pressure + ", presence=" + presence + ", power=" + power
102                 + ", battery=" + battery + ", consumption=" + consumption + ", voltage=" + voltage + ", current="
103                 + current + ", status=" + status + ", buttonevent=" + buttonevent + ", gesture=" + gesture + ", valve="
104                 + valve + ", windowopen='" + windowopen + '\'' + ", lastupdated='" + lastupdated + '\'' + ", xy="
105                 + Arrays.toString(xy) + '}';
106     }
107 }