I have a magnetic doorcontact that, when the door opens it set the switch to open. This switch wil stay open even when the door is closed again.
So, i created a script that, when the switch is set to Open, it sets it back to Closed after 2 sec. Simple but meaningfull to me
This is the small script:
Code: Select all
commandArray = {}
if (devicechanged['Berging'] == 'Open') then
commandArray['Berging'] = 'Closed AFTER 2'
else
print('Deur is nog niet gesloten')
end
return commandArray
Name of the script=Deursluiter
If i manualy open the switch Berging, the script is triggerd:
2017-07-06 14:38:52.389 User: fvdijke initiated a switch command (602/Berging/On)
2017-07-06 14:38:52.391 RFLink Sending: 10;EV1527;057f03;0;ON
2017-07-06 14:38:52.878 RFLink: 20;54;OK;
2017-07-06 14:38:52.892 EventSystem: Script event triggered: Deursluiter
2017-07-06 14:38:52.893 (RFLink 433 MHz) Light/Switch (Berging)
2017-07-06 14:38:54.650 LUA: Deur is nog niet gesloten
But never closes the switch again.
What is wrong with my script???
(i tried all scripttypes, all, device, .... and i tried on/off iso open/closed)
Thanks in advance