13.11.2019, 09:00
The following scripts integrate Paradox EVO192 security panel. Paradox PRT3 printer module is used to connect the security panel to LM5 through RS232 serial port.
Thanks our forum member rebooter for contribution!
guardZoneStatus library:
RS232 communication script:
Thanks our forum member rebooter for contribution!
guardZoneStatus library:
Code:
function guardzonefunction(zonenumber, zonestatus)
guardZones = {
[255255] = 'An empty zone has arrived',
[01] = 'The main entrance. Motion Sensor.',
[02] = 'The cabinet. Motion Sensor.',
[03] = 'The garage. Motion Sensor.',
[04] = 'The stairs. Motion Sensor.',
[05] = 'The living room. Motion Sensor.',
[06] = 'The dining room. Motion Sensor.',
[07] = 'The kitchen. Motion Sensor.',
[08] = 'Garage entrance. Motion Sensor.',
[09] = 'The main entrance. Window Break Sensor ',
[10] = 'The cabinet. Window Break Sensor ',
[11] = 'The garage. Window Break Sensor ',
[13] = 'Living room. Window Break Sensor ',
[14] = 'Dining room. Window Break Sensor ',
[15] = 'The kitchen. Window Break Sensor ',
[16] = 'The garage door. Reed switch ',
[17] = 'The main entrance. Reed switch ',
[18] = 'Dining room. Curtain',
[19] = 'Boiler room. Motion Sensor.',
[20] = 'The boiler room. Window jammer
[21] = 'Cinema hall. Motion Sensor',
[22] = 'Pantry. Motion Sensor',
[24] = 'SPA room. Motion Sensor',
[25] = 'Children's 1. Motion sensor',
[26] = 'Hall 2 floor. Motion Sensor.',
[27] = 'Children's 2. Motion sensor',
[28] = 'Master bedroom. Motion Sensor',
[30] = 'Pajar basement',
[31] = 'Fire 1st floor',
[32] = 'Fire 2nd floor',
[33] = 'Fire Sauna',
[34] = 'Fire attic',
[35] = 'Server fire',
[36] = 'Under the stairs',
[50] = 'House is armed',
[51] = 'House is disarmed',
}
-- Arming with mast
zonename = guardZones[zonenumber]
-- log ("Zone Nr triggered: "..zonenumber.." status: "..zonestatus.." "..zonename)
-- log(zonename)
-- log(zonestatus)
-- log(guardZones[zonenumber])
if zonestatus == 'closed' then
status = 1
elseif zonestatus == 'opened' then
status = 0
end
if zonenumber == 1 then
grp.update('8/0/1', status)
elseif zonenumber == 2 then
-- zonename = guardZones[zonenumber]
grp.update('8/0/2', status)
elseif zonenumber == 3 then
grp.update('8/0/3', status)
elseif zonenumber == 4 then
grp.update('8/0/4', status)
elseif zonenumber == 5 then
grp.update('8/0/5', status)
elseif zonenumber == 6 then
grp.update('8/0/6', status)
elseif zonenumber == 7 then
grp.update('8/0/7', status)
elseif zonenumber == 8 then
grp.update('8/0/8', status)
elseif zonenumber == 9 then
grp.update('8/0/9', status)
elseif zonenumber == 10 then
grp.update('8/0/10', status)
elseif zonenumber == 11 then
grp.update('8/0/11', status)
elseif zonenumber == 13 then
grp.update('8/0/13', status)
elseif zonenumber == 14 then
grp.update('8/0/14', status)
elseif zonenumber == 15 then
grp.update('8/0/15', status)
elseif zonenumber == 16 then
grp.update('8/0/16', status)
elseif zonenumber == 17 then
grp.update('8/0/17', status)
elseif zonenumber == 18 then
grp.update('8/0/18', status)
elseif zonenumber == 19 then
grp.update('8/0/19', status)
elseif zonenumber == 20 then
grp.update('8/0/20', status)
elseif zonenumber == 21 then
grp.update('8/0/21', status)
elseif zonenumber == 22 then
grp.update('8/0/22', status)
elseif zonenumber == 24 then
grp.update('8/0/24', status)
elseif zonenumber == 25 then
grp.update('8/0/25', status)
elseif zonenumber == 26 then
grp.update('8/0/26', status)
elseif zonenumber == 27 then
grp.update('8/0/27', status)
elseif zonenumber == 28 then
grp.update('8/0/28', status)
elseif zonenumber == 30 then
grp.update('8/0/30', status)
elseif zonenumber == 31 then
grp.update('8/0/31', status)
elseif zonenumber == 32 then
grp.update('8/0/32', status)
elseif zonenumber == 33 then
grp.update('8/0/33', status)
elseif zonenumber == 34 then
grp.update('8/0/34', status)
elseif zonenumber == 35 then
grp.update('8/0/35', status)
elseif zonenumber == 36 then
grp.update('8/0/36', status)
-- process the status of security panel
-- if armed then switch off lights in whole house
elseif zonenumber == 50 then
if grp.getvalue('0/5/8') == false then
-- grp.update('0/5/5', status) --lights off
grp.update('0/5/8', status) --security panel status
end
elseif zonenumber == 51 then
if grp.getvalue('0/5/8') then
grp.update('0/5/8', status) --security panel status
end
elseif zonenumber == 255255 then
log("An empty zone has arrived")
end --if zonenumber
end
RS232 communication script:
Code:
require('user.guardZoneStatus')
if not port then
require('serial')
port = serial.open('/dev/RS232', { baudrate = 9600, parity = 'none', databits = '8', stopbits = '1'})
port:flush()
line = ''
end
char = port:read(1, 1)
if char then
if char == '\r' then
line = line:trim()
--log(line)
-- mail('info@something.com', 'Installation X', line)
-- loghex(line)
zone = tonumber(string.sub(line,-2))
if zone == nil then
zone = 255255
-- log("An empty zone has arrived")
end
-- if (zone > 1) or (zone <37 ) then
if (string.match(line,'opened')) == ('opened') then
zoneStatus = 'opened'
armstatus = grp.getvalue('0/5/8') --reading current status of security system
-- log(armstatus)
if armstatus == true then
grp.update('0/5/8', false) -- write those which are not armed
end
else
zoneStatus = 'closed'
end -- string.match
-- parsing logs for setting to alarm
if (string.match(line,'Arming')) == ('Arming') then
zoneStatus = 'closed'
zone = 50
-- elseif (string.match(line,' in')) == (' in') then
-- zoneStatus = 'closed'
-- zone = 50
elseif (string.match(line,'ode entere')) == ('ode entere') then
zoneStatus = 'opened'
zone = 51
end -- string.match
guardzonefunction(zone,zoneStatus)
-- end -- test for zone nember 1 - 36
line = ''
else
line = line .. char
end -- if char '\r'
end