#!/bin/bash
DOMO_IP="localhost"             # Domoticz IP Address
DOMO_PORT="81"                    # Domoticz Port
OCTOPRINT_IDX=682 # numéro ID de l interrupteur du relais

json="http://akhenaton-3:5002/api/job?apikey=A6C678D49AC8465AB0AF01EBBF2C754F"
echo "$json"
reponse=`curl -i -H -s "Accept: application/json" $json|grep "state"|awk -F: '{print $2}'`
echo "$reponse"

if [ "$reponse" = " \"Operational\"" ] 
then
	sleep 120
	curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=switchlight&idx=$OCTOPRINT_IDX&switchcmd=Off" 
fi

