Code: Select all
#!/bin/bash
curl http://192.168.0.193/web/powerstate > /home/pi/domoticz/scripts/enigma2/powerstate_enigma2_living3.xml
enigma2LivingStatus=`xmlstarlet sel -t -m '//e2instandby' -v . -n </home/pi/domoticz/scripts/enigma2/powerstate_enigma2_living3.xml`
if [ $enigma2LivingStatus = "true" ]
then
curl 'http://192.168.0.193:8080/json.htm?type=command¶m=switchlight&idx=13&switchcmd=Off'
echo "$enigma2LivingStatus"
echo enigma2 Living is in standby
elif [ $enigma2LivingStatus = "false" ]
then
curl 'http://192.168.0.193:8080/json.htm?type=command¶m=switchlight&idx=13&switchcmd=On'
echo "$enigma2LivingStatus"
echo enigma2 Living is not in standby
else
curl 'http://192.168.0.193:8080/json.htm?type=command¶m=switchlight&idx=13&switchcmd=Off'
echo "$enigma2LivingStatus"
echo enigma2 Living is in standby
echo enigma2 Living not found
fi