]> git.basschouten.com Git - openhab-addons.git/blob
c943f2efeb274ab818833f561137d82f0c686eb7
[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 static org.openhab.binding.bondhome.internal.BondHomeBindingConstants.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 import com.google.gson.annotations.SerializedName;
21
22 /**
23  * This enum represents the possible device actions
24  *
25  * @author Sara Geleskie Damiano - Initial contribution
26  *
27  */
28 @NonNullByDefault
29 public enum BondDeviceAction {
30
31     // State Variables
32     // power: (integer) 1 = on, 0 = off
33     // Actions
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.
43
44     // State Variables
45     // timer: (integer) seconds remaining on timer, or 0 meaning no timer running
46     // Actions
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.
52
53     // Properties
54     // max_speed: (integer) highest speed available
55     // State Variables
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.
59     // Actions
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
75     // is ignored.
76
77     // State Variables
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)
84     // Actions
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]).
95
96     // State Variables
97     // direction: (integer) 1 = forward, -1 = reverse.
98     // The forward and reverse modes are sometimes called Summer and Winter,
99     // respectively.
100     // Actions
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.
107
108     // State Variables
109     // light: (integer) 1 = light on, 0 = light off
110     // Actions
111     @SerializedName("TurnLightOn")
112     TURN_LIGHT_ON("TurnLightOn", CHANNEL_GROUP_LIGHT, CHANNEL_LIGHT_POWER),
113     // ^^ Turn light on.
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.
120
121     // State Variables
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
125     // for down light.
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.
129     // Actions
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.
148
149     // State Variables
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.
155     // Actions
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.
169
170     // State Variables
171     // up_light_brightness: (integer) percentage value of up light brightness,
172     // 1-100.
173     // down_light_brightness: (integer) percentage value of down light brightness,
174     // 1-100.
175     // Actions
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.
196
197     // State Variables
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.
201     // Actions
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
211     // the power.
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.
219
220     // State Variables
221     // fpfan_power: (integer) 1 = on, 0 = off
222     // fpfan_speed: (integer) from 1-100
223     // Actions
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
233
234     // State Variables
235     // open: (integer) 1 = open, 0 = closed
236     // Actions
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
249
250     // Other actions
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),
278
279     // More actions
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);
286
287     private String actionId;
288     private String channelGroupTypeId;
289     private @Nullable String channelTypeId;
290
291     private BondDeviceAction(final String actionId, String channelGroupTypeId, @Nullable String channelTypeId) {
292         this.actionId = actionId;
293         this.channelGroupTypeId = channelGroupTypeId;
294         this.channelTypeId = channelTypeId;
295     }
296
297     /**
298      * @return the actionId
299      */
300     public String getActionId() {
301         return actionId;
302     }
303
304     /**
305      * @return the channelGroupTypeId
306      */
307     public String getChannelGroupTypeId() {
308         return channelGroupTypeId;
309     }
310
311     /**
312      * @return the channelTypeId
313      */
314     public @Nullable String getChannelTypeId() {
315         return channelTypeId;
316     }
317 }