Turn the switch off when script finishes

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
mirikbb
Posts: 6
Joined: Wednesday 12 September 2018 14:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Turn the switch off when script finishes

Post 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.
devros
Posts: 183
Joined: Saturday 29 October 2016 20:55
Target OS: -
Domoticz version:
Contact:

Re: Turn the switch off when script finishes

Post 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'
mirikbb
Posts: 6
Joined: Wednesday 12 September 2018 14:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Turn the switch off when script finishes

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Turn the switch off when script finishes

Post 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)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest