Page 1 of 1

Domoticz-Enigma2 Status check

Posted: Wednesday 12 December 2018 16:19
by NoProfesor
Who will help to write LUA or phython script based on bash that will check the status of the enigma2 decoder every 5 or 30 seconds?

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&param=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&param=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&param=switchlight&idx=13&switchcmd=Off'
    		echo "$enigma2LivingStatus"
    		echo enigma2 Living is in standby
    		echo enigma2 Living not found

	fi