-
Notifications
You must be signed in to change notification settings - Fork 1
/
AirWick.lua
30 lines (27 loc) · 929 Bytes
/
AirWick.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
local AirWickIdx = 149
local AirwickVol = 150
local ParadoxStatus = 123
local SvetPir = 113
local TimeToOff = 15 //time to check when was last PIR movement
return {
on = {
timer = {
'every 5 minutes'
}
},
execute = function(dz, item)
local rawData = dz.devices(ParadoxStatus).rawData
local ParadoxValue = dz.devices(ParadoxStatus).rawData[1]
local lastUpdate = dz.devices(SvetPir).lastUpdate.minutesAgo
local lastUpdateVolt = dz.devices(AirwickVol).lastUpdate.minutesAgo
if ParadoxValue == 'Disarmed' and lastUpdate < TimeToOff then
dz.devices(AirWickIdx).switchOn().checkFirst()
else
dz.devices(AirWickIdx).switchOff().checkFirst()
end
if lastUpdateVolt < 60 then
commandArray ={["SendEmail"]="Išsikrovė Airwick gaiviklis!#Išsikrovė Airwick gaiviklis!#[email protected]"}
dz.devices(AirwickVol).updateVoltage(0)
end
end
}