Code: Select all
return {
active = true,
on = {
'dt*' -- all door contacts (
},
execute = function(domoticz, detector)
local away = domoticz.devices['Holiday']
if (detector.state == 'Open' and away.state == 'On') then -- a door/window was opened while we are away
-- send notification
domoticz.notify('Security breach', '', domoticz.PRIORITY_EMERGENCY)
end
else
if (detector.state == 'Open' and away.state == 'Off') then -- a door/window was opened while we are home
-- send notification
domoticz.notify('DT ', 'But that is ok, we are home', domoticz.PRIORITY_LOW)
end
}Code: Select all
domoticz.notify('Security breach', .. dtX ..'was opened while we are not home', domoticz.PRIORITY_EMERGENCY)I think I should be able to base it on
Code: Select all
local message=""
domoticz.devices.forEach(function(device)
if (device.description ~= nil) then
_, _, threshold = string.find(device.description,"CDA:(%d+)")
if (threshold ~= nil) then
local name = device.name
local minutes = domoticz.devices[name].lastUpdate.minutesAgo
if ( minutes > tonumber(threshold)) then
message = message .. 'Device ' ..
name .. ' seems to be dead. No heartbeat for at least ' ..
minutes .. ' minutes.\r'
end
end
end
end)