Open Rudi1952 opened 3 years ago
I think you can put a notification on the Siren device. That's what i do. But i am thinking about adding an option to notify which device has been tripped
I have a script that do this. Little bit in Dutch :-)
`return {
active = true,
logging = {
--level = domoticz.LOG_INFO, -- Uncomment to override the dzVents global logging setting
marker = 'Alarm '
},
on = {
devices = {
'Alarm - SIREN',
'ALARM-House',
'Alarm - Arming Mode (Zone 0)',
'Alarm - Arming Mode (Zone 1)',
'Alarm - Arming Status (Zone 0)',
'Alarm - Arming Status (Zone 1)',
'Alarm - Open Sections Zone*'
},
timer = {
'every minute'
},
},
-- actual event code
-- in case of a timer event or security event, device == nil
execute = function(dz, item, triggerInfo)
-- Variables to customize ------------------------------------------------
local test = false
local AlarmSIREN = dz.devices('Alarm - SIREN')
local ALARMHouse = dz.devices('ALARM-House')
local AlarmArmingModeZone0 = dz.devices('Alarm - Arming Mode (Zone 0)')
local AlarmArmingModeZone1 = dz.devices('Alarm - Arming Mode (Zone 1)')
local AlarmArmingStatusZone0 = dz.devices('Alarm - Arming Status (Zone 0)')
local AlarmArmingStatusZone1 = dz.devices('Alarm - Arming Status (Zone 1)')
local switchSecurityPanel = dz.devices('SecPanel')
local alarmOpenSectionszone0 = dz.devices('Alarm - Open Sections Zone 0')
local alarmOpenSectionszone1 = dz.devices('Alarm - Open Sections Zone 1')
local OpenSections = ""
local isDonker = dz.devices('IsDonker')
-- Function --------------------------------------------------------------
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
-- Main ------------------------------------------------------------------
if (AlarmArmingModeZone0.levelName == "Armed Home" or AlarmArmingStatusZone0 == "Armed Away") then
if AlarmArmingStatusZone0.levelName == "Tripped" then
ALARMHouse.switchSelector(20)
elseif AlarmArmingStatusZone0.levelName == "Alert" then
ALARMHouse.switchSelector(10)
elseif AlarmArmingStatusZone0.levelName == "Open Sections" then
if alarmOpenSectionszone0.text ~= "None" then
OpenSections = OpenSections .. " Zone 0 = ".. alarmOpenSectionszone0.text
end
if alarmOpenSectionszone1.text ~= "None" then
OpenSections = OpenSections .. " Zone 1 = " .. alarmOpenSectionszone1.text
end
dz.notify('Alarm System', 'Open Sections Gedetecteerd:' .. OpenSections, dz.PRIORITY_HIGH)
end
end
if item.name == "Alarm - Arming Mode (Zone 0)" then
dz.notify('Alarm System', 'The new arming mode for zone 0 is ' .. AlarmArmingModeZone0.levelName .. '.', dz.PRIORITY_HIGH)
end
if item.name == "Alarm - Arming Mode (Zone 1)" then
dz.notify('Alarm System', 'The new arming mode for zone 0 is ' .. AlarmArmingModeZone1.levelName .. '.', dz.PRIORITY_HIGH)
end
if AlarmSIREN.state == "On" then
dz.log("Alarm - Siren ON")
ALARMHouse.switchSelector(10)
elseif AlarmSIREN.state == "Off" then
if ALARMHouse.level ~= 0 then
dz.log("Alarm - Siren OFF")
ALARMHouse.switchSelector(60)
end
end
if (item.name == "ALARM-House" and item.levelName == "UIT") then
if (test) then
dz.notify('Alarm', 'Back to normal', dz.PRIORITY_EMERGENCY)
end
dz.log("Send notification (ALARM-House = " .. ALARMHouse.levelName .. ")")
ALARMHouse.switchSelector(0)
ALARMHouse.switchOff()
logWrite("Zet schakelaar in Normale modus")
end
elseif (item.name == "ALARM-House" and item.levelName == "ALARM") then
if (test) then
logWrite("ALARM (TEST) - ALARM!!",dz.LOG_INFO)
else
dz.notify('Alarm', 'ALARM!!', dz.PRIORITY_EMERGENCY)
end
elseif (item.name == "ALARM-House" and item.levelName == "BRAND") then
if (test) then
logWrite("ALARM (TEST) - BRAND gedetecteerd. Sirene Aan.",dz.LOG_FORCE)
else
dz.notify('Alarm', 'BRAND gedetecteerd. Sirene Aan.', dz.PRIORITY_EMERGENCY)
end
elseif (item.name == "ALARM-House" and item.levelName == "SENSOR ONKLAAR") then
if (test) then
logWrite("ALARM (TEST) - Sensor gesaboteerd!! Sirene Aan.",dz.LOG_FORCE)
else
dz.notify('Alarm', 'Sensor gesaboteerd!! Sirene Aan.', dz.PRIORITY_HIGH)
end
elseif (item.name == "ALARM-House" and item.levelName == "HOGE TEMPERATUUR") then
if (test) then
logWrite("ALARM (TEST) - Hoge temperaturen gedetecteerd!! Sirene Aan.",dz.LOG_FORCE)
else
dz.notify('Alarm', 'Hoge temperaturen gedetecteerd!! Sirene Aan.', dz.PRIORITY_EMERGENCY)
end
end
end
}`
I installed the script, but i am missing some devices: ALARM-House, SecPanel and IsDonker
Can you tell me what type of devices i should insert? And according to the script the device ALARM-House should have different levels. maybe you can help me out
ALARM-House is a selector switch with the following levels: Normaal, ALARM, TRIPPED SENSOR, BRAND, HOGE TEMPERATUUR, SENSOR ONKLAAR, UIT
SecPanel is the build in security panel
IsDonker is a switch that is on when it's dark and off when it's day
I installed the plugin version 1.3.4. I installed the script above with the name Alarm as a dzvents script in Setup-More Options-Events I made a selector switch with the name ALARM-House. But all i see when i make an alarm, the script is not executed, Can't find the reason why. The status of the selector switch ALARM-House stays on level 'Normaal'while i think it should have the status of 'TRIPPED SENSOR'. Attached is data from the log file, i hope that you can help me.
2021-12-13 14:56:00.822 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/Alarm.lua 2021-12-13 14:57:00.732 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua 2021-12-13 14:59:07.950 Status: User: Admin (IP: 192.168.1.254) initiated a switch command (365/Alarm - Arming Mode (Zone 0)/Set Level) 2021-12-13 14:59:08.046 Alarm: (Alarm) UpdateDevice: Update 10:'10' (Alarm - Arming Mode (Zone 0)) 2021-12-13 14:59:08.136 Alarm: (Alarm) checkOpenSections - Total count in zone 0 of Open Section Devices = 0 2021-12-13 14:59:08.166 Alarm: (Alarm) UpdateDevice: Update 30:'30' (Alarm - Arming Status (Zone 0)) 2021-12-13 14:59:08.166 Alarm: (Alarm) Set Arming Status to Normal 2021-12-13 14:59:08.166 Alarm: (Alarm) checkOpenSections - Total count in zone 1 of Open Section Devices = 0 2021-12-13 14:59:08.190 Alarm: (Alarm) UpdateDevice: Update 30:'30' (Alarm - Arming Status (Zone 1)) 2021-12-13 14:59:08.190 Alarm: (Alarm) Set Arming Status to Normal 2021-12-13 14:59:08.281 Alarm: (Alarm) UpdateDevice: Update 0:'0' (Alarm - Arming Status (Zone 1)) 2021-12-13 14:59:08.281 Alarm: (Alarm) Set Arming Status to Off 2021-12-13 14:59:08.305 Domoticz Internal: Security (SecPanel) 2021-12-13 14:59:39.221 Alarm: (Alarm) UpdateDevice: Update 30:'30' (Alarm - Arming Status (Zone 1)) 2021-12-13 14:59:39.222 Alarm: (Alarm) Set Arming Status to Normal 2021-12-13 14:59:39.248 Alarm: (Alarm) UpdateDevice: Update 0:'0' (Alarm - Arming Status (Zone 1)) 2021-12-13 14:59:39.248 Alarm: (Alarm) Set Arming Status to Off 2021-12-13 15:01:00.992 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua 2021-12-13 15:01:02.003 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua 2021-12-13 15:01:09.226 Alarm: (Alarm) UpdateDevice: Update 30:'30' (Alarm - Arming Status (Zone 1)) 2021-12-13 15:01:09.226 Alarm: (Alarm) Set Arming Status to Normal 2021-12-13 15:01:09.258 Alarm: (Alarm) UpdateDevice: Update 0:'0' (Alarm - Arming Status (Zone 1)) 2021-12-13 15:01:09.259 Alarm: (Alarm) Set Arming Status to Off 2021-12-13 15:01:19.200 Alarm: (Alarm) Found Tripped Sensor (idx = 219) in zone 0 2021-12-13 15:01:19.200 Alarm: (Alarm) Report Triggered Device 2021-12-13 15:01:19.259 Alarm: (Alarm) UpdateDevice: Update 1:'PIR_Bewegingsmelder_reserve (idx=219)' (Alarm - Tripped Devices Zone 0) 2021-12-13 15:01:19.285 Alarm: (Alarm) UpdateDevice: Update 40:'40' (Alarm - Arming Status (Zone 0)) 2021-12-13 15:01:19.285 Alarm: (Alarm) Set Arming Status to Tripped 2021-12-13 15:01:19.298 Alarm: (Alarm) Total tripped sensors for zone 0 = 1 2021-12-13 15:01:19.323 Alarm: (Alarm) UpdateDevice: Update 50:'50' (Alarm - Arming Status (Zone 0)) 2021-12-13 15:01:19.323 Alarm: (Alarm) Set Arming Status to Alert 2021-12-13 15:01:19.347 Alarm: (Alarm) UpdateDevice: Update 1:'On' (Alarm - SIREN) 2021-12-13 15:01:19.347 Alarm: (Alarm) Turn ON Siren 2021-12-13 15:01:34.206 Alarm: (Alarm) UpdateDevice: Update 30:'30' (Alarm - Arming Status (Zone 0)) 2021-12-13 15:01:34.206 Alarm: (Alarm) Set Arming Status to Normal 2021-12-13 15:01:34.238 Alarm: (Alarm) UpdateDevice: Update 0:'Off' (Alarm - SIREN) 2021-12-13 15:01:34.238 Alarm: (Alarm) Turn OFF Siren 2021-12-13 15:01:39.190 Alarm: (Alarm) UpdateDevice: Update 1:'None' (Alarm - Tripped Devices Zone 0) 2021-12-13 15:01:39.191 Alarm: (Alarm) Found Tripped Sensor (idx = 219) in zone 0 2021-12-13 15:01:39.191 Alarm: (Alarm) Report Triggered Device 2021-12-13 15:01:39.252 Alarm: (Alarm) UpdateDevice: Update 1:'PIR_Bewegingsmelder_reserve (idx=219)' (Alarm - Tripped Devices Zone 0) 2021-12-13 15:01:39.277 Alarm: (Alarm) UpdateDevice: Update 40:'40' (Alarm - Arming Status (Zone 0)) 2021-12-13 15:01:39.277 Alarm: (Alarm) Set Arming Status to Tripped 2021-12-13 15:01:39.288 Alarm: (Alarm) Total tripped sensors for zone 0 = 1 2021-12-13 15:01:39.315 Alarm: (Alarm) UpdateDevice: Update 50:'50' (Alarm - Arming Status (Zone 0)) 2021-12-13 15:01:39.315 Alarm: (Alarm) Set Arming Status to Alert 2021-12-13 15:01:39.339 Alarm: (Alarm) UpdateDevice: Update 30:'30' (Alarm - Arming Status (Zone 1)) 2021-12-13 15:01:39.339 Alarm: (Alarm) Set Arming Status to Normal 2021-12-13 15:01:39.373 Alarm: (Alarm) UpdateDevice: Update 0:'0' (Alarm - Arming Status (Zone 1)) 2021-12-13 15:01:39.373 Alarm: (Alarm) Set Arming Status to Off 2021-12-13 15:01:39.408 Alarm: (Alarm) UpdateDevice: Update 1:'On' (Alarm - SIREN) 2021-12-13 15:01:39.408 Alarm: (Alarm) Turn ON Siren
If you create a dummy switch and put it in the dzVents script in the devices part of the script then you can test if the script is triggered when the dummy switch is triggered.
Did you enable the script?
I want to send a notification via Telegram when an alarm occurs, or when i have open sections. It is not clear to me how i could manage this, maybe someone can tell how to activate this.