this way i can easy check if somebody is home or not(and do some automated stuff)
everything is working but i want to make the script more readably by using either a helper function or a module.
I really can not see how to do this (i do not understand dzvents enough i guess)
i simply want a module which i can call to see if somebody is home or not but do not know how to do this
here is the code
basically if every device is in an off state i asume nobody is home
if any of the devices are in an on state i assume somebody is home
so how does the module look and how does the code look to call that module in the standard script
Code: Select all
if (domoticz.devices('Samsung-TV').state == 'On' or
domoticz.devices('iPhone').state == 'On' or
domoticz.devices('iPad').state == 'On' or
domoticz.devices('iPod').state == 'On') then
domoticz.devices('Status').updateText('Alarm niet ingeschakeld. Er is nog iemand aanwezig')
domoticz.log('Alarm niet ingeschakeld. Er is nog iemand aanwezig')
elseif (domoticz.devices('iPhone').state == 'Off' and
domoticz.devices('iPad').state == 'Off' and
domoticz.devices('iPod').state == 'Off') then
domoticz.sendCommand('Security Panel', 'Arm Away')