2 * Copyright (c) 2010-2021 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 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 /** 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 Float power;
63 /** Batttery sensors provide this value */
64 public @Nullable Integer battery;
65 /** Consumption sensors provide this value in Watts/hour. */
66 public @Nullable Float consumption;
67 /** Power sensors provide this value in Volt. */
68 public @Nullable Float voltage;
69 /** Power sensors provide this value in Milliampere. */
70 public @Nullable Float current;
71 /** Light sensors and the daylight sensor provide a status integer that can have various semantics. */
72 public @Nullable Integer status;
73 /** Switches provide this value. */
74 public @Nullable Integer buttonevent;
75 /** Switches may provide this value. */
76 public @Nullable Integer gesture;
77 /** Thermostat may provide this value. */
78 public @Nullable Integer valve;
79 /** Thermostats may provide this value */
80 public @Nullable String windowopen;
81 /** deCONZ sends a last update string with every event. */
82 public @Nullable String lastupdated;
83 /** color controllers send xy values */
84 public double @Nullable [] xy;
87 public String toString() {
88 return "SensorState{" + "dark=" + dark + ", daylight=" + daylight + ", lightlevel=" + lightlevel + ", lux="
89 + lux + ", temperature=" + temperature + ", humidity=" + humidity + ", open=" + open + ", fire=" + fire
90 + ", water=" + water + ", alarm=" + alarm + ", tampered=" + tampered + ", vibration=" + vibration
91 + ", carbonmonoxide=" + carbonmonoxide + ", pressure=" + pressure + ", presence=" + presence
92 + ", power=" + power + ", battery=" + battery + ", consumption=" + consumption + ", voltage=" + voltage
93 + ", current=" + current + ", status=" + status + ", buttonevent=" + buttonevent + ", gesture="
94 + gesture + ", valve=" + valve + ", windowopen='" + windowopen + '\'' + ", lastupdated='" + lastupdated
95 + '\'' + ", xy=" + Arrays.toString(xy) + '}';