I would like to have a button, if pressed, make a dropdown list of my scenes and when I select one of the scenes, this scene will turn on, my scenes are made as switch items.
I’ve tried using the selection widget but I can only make it work with an item that is linked to a thing where the developer of the binding provides the options via the thing channel definition.
Are there any alternatives to the selection widget that can do what I am looking for?
Why don’t you use a proxy (String/Number) item? Then create a rule, based on what the item contains.
eg.
Item:
Number SceneSelector
rule:
Rule "Scene Selector"
when
Item SceneSelector received update
then
switch (SceneSelector){
case 1: //rule for scene 1
case 2: //rule for scene 2
//etc etc etc
}
end
I just tried your instructions, but I must have done something wrong because I can’t make it work.
I made a number item as described: Number SceneSelector
and a rule
Rule “Scene Selector”
when
Item SceneSelector received update
then
switch (SceneSelector){
case 1: sendCommad(Kontor_Spot,OFF)//rule for scene 1
case 2: //rule for scene 2
//etc etc etc
}
end
Did you get any error in de log?
Oh wait, I see my mistake:
The switch command in the rule must be
switch (SceneSelector.state)
Mind the .state
Secondly I see a typo in your rule sendCommad(Kontor_Spot,OFF) must be sendCommand(Kontor_Spot,OFF). Or as I prefer Kontor_Spot.sendCommand(OFF). You can read here why
The UI sends commands (although autoupdate usually turns those into state updates later)
A more direct way would be to have the rule triggered by received command in the ‘when’ section, and to use receivedCommand implicit variable in the ‘then’ section as the switch statement selector