sure, this is the script:
Code: Select all
return {
on = {
devices = {
'PIR*',
'beweging brug',
'Deur*',
'roldeur'
}
},
execute = function(dz, device)
local brug = dz.devices("beweging brug")
local security = dz.devices("Domoticz Security Panel").state
local announce = dz.variables("Announce")
if security == "Arm Away" then
dz.notify("ALARM!", "sensor" .. device.name .. "heeft beweging gedetecteerd!", dz.PRIORITY_EMERGENCY,dz.SOUND_DEFAULT, "" , dz.NSS_GOOGLE_CLOUD_MESSAGING)
announce.set("Er is beweging gedetecteerd door ".. device.name .."")
elseif security == "Arm Home" then
if brug.lastUpdate.secondsAgo < 5 then
dz.notify("ALARM!", "sensor" .. device.name .. "heeft beweging gedetecteerd!", dz.PRIORITY_EMERGENCY,dz.SOUND_DEFAULT, "" , dz.NSS_GOOGLE_CLOUD_MESSAGING)
end
end
end
}
and this is my log output:
Code: Select all
2019-10-19 17:43:53.874 Status: dzVents: Info: Handling events for: "PIR schuurzolder", value: "On"
2019-10-19 17:43:53.874 Status: dzVents: Info: ------ Start internal script: Alarm away dzvents: Device: "PIR schuurzolder (Dummy/virtual)", Index: 799
2019-10-19 17:43:53.881 Status: dzVents: Info: ------ Finished Alarm away dzvents