Page 1 of 1

Arm/Disarm security with a script

Posted: Monday 23 November 2020 21:31
by johansson
How do I set the security panel status to ArmAway/ArmHome/Disarm with dzvents? I'd need just a push button (or dummy switch with Alexa) for kids to arm the alarm, i.e. switch cameras on etc.

Probably too simple, but just couldn't figure it out.

Thanks in advance.

Re: Arm/Disarm security with a script

Posted: Monday 23 November 2020 22:27
by waaren
johansson wrote: Monday 23 November 2020 21:31 How do I set the security panel status to ArmAway/ArmHome/Disarm with dzVents?
below is one way of controlling the security panel with a dzVents script.

[EDIT] used armHome() twice should have been disarm()

Code: Select all

return
{
    on =
    {
        devices =
        {
            'armAway', -- push Buttons
            'armHome',
            'disarm',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR if all OK
        marker = 'Security', 
    },

    execute = function(dz, item)
        local security = dz.devices('Domoticz Security Panel') -- or any other name you gave the panel device

        if item.name == 'armAway' then
            security.armAway().afterSec(60)  -- You have 60 seconds to leave the house ...
        elseif item.name == 'armHome' then
            security.armHome()
        else
            security.disarm()
        end
    end
}


Re: Arm/Disarm security with a script  [Solved]

Posted: Tuesday 24 November 2020 9:52
by johansson
Perfect! It was just as simple as it should have been, but missed few details here and there - now it works.

Thanks waaren.

Re: Arm/Disarm security with a script

Posted: Tuesday 24 November 2020 11:40
by waaren
johansson wrote: Tuesday 24 November 2020 9:52 Perfect! It was just as simple as it should have been, but missed few details here and there - now it works.
I had to edit my previous post. Please use that one.