how to create a button with an sh command?
i want to use this command for example hs0100.sh 192.168.1.20 9999 on
i had installed exec binding
can you help me to use it to make a button to execute the script ?
thank you
Hi,
just try this:
For a pushbutton you can just set your switch back to “OFF” at the end of your rule
Jens
can you tell me exactly what should i put please? and where items? maps ? things?
Hi,
do you have already some experience with OpenHAB?
Jens
I have not tried by myself, but this way should work:
- First activate the binding “exec” in Paper UI
- configure item like this
Switch button { exec="ON:'some command'"}
then you must set up a rule to turn the switch back OFF in a button.rules file:
rule "button off"
when
Item button changed from OFF to ON
then
postUpdate(button,OFF)
end
To get a button instead of a switch, use mappings in the sitemap in combination with autoupdate=“false”.
.items:
Switch MyButton "My Button" {exec="ON:'some command'",autoupdate="false"}
.sitemap:
Switch item=MyButton mappings=[ON="GO!"]
This would draw a button instead of a switch, the button will be labeled “GO!”. No need for resetting the button, as autoupdate="false"
prevents OH to update the state of the underlying switch.
You could also draw more than one button (especially when using a Number item):
Switch item=MyNumberButton mappings=[1="One",2="Two",3="Three"]
i have done it thank you
but theproblem is that open hab dont know the status of the switch if it on or off anyway to make this done ? and the swtich on openhab move to on even if the switch in real life is disconnected