Page 1 of 1
Turn the switch off when script finishes
Posted: Saturday 27 October 2018 22:10
by mirikbb
Hello,
I have a dummy switch. When I turn it ON, it executes associated bash script.
Currently, when the script finishes, the switch will stay in ON position.
I am searching the way how to turn the switch OFF, automatically when the script finishes.
Many thanx for help.
Re: Turn the switch off when script finishes
Posted: Saturday 27 October 2018 22:25
by devros
hello just add curl json command at end of the script
something like this
curl '
http://YOURIP/json.htm?type=command&par ... tchcmd=Off'
Re: Turn the switch off when script finishes
Posted: Saturday 27 October 2018 23:11
by mirikbb
brilliant devros! Many thanx for navigating me to the solution.
as I have got 'Unauthorized' response to curl, I just had to extend the url with my relevant encoded name/password, based on the response from this thread
viewtopic.php?t=19949
Re: Turn the switch off when script finishes
Posted: Sunday 28 October 2018 0:28
by waaren
mirikbb wrote: ↑Saturday 27 October 2018 22:10
I have a dummy switch. When I turn it ON, it executes associated bash script.
Currently, when the script finishes, the switch will stay in ON position.
I am searching the way how to turn the switch OFF, automatically when the script finishes.
If you want to be sure that the switch return to the Off state even when the start- or execution of the bash-script fails before it reach the curl command, as explained by devros, you could set the Off delay to n seconds in the edit section of the switch (to be reached via the edit button on the device at the switches tab)