Page 1 of 1

Needed help to set Door Contact

Posted: Thursday 06 July 2017 14:44
by fvdijke
Hi, i need some help because this small case is driving me mad!!!!

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 switch=Berging
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

Re: Needed help to set Door Contact

Posted: Thursday 06 July 2017 20:55
by Fainted
Unsure about the LUA but it seems that you should try to fix the device instead, have you tried to configure the device to send basic or binary commands?

Re: Needed help to set Door Contact

Posted: Thursday 06 July 2017 21:03
by fvdijke
Oke, fixed the problem.
Apparently the script is triggered with the value 'Open' (log reports On) but the switch need the value "Off"
I tried On in the scripts but that's not working.

Confused? Well, i am :)

Code: Select all

CODE: SELECT ALL
commandArray = {}
if (devicechanged['Berging'] == 'Open') then
   commandArray['Berging'] = 'Off AFTER 2'
end

return commandArray

2017-07-06 21:44:04.101 User: Admin initiated a switch command (602/Berging/On)
2017-07-06 21:44:04.102 RFLink Sending: 10;EV1527;057f03;0;ON
2017-07-06 21:44:04.596 EventSystem: Script event triggered: Deursluiter
2017-07-06 21:44:06.598 RFLink Sending: 10;EV1527;057f03;0;OFF