Help with doorbell script

Moderator: leecollings

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

Help with doorbell script

Post by iLLiac4 »

Hi.

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!!!")
        end
    end
end
mrf68

Re: Help with doorbell script

Post by mrf68 »

Hi,

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