Needed help to set Door Contact

Moderator: leecollings

Post Reply
User avatar
fvdijke
Posts: 6
Joined: Monday 19 June 2017 20:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8000
Contact:

Needed help to set Door Contact

Post 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
Fainted
Posts: 21
Joined: Thursday 08 September 2016 13:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Needed help to set Door Contact

Post 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?
User avatar
fvdijke
Posts: 6
Joined: Monday 19 June 2017 20:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8000
Contact:

Re: Needed help to set Door Contact

Post 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
Last edited by fvdijke on Thursday 06 July 2017 21:58, edited 2 times in total.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests