2 * Copyright (c) 2010-2023 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.deconz.internal.dto;
15 import java.util.Arrays;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
21 * The {@link SensorState} is send by the websocket connection as well as the Rest API.
22 * It is part of a {@link SensorMessage}.
24 * This should be in sync with the supported sensors from
25 * https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Supported-Devices.
27 * @author David Graeff - Initial contribution
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 Double temperature;
41 /** Humidity sensors provide a percent value. */
42 public @Nullable Double 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 /** Pressure sensors provide a hPa value. */
58 public @Nullable Integer pressure;
59 /** Presence sensors provide this boolean. */
60 public @Nullable Boolean presence;
61 /** Power sensors provide this value in Watts. */
62 public @Nullable Double power;
63 /** Batttery sensors provide this value */
64 public @Nullable Integer battery;
65 /** Consumption sensors provide this value in Watts/hour. */
66 public @Nullable Boolean lowbattery;
67 /** Consumption sensors provide this value in Watts/hour. */
68 public @Nullable Double consumption;
69 public @Nullable Double consumption2;
70 /** Power sensors provide this value in Volt. */
71 public @Nullable Double voltage;
72 /** Power sensors provide this value in Milliampere. */
73 public @Nullable Double current;
74 /** Light sensors and the daylight sensor provide a status integer that can have various semantics. */
75 public @Nullable Integer status;
76 /** Switches provide this value. */
77 public @Nullable Integer buttonevent;
78 /** Switches may provide this value. */
79 public @Nullable Integer gesture;
80 /** Thermostat may provide this value. */
81 public @Nullable Integer valve;
82 /** air quality sensors provide this value */
83 public @Nullable String airquality;
84 public @Nullable Integer airqualityppb;
85 /** moisture sensors provide this value */
86 public @Nullable Integer moisture;
87 /** Thermostats may provide this value */
88 public @Nullable String windowopen;
89 /** deCONZ sends a last update string with every event. */
90 public @Nullable String lastupdated;
91 /** color controllers send xy values */
92 public double @Nullable [] xy;
95 public String toString() {
96 return "SensorState{" + "dark=" + dark + ", daylight=" + daylight + ", lightlevel=" + lightlevel + ", lux="
97 + lux + ", temperature=" + temperature + ", humidity=" + humidity + ", open=" + open + ", fire=" + fire
98 + ", water=" + water + ", alarm=" + alarm + ", tampered=" + tampered + ", vibration=" + vibration
99 + ", carbonmonoxide=" + carbonmonoxide + ", pressure=" + pressure + ", presence=" + presence
100 + ", power=" + power + ", battery=" + battery + ", lowbattery=" + lowbattery + ", consumption="
101 + consumption + ", voltage=" + voltage + ", current=" + current + ", status=" + status
102 + ", buttonevent=" + buttonevent + ", gesture=" + gesture + ", valve=" + valve + ", airquality='"
103 + airquality + "'" + ", airqualityppb=" + airqualityppb + ", windowopen='" + windowopen + "'"
104 + ", lastupdated='" + lastupdated + "'" + ", xy=" + Arrays.toString(xy) + "}";