Arm/Disarm security with a script  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
johansson
Posts: 75
Joined: Sunday 27 September 2015 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Finland
Contact:

Arm/Disarm security with a script

Post 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.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Arm/Disarm security with a script

Post 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
}

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
johansson
Posts: 75
Joined: Sunday 27 September 2015 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Finland
Contact:

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

Post 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.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Arm/Disarm security with a script

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest