Help with doorbell script

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

Help with doorbell script

Post by iLLiac4 » Monday 18 September 2017 8:17

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

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

Re: Help with doorbell script

Post by mrf68 » Monday 18 September 2017 16:51

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.
----------
3x RPi
1x W2k12 (vm)
3x RFXcom433e
1x Razberry board
KAKU: 9x APA3-1500R, 2x ACDB-7000C, 3x AMST-606, 1x APIR-2150, 1x AWS-3500, 1x ATMT-502
Z-wave: 8x Everspring AN145
Misc: 2x wireless doorbells

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests