-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathParadox_network.lua
25 lines (24 loc) · 962 Bytes
/
Paradox_network.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
local Paradox = 120
return {
on = {
devices = { Paradox }
},
execute = function(dz, device)
local ParadoxIntStatus;
local ParadoxJson;
dz.log('Device ' .. device.name .. ' was changed ' .. device.state, dz.LOG_INFO)
if device.state == 'On' then
ParadoxIntStatus = 10
ParadoxJson = '{"DomParadox_Status":"'..tostring(ParadoxIntStatus)..'"}';
os.execute('mosquitto_pub -h 192.16x.x.xx -t paradox/in -m '..ParadoxJson);
elseif device.state == 'On_stay_mode' then
ParadoxIntStatus = 50
ParadoxJson = '{"DomParadox_Status":"'..tostring(ParadoxIntStatus)..'"}';
os.execute('mosquitto_pub -h 192.16x.x.xx -t paradox/in -m '..ParadoxJson);
elseif device.state == 'Off' then
ParadoxIntStatus = 0
ParadoxJson = '{"DomParadox_Status":"'..tostring(ParadoxIntStatus)..'"}';
os.execute('mosquitto_pub -h 192.16x.x.xx -t paradox/in -m '..ParadoxJson);
end
end
}