]> git.basschouten.com Git - openhab-addons.git/blob
0ee42de6163d3eac11235060ad20f960e714318b
[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.bondhome.internal.api;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 import com.google.gson.annotations.Expose;
19 import com.google.gson.annotations.SerializedName;
20
21 /**
22  * This POJO represents the Bond Device state
23  *
24  * The incoming JSON looks like this:
25  *
26  * { "breeze": [ 1, 0.2, 0.9 ], "brightness": 75, "light": 1, "power": 0,
27  * "speed": 2, "timer": 3599 }
28  *
29  * @author Sara Geleskie Damiano - Initial contribution
30  */
31 @NonNullByDefault
32 public class BondDeviceState {
33     // The current state hash
34     @SerializedName("_")
35     @Expose(serialize = false, deserialize = true)
36     public @Nullable String hash;
37
38     // The device power state 1 = on, 0 = off
39     @Expose(serialize = true, deserialize = true)
40     public int power;
41
42     // The seconds remaining on timer, or 0 meaning no timer running
43     @Expose(serialize = true, deserialize = true)
44     public int timer;
45
46     // The fan speed - value from 1 to max_speed. If power=0, speed represents the
47     // last speed setting and the speed to which the device resumes when user asks
48     // to turn on.
49     @Expose(serialize = true, deserialize = true)
50     public int speed;
51
52     // The current breeze setting (for a ceiling fan)
53     // array of the form[<mode>,<mean>,<var>]:
54     // mode: (integer) 0 = breeze mode disabled, 1 = breeze mode enabled
55     // mean: (integer) sets the average speed. 0 = minimum average speed (calm), 100 = maximum average speed (storm)
56     // var: (integer) sets the variability of the speed. 0 = minimum variation (steady), 100 = maximum variation (gusty)
57     @Expose(serialize = true, deserialize = true)
58     public int[] breeze = { 0, 50, 50 };
59
60     // The direction of a fan with a reversible motor 1 = forward, -1 = reverse.
61     // The forward and reverse modes are sometimes called Summer and Winter, respectively.
62     @Expose(serialize = true, deserialize = true)
63     public int direction;
64
65     // The fan light state 1 = light on, 0 = light off
66     @Expose(serialize = true, deserialize = true)
67     public int light;
68
69     // Whether separate up and down lights are enabled, if applicable
70     // 1 = enabled, 0 = disabled
71     // If both up_light and light are 1, then the up light will be on, and similar for down light.
72     @SerializedName("up_light")
73     @Expose(serialize = true, deserialize = true)
74     public int upLight;
75
76     @SerializedName("down_light")
77     @Expose(serialize = true, deserialize = true)
78     public int downLight;
79
80     // The brightness of a fan light or lights
81     @Expose(serialize = true, deserialize = true)
82     public int brightness;
83
84     @Expose(serialize = true, deserialize = true)
85     public int upLightBrightness;
86
87     @Expose(serialize = true, deserialize = true)
88     public int downLightBrightness;
89
90     // The flame level of a fireplace - value from 1 to 100. If power=0, flame represents the last flame setting and
91     // the flame to which the device resumes when user asks to turn on
92     @Expose(serialize = true, deserialize = true)
93     public int flame;
94
95     // Whether a device is open or closed (for motorized shades and garage doors)
96     // 1 = open, 0 = closed
97     @Expose(serialize = true, deserialize = true)
98     public int open;
99
100     // Fan settings for a fireplace fan
101     // fpfan_power: (integer) 1 = on, 0 = off
102     // fpfan_speed: (integer) from 1-100
103     @SerializedName("fpfan_power")
104     @Expose(serialize = true, deserialize = true)
105     public int fpfanPower;
106
107     @SerializedName("fpfan_speed")
108     @Expose(serialize = true, deserialize = true)
109     public int fpfanSpeed;
110 }