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