I did try to make a script to turn on/off my tablet screen with my motion sensor.
It function, but i see in my log that i get 2 times a screen off command, when sensor is off. And when sensor is on, it sends first off command and then on command.
What do i have wrong in my script.
Code: Select all
commandArray = {}
if (devicechanged['MotionWoonkamer']) then
if (otherdevices['MotionWoonkamer']) == 'On' then
commandArray={['OpenURL']='http://xxx.xxx.xxx.xxx:2323/?cmd=screenOn&password=xxxxxx'}
print('Tablet Scherm Aan.')
elseif (otherdevices['MotionWoonkamer']) == 'Off' then
commandArray={['OpenURL']='http://xxx.xxx.xxx.xxx:2323/?cmd=screenOff&password=xxxxx'}
print('Tablet Scherm Uit.')
end
end
return commandArray
Code: Select all
2020-04-04 14:17:48.190 Status: OpenZWave: Alarm received (Home Security: Clear), NodeID: 7 (0x07)
2020-04-04 14:17:48.320 Status: LUA: Tablet Scherm Uit.
2020-04-04 14:17:48.321 Status: EventSystem: Fetching URL http://xxx.xxx.xxx.xxx:2323/?cmd=screenOff&password=xxxxx after 0.2 seconds...
2020-04-04 14:17:48.321 Status: EventSystem: Script event triggered: Scherm Tablet
2020-04-04 14:17:48.401 Status: LUA: Tablet Scherm Uit.
2020-04-04 14:17:48.403 Status: EventSystem: Fetching URL http://xxx.xxx.xxx.xxx:2323/?cmd=screenOff&password=xxxxx after 0.2 seconds...
2020-04-04 14:17:48.403 Status: EventSystem: Script event triggered: Scherm Tablet
Code: Select all
2020-04-04 14:17:59.937 Status: OpenZWave: Alarm received (Home Security: Motion Detected at Unknown Location), NodeID: 7 (0x07)
2020-04-04 14:18:00.020 Status: LUA: Tablet Scherm Uit.
2020-04-04 14:18:00.021 Status: EventSystem: Fetching URL http://xxx.xxx.xxx.xxx:2323/?cmd=screenOff&password=xxxxx after 0.2 seconds...
2020-04-04 14:18:00.021 Status: EventSystem: Script event triggered: Scherm Tablet
2020-04-04 14:18:00.102 Status: LUA: Tablet Scherm Aan.
2020-04-04 14:18:00.103 Status: EventSystem: Fetching URL http://xxx.xxx.xxx.xxx:2323/?cmd=screenOn&password=xxxxx after 0.2 seconds...
2020-04-04 14:18:00.103 Status: EventSystem: Script event triggered: Scherm Tablet