02.06.2023, 09:10
Hi!!
I have a group of blinds to control with RS485.
I have no problem with sending commands but I'm stuck with reading the blind status.
When the blind start to move it gives me 24bits or 26bits of strings. This data indicates the blind unit number(int), move status(bool).
When the blind stop to move it gives me 30bits or 32bits of strings. This data indicates the blind unit number(int), move status(bool), height status(%) and slut status(%).
When I read like below with resident script 0 interval, I can get all necessary data but it will take 20 seconds until get the result of log(res).
I need to reflect the blind move status to the status Group Address almost simultaneously.
When I try to read like below the process starts simultaneously but I cannnot read 30bits data properly.
How can I write this when we need to read various length data with RS485?
Thank you so much in advance!
I have a group of blinds to control with RS485.
I have no problem with sending commands but I'm stuck with reading the blind status.
When the blind start to move it gives me 24bits or 26bits of strings. This data indicates the blind unit number(int), move status(bool).
When the blind stop to move it gives me 30bits or 32bits of strings. This data indicates the blind unit number(int), move status(bool), height status(%) and slut status(%).
When I read like below with resident script 0 interval, I can get all necessary data but it will take 20 seconds until get the result of log(res).
Code:
if not port then
require('serial')
port = serial.open('/dev/RS485-1', {
baudrate = 9600,
databits = 8,
stopbits = 1,
parity = 'even',
duplex = 'half'
})
end
res, err = port:read(-1)
if res then
log(res)
end
I need to reflect the blind move status to the status Group Address almost simultaneously.
When I try to read like below the process starts simultaneously but I cannnot read 30bits data properly.
Code:
res, err = port:read(24)
How can I write this when we need to read various length data with RS485?
Thank you so much in advance!