Hi. I have a fire panel and want to read the state of each sensor by RS232. I´m new at LUA but made some things like this:
-- Include library before calling serial functions
if not port then
require('serial')
-- Setting port parameters and open serial port
port = serial.open('/dev/RS232', {
baudrate = 19200,
databits = 8,
stopbits = 1,
parity = 'none',
duplex = 'full'
})
-- Flushes any read/unsent bytes
port:flush()
-- Read data from serial port
if port:read() == 'Powr___1'
-- Send alert when condition matched
then alert('Projector is ON')
end
-- Closing serial port
port:close()
end
¿How do I enter this contact ID event for reading the current state of the sensor in LUA command. Attached is the contact ID events codes.
-- Read data from serial port
port:read() == 'Powr___1'
end
¿Is there a "Hello world" command to see if the communication is established between LM and Fire panel?
Thanks for your help
-- Include library before calling serial functions
if not port then
require('serial')
-- Setting port parameters and open serial port
port = serial.open('/dev/RS232', {
baudrate = 19200,
databits = 8,
stopbits = 1,
parity = 'none',
duplex = 'full'
})
-- Flushes any read/unsent bytes
port:flush()
-- Read data from serial port
if port:read() == 'Powr___1'
-- Send alert when condition matched
then alert('Projector is ON')
end
-- Closing serial port
port:close()
end
¿How do I enter this contact ID event for reading the current state of the sensor in LUA command. Attached is the contact ID events codes.
-- Read data from serial port
port:read() == 'Powr___1'
end
¿Is there a "Hello world" command to see if the communication is established between LM and Fire panel?
Thanks for your help