Talk:Presence detection
Jump to navigation
Jump to search
If You want change only state switch without any action must chang this lines:
...... domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=switchlight&idx=" + switchid + "&switchcmd=On&level=0" + "&passcode=" + domoticzpasscode)
else: log (datetime.datetime.now().strftime("%H:%M:%S") + "- " + device + " online, but domoticz already knew") lastreported=1 if currentstate == 1 and currentstate != previousstate : log (datetime.datetime.now().strftime("%H:%M:%S") + "- " + device + " offline, waiting for it to come back") if currentstate == 1 and (datetime.datetime.now()-lastsuccess).total_seconds() > float(cooldownperiod) and lastreported != 0 : if domoticzstatus() == 1 : log (datetime.datetime.now().strftime("%H:%M:%S") + "- " + device + " offline, tell domoticz it's gone") domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=switchlight&idx=" + switchid + "&switchcmd=Off&level=0" + "&passcode=" + domoticzpasscode)
.....
For this:
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + switchid + "&nvalue=1&svalue=1" + "&passcode=" + domoticzpasscode) else: log (datetime.datetime.now().strftime("%H:%M:%S") + "- " + device + " online, but domoticz already knew") lastreported=1 if currentstate == 1 and currentstate != previousstate : log (datetime.datetime.now().strftime("%H:%M:%S") + "- " + device + " offline, waiting for it to come back") if currentstate == 1 and (datetime.datetime.now()-lastsuccess).total_seconds() > float(cooldownperiod) and lastreported != 0 : if domoticzstatus() == 1 : log (datetime.datetime.now().strftime("%H:%M:%S") + "- " + device + " offline, tell domoticz it's gone") domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + switchid + "&nvalue=0&svalue=0" + "&passcode=" + domoticzpasscode)