Files
Domoticz/octoprint2Status.sh
2025-03-06 11:09:58 +01:00

17 lines
548 B
Bash
Executable File

#!/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