Using exec binding with Switch mapping and Selection

is there any suggestions if it’s possible to use exec binding with Switch mappings and Selection?


Thing exec:command:remote-send [command="/usr/bin/python3.9 /home/openhabian/BlackBeanControl/ -c %2$s", interval=0, timeout=5, autorun=true]


Text label="Luci" icon="rgb" {
	Switch item=BROAD_LINK_SWITCH mappings=["ON"="Switch on","OFF"="Switch off", "CUSTOM_COMMAND"="CUSTOM"]
	Selection item=BROAD_LINK_SELECTION mappings=["R"="Red", "G"="Green", "B"="Blue"]

How have I to configure items?


That rather depends on what you need to send.

Note, that Exec input channel is of string type. (String type Items may be used with sitemap Switch and Selection widgets.)

Note, there is only one input channel, you cannot send two Item commands at once (though of course you can combine multiple data points into one command in a rule)

I need to send only 1 command, but dynamic using a mapping or selection

Okeydoke, what difficulty are you having?

Ok, I had to configure the “input” as a String in the items:

String Led_Piscina_Command
String Led_Piscina_Args {channel="exec:command:remote-send:input"}

then sitemap:

Switch item=Led_Piscina_Command mappings=[ "ON"="ON", "OFF"="OFF", "R"="Red" ]

and then a rule to manage dynamically the command:

rule "Led piscina rule"
   Item Led_Piscina_Command received command

You can do this without a rule

Note, that this rule is doomed to failure

Because when the rule triggers on command no state change will yet have happened

1 Like