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.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.SerializedName;
23 * This enum represents the possible device actions
25 * @author Sara Geleskie Damiano - Initial contribution
29 public enum BondDeviceAction {
32 // power: (integer) 1 = on, 0 = off
34 @SerializedName("TurnOn")
35 TURN_ON("TurnOn", CHANNEL_GROUP_COMMON, CHANNEL_POWER),
36 // ^^ Turn device power on.
37 @SerializedName("TurnOff")
38 TURN_OFF("TurnOff", CHANNEL_GROUP_COMMON, CHANNEL_POWER),
39 // ^^ Turn device power off.
40 @SerializedName("TogglePower")
41 TOGGLE_POWER("TogglePower", CHANNEL_GROUP_COMMON, CHANNEL_POWER),
42 // ^^ Change device power from on to off, or off to on.
45 // timer: (integer) seconds remaining on timer, or 0 meaning no timer running
47 @SerializedName("SetTimer")
48 SET_TIMER("SetTimer", CHANNEL_GROUP_COMMON, CHANNEL_FAN_TIMER),
49 // ^^ Start timer for s seconds. If power if off, device is implicitly turned
50 // on. If argument is zero, the timer is
51 // canceled without turning off the device.
54 // max_speed: (integer) highest speed available
56 // speed: (integer) value from 1 to max_speed. If power=0, speed represents the
57 // last speed setting and the speed to
58 // which the device resumes when user asks to turn on.
60 @SerializedName("SetSpeed")
61 SET_SPEED("SetSpeed", CHANNEL_GROUP_FAN, CHANNEL_FAN_SPEED),
62 // ^^ Set speed and turn on. If speed>max_speed, max_speed is assumed. If the
63 // fan is off, implicitly turn on the
64 // power. Setting speed to zero or a negative value is ignored.
65 @SerializedName("IncreaseSpeed")
66 INCREASE_SPEED("IncreaseSpeed", CHANNEL_GROUP_FAN, CHANNEL_FAN_SPEED),
67 // ^^ Increase speed of fan by specified number of speeds. If the fan is off,
68 // implicitly turn on the power.
69 @SerializedName("DecreaseSpeed")
70 DECREASE_SPEED("DecreaseSpeed", CHANNEL_GROUP_FAN, CHANNEL_FAN_SPEED),
71 // ^^ Decrease fan speed by specified number of speeds. If attempting to
72 // decrease fan speed below 1, the fan will
73 // remain at speed 1. That is, power will not be implicitly turned off. If the
74 // power is already off, DecreaseSpeed
78 // breeze: (array) array of the form [ <mode>, <mean>, <var> ]:
79 // mode: (integer) 0 = breeze mode disabled, 1 = breeze mode enabled
80 // mean: (integer) sets the average speed. 0 = minimum average speed (calm), 100
81 // = maximum average speed (storm)
82 // var: (integer) sets the variability of the speed. 0 = minimum variation
83 // (steady), 100 = maximum variation (gusty)
85 @SerializedName("BreezeOn")
86 BREEZE_ON("BreezeOn", CHANNEL_GROUP_FAN, CHANNEL_FAN_BREEZE_STATE),
87 // ^^ Enable breeze with remembered parameters. Defaults to [50,50].
88 @SerializedName("BreezeOff")
89 BREEZE_OFF("BreezeOff", CHANNEL_GROUP_FAN, CHANNEL_FAN_BREEZE_STATE),
90 // ^^ Stop breeze. Fan remains on at current speed.
91 @SerializedName("SetBreeze")
92 SET_BREEZE("SetBreeze", CHANNEL_GROUP_FAN, CHANNEL_FAN_BREEZE_MEAN),
93 // ^^ Enable breeze with specified parameters (same as breeze state variable).
94 // Example SetBreeze([1, 20, 90]).
97 // direction: (integer) 1 = forward, -1 = reverse.
98 // The forward and reverse modes are sometimes called Summer and Winter,
101 @SerializedName("SetDirection")
102 SET_DIRECTION("SetDirection", CHANNEL_GROUP_FAN, CHANNEL_FAN_DIRECTION),
103 // ^^ Control forward and reverse.
104 @SerializedName("ToggleDirection")
105 TOGGLE_DIRECTION("ToggleDirection", CHANNEL_GROUP_FAN, CHANNEL_FAN_DIRECTION),
106 // ^^ Reverse the direction of the fan.
109 // light: (integer) 1 = light on, 0 = light off
111 @SerializedName("TurnLightOn")
112 TURN_LIGHT_ON("TurnLightOn", CHANNEL_GROUP_LIGHT, CHANNEL_LIGHT_POWER),
114 @SerializedName("TurnLightOff")
115 TURN_LIGHT_OFF("TurnLightOff", CHANNEL_GROUP_LIGHT, CHANNEL_LIGHT_POWER),
116 // ^^ Turn off light.
117 @SerializedName("ToggleLight")
118 TOGGLE_LIGHT("ToggleLight", CHANNEL_GROUP_LIGHT, CHANNEL_LIGHT_POWER),
119 // ^^ Change light from on to off, or off to on.
122 // up_light: (integer) 1 = up light enabled, 0 = up light disabled
123 // down_light: (integer) 1 = down light enabled, 0 = down light disabled
124 // If both up_light and light are 1, then the up light will be on, and similar
126 // Note that both up_light and down_light may not be simultaneously zero, so
127 // that the device is always ready to
128 // respond to a TurnLightOn request.
130 @SerializedName("TurnUpLightOn")
131 TURN_UP_LIGHT_ON("TurnUpLightOn", CHANNEL_GROUP_UP_LIGHT, CHANNEL_UP_LIGHT_ENABLE),
132 // ^^ Turn up light on.
133 @SerializedName("TurnDownLightOn")
134 TURN_DOWN_LIGHT_ON("TurnDownLightOn", CHANNEL_GROUP_DOWN_LIGHT, CHANNEL_DOWN_LIGHT_ENABLE),
135 // ^^ Turn down light on.
136 @SerializedName("TurnUpLightOff")
137 TURN_UP_LIGHT_OFF("TurnUpLightOff", CHANNEL_GROUP_UP_LIGHT, CHANNEL_UP_LIGHT_POWER),
138 // ^^ Turn off up light.
139 @SerializedName("TurnDownLightOff")
140 TURN_DOWN_LIGHT_OFF("TurnDownLightOff", CHANNEL_GROUP_DOWN_LIGHT, CHANNEL_DOWN_LIGHT_POWER),
141 // ^^ Turn off down light.
142 @SerializedName("ToggleUpLight")
143 TOGGLE_UP_LIGHT("ToggleUpLight", CHANNEL_GROUP_UP_LIGHT, CHANNEL_UP_LIGHT_POWER),
144 // ^^ Change up light from on to off, or off to on.
145 @SerializedName("ToggleDownLight")
146 TOGGLE_DOWN_LIGHT("ToggleDownLight", CHANNEL_GROUP_DOWN_LIGHT, CHANNEL_DOWN_LIGHT_POWER),
147 // ^^ Change down light from on to off, or off to on.
150 // brightness: (integer) percentage value of brightness, 1-100. If light=0,
151 // brightness represents the last
152 // brightness setting and the brightness to resume when user turns on light. If
153 // fan has no dimmer or a non-stateful
154 // dimmer, brightness is always 100.
156 @SerializedName("SetBrightness")
157 SET_BRIGHTNESS("SetBrightness", CHANNEL_GROUP_LIGHT, CHANNEL_LIGHT_BRIGHTNESS),
158 // ^^ Set the brightness of the light to specified percentage. Value of 0 is
159 // ignored, use TurnLightOff instead.
160 @SerializedName("IncreaseBrightness")
161 INCREASE_BRIGHTNESS("IncreaseBrightness", CHANNEL_GROUP_LIGHT, CHANNEL_LIGHT_BRIGHTNESS),
162 // will be turned on at (0 + amount).
163 DECREASE_BRIGHTNESS("DecreaseBrightness", CHANNEL_GROUP_LIGHT, CHANNEL_LIGHT_BRIGHTNESS),
164 // ^^ Decrease light brightness by specified percentage. If attempting to
165 // decrease brightness below 1%, light will
166 // remain at 1%. Use TurnLightOff to turn off the light. If the light is off,
167 // the light will remain off but the
168 // remembered brightness will be decreased.
171 // up_light_brightness: (integer) percentage value of up light brightness,
173 // down_light_brightness: (integer) percentage value of down light brightness,
176 @SerializedName("SetUpLightBrightness")
177 SET_UP_LIGHT_BRIGHTNESS("SetUpLightBrightness", CHANNEL_GROUP_UP_LIGHT, CHANNEL_UP_LIGHT_BRIGHTNESS),
178 // ^^ Similar to SetBrightness but only for the up light.
179 @SerializedName("SetDownLightBrightness")
180 SET_DOWN_LIGHT_BRIGHTNESS("SetDownLightBrightness", CHANNEL_GROUP_DOWN_LIGHT, CHANNEL_DOWN_LIGHT_BRIGHTNESS),
181 // ^^ Similar to SetBrightness but only for the down light.
182 @SerializedName("IncreaseUpLightBrightness")
183 INCREASE_UP_LIGHT_BRIGHTNESS("IncreaseUpLightBrightness", CHANNEL_GROUP_UP_LIGHT, CHANNEL_UP_LIGHT_BRIGHTNESS),
184 // ^^ Similar to IncreaseBrightness but only for the up light.
185 @SerializedName("InreaseDownLightBrightness")
186 INCREASE_DOWN_LIGHT_BRIGHTNESS("IncreaseDownLightBrightness", CHANNEL_GROUP_DOWN_LIGHT,
187 CHANNEL_DOWN_LIGHT_BRIGHTNESS),
188 // ^^ Similar to IncreaseBrightness but only for the down light.
189 @SerializedName("DecreaseUpLightBrightness")
190 DECREASE_UP_LIGHT_BRIGHTNESS("DecreaseUpLightBrightness", CHANNEL_GROUP_UP_LIGHT, CHANNEL_UP_LIGHT_BRIGHTNESS),
191 // ^^ Similar to DecreaseBrightness but only for the up light.
192 @SerializedName("DecreaseDownLightBrightness")
193 DECREASE_DOWN_LIGHT_BRIGHTNESS("DecreaseDownLightBrightness", CHANNEL_GROUP_DOWN_LIGHT,
194 CHANNEL_DOWN_LIGHT_BRIGHTNESS),
195 // ^^ Similar to DecreaseBrightness but only for the down light.
198 // flame: (integer) value from 1 to 100. If power=0, flame represents the last
199 // flame setting and the flame to which
200 // the device resumes when user asks to turn on.
202 @SerializedName("SetFlame")
203 SET_FLAME("SetFlame", CHANNEL_GROUP_FIREPLACE, CHANNEL_FLAME),
204 // ^^ Set flame and turn on. If flame>100, 100 is assumed. If the fireplace is
205 // off, implicitly turn on the power.
206 // Setting flame to zero or a negative value is ignored.
207 @SerializedName("IncreaseFlame")
208 INCREASE_FLAME("IncreaseFlame", CHANNEL_GROUP_FIREPLACE, CHANNEL_FLAME),
209 // ^^ Increase flame level of fireplace by specified number of flames. If the
210 // fireplace is off, implicitly turn on
212 @SerializedName("DecreaseFlame")
213 DECREASE_FLAME("DecreaseFlame", CHANNEL_GROUP_FIREPLACE, CHANNEL_FLAME),
214 // ^^ Decrease flame level by specified number of flames. If attempting to
215 // decrease fireplace flame below 1, the
216 // fireplace will remain at flame 1. That is, power will not be implicitly
217 // turned off. If the power is already off,
218 // DecreaseFlame is ignored.
221 // fpfan_power: (integer) 1 = on, 0 = off
222 // fpfan_speed: (integer) from 1-100
224 @SerializedName("TurnFpFanOff")
225 TURN_FP_FAN_OFF("TurnFpFanOff", CHANNEL_GROUP_FAN, CHANNEL_FAN_SPEED),
226 // ^^ Turn the fireplace fan off
227 @SerializedName("TurnFpFanOn")
228 TURN_FP_FAN_ON("TurnFpFanOn", CHANNEL_GROUP_FAN, CHANNEL_FAN_POWER),
229 // ^^ Turn the fireplace fan on, restoring the previous speed
230 @SerializedName("SetFpFan")
231 SET_FP_FAN("SetFpFan", CHANNEL_GROUP_FAN, CHANNEL_FAN_SPEED),
232 // ^^ Sets the speed of the fireplace fan
235 // open: (integer) 1 = open, 0 = closed
237 @SerializedName("Open")
238 OPEN("Open", CHANNEL_GROUP_SHADES, CHANNEL_ROLLERSHUTTER),
239 // ^^ Open the device.
240 @SerializedName("Close")
241 CLOSE("Close", CHANNEL_GROUP_SHADES, CHANNEL_ROLLERSHUTTER),
242 // ^^ Close the device.
243 @SerializedName("ToggleOpen")
244 TOGGLE_OPEN("ToggleOpen", CHANNEL_GROUP_SHADES, CHANNEL_ROLLERSHUTTER),
245 // ^^ Close the device if it's open, open it if it's closed
246 @SerializedName("Preset")
247 PRESET("Preset", CHANNEL_GROUP_COMMON, CHANNEL_COMMAND),
248 // ^^ Sets a shade to a preset level
251 @SerializedName("Stop")
252 STOP("Stop", CHANNEL_GROUP_COMMON, CHANNEL_COMMAND),
253 // ^^ This action tells the Bond to stop any in-progress transmission and empty
254 // its transmission queue.
255 @SerializedName("Hold")
256 HOLD("Hold", CHANNEL_GROUP_SHADES, CHANNEL_COMMAND),
257 // ^^ Can be used when a signal is required to tell a device to stop moving or
258 // the like, since Stop is a special
259 // "stop transmitting" action
260 @SerializedName("Pair")
261 PAIR("Pair", CHANNEL_GROUP_COMMON, null),
262 // ^^ Used in devices that need to be paired with a receiver.
263 @SerializedName("StartDimmer")
264 START_DIMMER("StartDimmer", CHANNEL_GROUP_COMMON, CHANNEL_COMMAND),
265 // ^^ Start dimming. The Bond should time out its transmission after 30 seconds,
266 // or when the Stop action is called.
267 @SerializedName("StartUpLightDimmer")
268 START_UP_LIGHT_DIMMER("StartUpLightDimmer", CHANNEL_GROUP_COMMON, CHANNEL_COMMAND),
269 // ^^ Use this and the StartDownLightDimmer instead of StartDimmer if your
270 // device has two dimmable lights.
271 @SerializedName("StartDownLightDimmer")
272 START_DOWN_LIGHT_DIMMER("StartDownLightDimmer", CHANNEL_GROUP_COMMON, CHANNEL_COMMAND),
273 // ^^ The counterpart to StartUpLightDimmer
274 @SerializedName("StartIncreasingBrightness")
275 START_INCREASING_BRIGHTNESS("StartIncreasingBrightness", CHANNEL_GROUP_COMMON, CHANNEL_COMMAND),
276 @SerializedName("StartDecreasingBrightness")
277 START_DECREASING_BRIGHTNESS("StartDecreasingBrightness", CHANNEL_GROUP_COMMON, CHANNEL_COMMAND),
280 @SerializedName("OEMRandom")
281 OEM_RANDOM("OEMRandom", CHANNEL_GROUP_COMMON, null),
282 @SerializedName("OEMTimer")
283 OEM_TIMER("OEMTimer", CHANNEL_GROUP_COMMON, null),
284 @SerializedName("Unknown")
285 UNKNOWN("Unknown", CHANNEL_GROUP_COMMON, null);
287 private String actionId;
288 private String channelGroupTypeId;
289 private @Nullable String channelTypeId;
291 private BondDeviceAction(final String actionId, String channelGroupTypeId, @Nullable String channelTypeId) {
292 this.actionId = actionId;
293 this.channelGroupTypeId = channelGroupTypeId;
294 this.channelTypeId = channelTypeId;
298 * @return the actionId
300 public String getActionId() {
305 * @return the channelGroupTypeId
307 public String getChannelGroupTypeId() {
308 return channelGroupTypeId;
312 * @return the channelTypeId
314 public @Nullable String getChannelTypeId() {
315 return channelTypeId;