From c37b269586a1c8c7213c11cb932f94adc6efecb9 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 28 Sep 2023 20:29:13 +0200 Subject: [PATCH] Updated Domoticz API calls Updated API call for getting device status from "type=devices" to "type=command¶m=getdevices" --- bin/BtPing.sh | 2 +- bin/SmartPing.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/BtPing.sh b/bin/BtPing.sh index 194ab83..8adc7af 100755 --- a/bin/BtPing.sh +++ b/bin/BtPing.sh @@ -28,7 +28,7 @@ sendDomoticz() { fi # Check Online / Offline state of Domoticz device - if [ "$DomoSendMSG" != "$(curl -s "http://"$DomoticzAddr"/json.htm?type=devices&rid="$DomoticzIDX"" | grep '"Data" :' | awk '{ print $3 }' | sed 's/[!@#\$%",^&*()]//g')" ] ; then + if [ "$DomoSendMSG" != "$(curl -s "http://"$DomoticzAddr"/json.htm?type=command¶m=getdevices&rid="$DomoticzIDX"" | grep '"Data" :' | awk '{ print $3 }' | sed 's/[!@#\$%",^&*()]//g')" ] ; then echo "Updating Domoticz device" | tee -a $LogFile curl -s "http://"$DomoticzAddr"/json.htm?type=command¶m=switchlight&idx="$DomoticzIDX"&switchcmd="$DomoSendMSG"" 2>&1 1>/dev/null fi diff --git a/bin/SmartPing.sh b/bin/SmartPing.sh index 7f51e7a..3335df5 100755 --- a/bin/SmartPing.sh +++ b/bin/SmartPing.sh @@ -29,7 +29,7 @@ sendDomoticz() { fi # Check Online / Offline state of Domoticz device - if [ "$DomoSendMSG" != "$(curl -s "http://"$DomoticzAddr"/json.htm?type=devices&rid="$DomoticzIDX"" | grep '"Data" :' | awk '{ print $3 }' | sed 's/[!@#\$%",^&*()]//g')" ] ; then + if [ "$DomoSendMSG" != "$(curl -s "http://"$DomoticzAddr"/json.htm?type=command¶m=getdevices&rid="$DomoticzIDX"" | grep '"Data" :' | awk '{ print $3 }' | sed 's/[!@#\$%",^&*()]//g')" ] ; then echo "Updating Domoticz device" | tee -a $LogFile curl -s "http://"$DomoticzAddr"/json.htm?type=command¶m=switchlight&idx="$DomoticzIDX"&switchcmd="$DomoSendMSG"" 2>&1 1>/dev/null fi