alarm action script not executed [SOLVED]

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

Moderator: leecollings

Post Reply
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

alarm action script not executed [SOLVED]

Post by AllesVanZelf »

Hello,
I had an alarmsystem working on Blockly. Recently I moved to DzVents. And I'm very happy with that move. But now I have something unexpected. One script won't trigger.

I have several scripts related to alarm. If there is an alarm (Alarm Home or Alarm Away) the dummy switches with the names 'Alarmsituatie Thuis', or 'Alarmsituatie Niet Thuis' are switched on. This is working well. But when one of these switches is turned on, I would expect some defined actions like I defined in below script. This script is turned On.

Code: Select all

return
{
     on =
     {
        devices =
        {
            'Alarmsituatie Thuis',
            'Alarmsituatie Niet Thuis',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
    },
    
    execute = function(dz)
        local alarmt = dz.devices('Alarmsituatie Thuis')
        local alarmnt = dz.devices('Alarmsituatie Niet Thuis')
        local sirene = dz.devices('Sirene Studeerkamer')
        local dialtone = dz.devices('BT-Play dialtone')

        dz.log('Alarmsituatie Thuis,   state: ' .. alarmt.state, dz.LOG_DEBUG)
        dz.log('Alarmsituatie Niet Thuis,   state: ' .. alarmnt.state, dz.LOG_DEBUG)
        dz.log('Sirene Studeerkamer,   state: ' .. sirene.state, dz.LOG_DEBUG)
        dz.log('BT-Play dialtone,   state: ' .. dialtone.state, dz.LOG_DEBUG)

        if alarmt.state == 'On' then
            sirene.switchOn().silent()
            dz.log('Alarm Thuis geactiveerd, maar Sirene niet aan', dz.LOG_INFO)
            dz.notify('Alarm', 'Alarm Thuis geactiveerd, maar sirene niet aan', dz.PRIORITY_HIGH, dz.SOUND_DEFAULT,nil, dz.NSS_TELEGRAM)
 
        elseif alarmnt.state == 'On' then
            sirene.switchOn().silent()
            dz.notify('Alarm', 'niet Thuis geactiveerd, sirene aan!', dz.PRIORITY_LOW, dz.SOUND_DEFAULT,nil, dz.NSS_TELEGRAM)
            dz.log('Alarm Thuis geactiveerd, Sirene aan!', dz.LOG_INFO)
            dialtone.switchOn().silent()
            
        end
    end
}
But it is not working. No Siren and no telegram. If I look in the log, this script is not even triggered. But I do not understand why not.
Do you see why this script is not triggered?
Last edited by AllesVanZelf on Tuesday 14 July 2020 15:33, edited 4 times in total.
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: alarm action script not executed

Post by waaren »

AllesVanZelf wrote: Tuesday 14 July 2020 12:12 I had an alarmsystem working on Blockly.

If I look in the log, this script is not even triggered. But I do not understand why not.
Do you see why this script is not triggered?
Are other dzVents scripts still working?
What are the names / types / subTypes of 'Alarmsituatie Thuis' and 'Alarmsituatie Niet Thuis' on the devices tab ?
How are the states switched of these devices ?
If you use the domoticz internal editor to write / save this script, what do you see in the log when you add a comment line and save it again?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: alarm action script not executed

Post by AllesVanZelf »

Image

I'm not sure if I understand your question. In the script where I switch on the dummy, it is switched like:
alarmt.switchOn().silent()
and they are switched on and off.

When I resave this script:

Code: Select all

 2020-07-14 12:35:06.881 Status: EventSystem: reset all events...
2020-07-14 12:35:06.891 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/Security-Alarm Tag reader DzVents.lua
2020-07-14 12:35:06.891 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/Security-Alarm Remote control buttons DzVents.lua
2020-07-14 12:35:06.892 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/Security-Alarm Thuis DzVents.lua
2020-07-14 12:35:06.892 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/Security-Alarm Niet Thuis DzVents.lua
2020-07-14 12:35:06.893 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/Security Alarm aan actie DzVents.lua
2020-07-14 12:35:06.893 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/Security Alarm uit DzVents.lua
No errors
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: alarm action script not executed

Post by waaren »

AllesVanZelf wrote: Tuesday 14 July 2020 12:36 alarmt.switchOn().silent()
The silent() prevents follow up events to be triggered
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: alarm action script not executed

Post by AllesVanZelf »

Yess
That's it. I did not know that silent() was working from script to script.
Thanks a lot.

ps. How do you make the subject [SOLVED] with the link to the post? The

Code: Select all

[url=][/url]
does not work in the subject
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest