The on action passes a time to turn off the tree lights to the script and sends it to the background (as it may run for many hours):
Code: Select all
script:///home/pi/domoticz/scripts/bash/christmas_tree_on.sh 23:58 &
Code: Select all
#!/bin/bash
while [ $(date +%H:%M) '<' "$1" ];
do
curl --request PUT --data "{\"on\": true}" http://192.168.1.xx/api/xxxx/lights/5/state
curl --request PUT --data "{\"on\": false}" http://192.168.1.xx/api/xxxx/lights/7/state
sleep 2
curl --request PUT --data "{\"on\": false}" http://192.168.1.xx/api/xxxx/lights/5/state
curl --request PUT --data "{\"on\": true}" http://192.168.1.xx/api/xxxx/lights/7/state
sleep 2
echo $(date +%H:%M)
echo $1
done
curl --request PUT --data "{\"on\": false}" http://192.168.1.xx/api/xxxx/lights/5/state
curl --request PUT --data "{\"on\": false}" http://192.168.1.xx/api/xxxx/lights/7/state
Code: Select all
script:///home/pi/domoticz/scripts/bash/christmas_tree_off.sh
Code: Select all
#!/bin/bash
killall christmas_tree_on.sh
curl --request PUT --data "{\"on\": false}" http://192.168.1.xx/api/xxxx/lights/5/state
curl --request PUT --data "{\"on\": false}" http://192.168.1.xx/api/xxxx/lights/7/state