forked from ZoneMinder/zmeventnotification
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcameramotion.lua
41 lines (38 loc) · 1.2 KB
/
cameramotion.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--
-- Lua dzVents Script
-- Set Camera Motion Sensor from ZoneMinder Event with zmeventserverDomoticz
--
-- Change this to your own needs in style like:
-- "ZoneMinder Monitor Name" = { idx = "Domoticz Motion Sensor Name" }
-- You can add more Monitors or delete some Monitors as well!
motionSensorsIdx = {
Monitor1 = { idx = 1 },
Monitor2 = { idx = 2 },
Monitor3 = { idx = 3 },
Monitor4 = { idx = 4 },
Monitor5 = { idx = 5 },
Monitor6 = { idx = 6 }
}
return {
on = {
devices = {
-- Change Camera Motion Dummy name if necessary:
'Camera Motion Dummy'
}
},
logging = {
level = domoticz.LOG_DEBUG,
marker = 'CameraMotion'
},
execute = function(domoticz, item)
if(item.active) then
local sValue = item.rawData[1]
for key, value in pairs(motionSensorsIdx) do
if(key == sValue) then
domoticz.log("Motion Sensor for Camera " ..key.. " (Idx: " ..value.idx.. ") now active!", domoticz.LOG_DEBUG)
domoticz.devices(value.idx).switchOn().checkFirst().forSec(30)
end
end
end
end
}