Help with doorbell script

Post Reply
Posts: 19
Joined: Thursday 31 August 2017 8:13
Target OS: -
Domoticz version:

Help with doorbell script

Post by iLLiac4 » Monday 18 September 2017 8:17


I want to achieve that the doorbell will start to ring after the door sensor is opened for more then 20 second. It must to continue ringing every 20 seconds if the door is not closed.
If the door is closed before the 20 second it must not ring.

The script below works but it rings even if you open and close the door within 20 second.

Code: Select all

commandArray = {}

for deviceName,deviceValue in pairs(otherdevices) do
    if (deviceName=='Door') then
        if deviceValue == "Alarm" then
            commandArray['Doorbell'] = "On AFTER 20"
            print("Doors are open!!!")
        elseif deviceValue == "Normal" then
           print("Doors are closed!!!")

User avatar
Posts: 269
Joined: Monday 23 February 2015 13:45
Target OS: Windows
Domoticz version: 3.4834
Location: Netherlands

Re: Help with doorbell script

Post by mrf68 » Monday 18 September 2017 16:51


the "Doorbell = On AFTER 20" is just a delay. If the statement is true (= door is open) it will ring the doorbell after 20 seconds. There is no check wether the door is closed before the 20 second delay. So it will always ring after 20 seconds.

I think you can solve this problem with a dummy switch that is triggered after 20 seconds and let the doorbell ring when the dummy switch is on AND the door is open.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest