Script with Domoticz Security Panel  [Solved]

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

Moderator: leecollings

Post Reply
Nefsolive
Posts: 69
Joined: Monday 04 September 2017 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Script with Domoticz Security Panel

Post by Nefsolive »

Hello,

I am trying to create a script in dzvents with Domoticz Security Panel.

If the Domoticz Security Panel is in "Arm Way", and the doors sensors are activated to "open" then activate the alarm dummy to "On" after 15 seconds with a Beep.
If Domoticz Security Panel e is activated to "disable" then the doors sensors may be "on" and does not activate the alarm.

Has anyone created a script like this?

Ty
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Script with Domoticz Security Panel

Post by waaren »

Nefsolive wrote: Friday 12 February 2021 19:44 I am trying to create a script in dzvents with Domoticz Security Panel.
  • what do you have so far?
  • what are the names / idx of your doorsensors?
  • what is the name / idx / deviceType / deviceSubtype of your alarm dummy?
  • what is the name / idx of your security panel device?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Nefsolive
Posts: 69
Joined: Monday 04 September 2017 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Script with Domoticz Security Panel

Post by Nefsolive »

waaren wrote: Friday 12 February 2021 20:06
Nefsolive wrote: Friday 12 February 2021 19:44 I am trying to create a script in dzvents with Domoticz Security Panel.
  • what do you have so far?
  • what are the names / idx of your doorsensors?
  • what is the name / idx / deviceType / deviceSubtype of your alarm dummy?
  • what is the name / idx of your security panel device?
Hello Waaren,
So far, i try whit blocky and i have some results, but i want try whit dzvents, and i have some dificult whit Security Panel!
This is my list;

[*]what are the names / idx of your doorsensors?
Porta / 9
Sótão Porta 1 / 1519
Sótão Porta 2 / 1523
Sótão Porta 3 / 1527
[*]what is the name / idx / deviceType / deviceSubtype of your alarm dummy?
Alarm /1531 / Light/Switch / Switch
[*]what is the name / idx of your security panel device?[/list]
Painel de Alarme / 1133

Thank u for your atention!
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Script with Domoticz Security Panel  [Solved]

Post by waaren »

Nefsolive wrote: Friday 12 February 2021 20:27 This is my list;
In it's most simple form it could look like below

Code: Select all

return
{
    on =
    {
        devices =
        {
            1519, 1523, 1527, -- doors
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- change to domoticz.LOG_ERROR when all OK
        marker = 'conditional Security',
    },

    execute = function(dz, item)

        dz.log('State of device ' .. item.name .. ' is now ' .. item.state, dz.LOG_DEBUG)

        local security = dz.devices(1133)
        local alarm = dz.devices(1531)

        if item.state == 'open' and security.state == dz.SECURITY_ARMEDAWAY then
            alarm.switchOn().afterSec(15)
            dz.log('beep', dz.LOG_DEBUG)
        end
    end
}

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Nefsolive
Posts: 69
Joined: Monday 04 September 2017 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Script with Domoticz Security Panel

Post by Nefsolive »

waaren wrote: Friday 12 February 2021 20:55
Nefsolive wrote: Friday 12 February 2021 20:27 This is my list;
In it's most simple form it could look like below

Code: Select all

return
{
    on =
    {
        devices =
        {
            1519, 1523, 1527, -- doors
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- change to domoticz.LOG_ERROR when all OK
        marker = 'conditional Security',
    },

    execute = function(dz, item)

        dz.log('State of device ' .. item.name .. ' is now ' .. item.state, dz.LOG_DEBUG)

        local security = dz.devices(1133)
        local alarm = dz.devices(1531)

        if item.state == 'open' and security.state == dz.SECURITY_ARMEDAWAY then
            alarm.switchOn().afterSec(15)
            dz.log('beep', dz.LOG_DEBUG)
        end
    end
}

Waaren, like you say, it's most simple form!
Thank u, one more time, for your help.

Works like a charm.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest