12.03.2021, 09:01
Create an event script attached to a 1-byte unsigned object (valid scene number is from 1 to 15), change CM-19 address (default is 1) and port (default is /dev/RS485-1) if needed.
Code:
addr = 1 -- CM-19 address (default 1)
scene = event.getvalue()
if scene > 0 and scene < 16 then
value = string.format('!BR%dg%X;', addr, scene)
port = require('serial').open('/dev/RS485-1', {
baudrate = 9600,
duplex = 'half'
})
port:write(value)
port:close()
end