#!/bin/sh
#
# /home/pi/domoticz/scripts/bash/enable_timers.sh
# bash script to enable or disable all light timers

if [ "$1" = "1" ] 
then
  ACTION="enabletimer"
elif [ "$1" = "0" ]
then
  ACTION="disabletimer"
else
  curl "http://192.168.0.22:8080/json.htm?type=command&param=addlogmessage&message=Invalid%20parameter"
  echo "Invalid parameter"
  exit 1
fi

# optional but helps to log enabling or disabling of timers
curl "http://192.168.0.22:8080/json.htm?type=command&param=addlogmessage&message=$ACTION"

# update timers
curl "http://192.168.0.22:8080/json.htm?type=command&param=$ACTION&idx=6" 
curl "http://192.168.0.22:8080/json.htm?type=command&param=$ACTION&idx=7" 
curl "http://192.168.0.22:8080/json.htm?type=command&param=$ACTION&idx=8" 
curl "http://192.168.0.22:8080/json.htm?type=command&param=$ACTION&idx=9"
