18.11.2020, 09:11 (This post was last modified: 18.11.2020, 09:19 by Rick.)
Hi~, I am connecting another brand of RS485 air conditioner panel via LM. Each time it is triggered, this panel will send out 16 bytes of data.
It can be polished from the picture, I read 16-bit data from the 485 bus every time. But there are other panel devices on the bus. These devices transmit different amounts of data after being triggered.
As a result, some of the 16 bytes of data I received may not be commands from the air conditioner panel, so I cannot make a judgment.
For the data received by the LM, I need to input the data in (AD BD 0D 1A 06 03 05 42 20 01 28) to make a judgment. For example, the value of 20. How to extract 20 and then judge and execute the corresponding operation?
(18.11.2020, 09:11)Rick Wrote: Hi~, I am connecting another brand of RS485 air conditioner panel via LM. Each time it is triggered, this panel will send out 16 bytes of data.
It can be polished from the picture, I read 16-bit data from the 485 bus every time. But there are other panel devices on the bus. These devices transmit different amounts of data after being triggered.
As a result, some of the 16 bytes of data I received may not be commands from the air conditioner panel, so I cannot make a judgment.
For the data received by the LM, I need to input the data in (AD BD 0D 1A 06 03 05 42 20 01 28) to make a judgment. For example, the value of 20. How to extract 20 and then judge and execute the corresponding operation?
18.11.2020, 09:35 (This post was last modified: 18.11.2020, 09:37 by Rick.)
(18.11.2020, 09:27)Daniel. Wrote: The best would be to contact the AC manufacture and ask for protocol documentation.
Yes, I have obtained the protocol documentation. But because there are other devices on the 485 bus, LM will also receive data that I don’t need when reading data. I don’t know how to filter out the data I need. How can I parse or process the data I received?
(18.11.2020, 09:27)Daniel. Wrote: The best would be to contact the AC manufacture and ask for protocol documentation.
18.11.2020, 09:49 (This post was last modified: 18.11.2020, 09:58 by Rick.)
(18.11.2020, 09:41)Daniel. Wrote: Each product must have a address which is one of the byte in the string, probably the first.
YES, for example, when LM receives a string of 20 bytes of data, I only need the consecutive 16 bytes. How can I extract these 16 bytes?
(18.11.2020, 09:46)admin Wrote: Are you sure that each frame has a fixed length of 16 bytes? From your logs it seems that the length can be different.
YES,the air conditioner panel I need to receive is 16 bytes each time. But sometimes this panel will actively report more than 16 bytes of data, and I will ignore this data.
(18.11.2020, 09:49)Rick Wrote:
(18.11.2020, 09:41)Daniel. Wrote: Each product must have a address which is one of the byte in the string, probably the first.
YES, for example, when LM receives a string of 20 bytes of data, I only need the consecutive 16 bytes. How can I extract these 16 bytes?
(18.11.2020, 09:46)admin Wrote: Are you sure that each frame has a fixed length of 16 bytes? From your logs it seems that the length can be different.
YES,the air conditioner panel I need to receive is 16 bytes each time. But sometimes this panel will actively report more than 16 bytes of data, and I will ignore this data.
And I need 16 data starting with AD BD OD to make judgment logic.
(18.11.2020, 10:58)admin Wrote: Can you provide documentation on the protocol? From your logs ab bd is not in same place.
Yes, because there are data sent by other devices on the bus, the location of the data AD BD received by LM will be different each time. Documentation may not be of much use to you, because the data sent by the actual device is different from that documentation.
(18.11.2020, 11:20)admin Wrote: How often is data sent on the bus? Can there be long delays between packets?
The sending of data is uncertain, and I cannot guarantee the interval time. The other equipment is a light panel, which will send data to the bus when triggered by someone.
Try this as a resident script. Edit serial.open with correct port name and settings.
Code:
1234567891011121314151617181920212223242526
ifnotportthenrequire('serial')
port = serial.open(...)
functionread()
localbuf = {}
whiletruedolocaltimeout = #buf > 0and0.5or15localchar = port:read(1, timeout)
ifcharthenbuf[ #buf + 1 ] = char:byte()
elsereturnbufendendendendres = read()
log(res)
if #res == 16then-- process 16 bytes of dataend
Return value for read function is a table containing bytes that have been read converted to numbers. It assumes that there's at least 0.5 seconds between consecutive messages. You can edit the timeout value to suit your needs.
19.11.2020, 09:32 (This post was last modified: 19.11.2020, 09:35 by Rick.)
(19.11.2020, 07:44)admin Wrote: Try this as a resident script. Edit serial.open with correct port name and settings.
Code:
1234567891011121314151617181920212223242526
ifnotportthenrequire('serial')
port = serial.open(...)
functionread()
localbuf = {}
whiletruedolocaltimeout = #buf > 0and0.5or15localchar = port:read(1, timeout)
ifcharthenbuf[ #buf + 1 ] = char:byte()
elsereturnbufendendendendres = read()
log(res)
if #res == 16then-- process 16 bytes of dataend
Return value for read function is a table containing bytes that have been read converted to numbers. It assumes that there's at least 0.5 seconds between consecutive messages. You can edit the timeout value to suit your needs.
THANKS,I will try this.
(19.11.2020, 09:32)Rick Wrote:
(19.11.2020, 07:44)admin Wrote: Try this as a resident script. Edit serial.open with correct port name and settings.
Code:
1234567891011121314151617181920212223242526
ifnotportthenrequire('serial')
port = serial.open(...)
functionread()
localbuf = {}
whiletruedolocaltimeout = #buf > 0and0.5or15localchar = port:read(1, timeout)
ifcharthenbuf[ #buf + 1 ] = char:byte()
elsereturnbufendendendendres = read()
log(res)
if #res == 16then-- process 16 bytes of dataend
Return value for read function is a table containing bytes that have been read converted to numbers. It assumes that there's at least 0.5 seconds between consecutive messages. You can edit the timeout value to suit your needs.
THANKS,I will try this.
In addition, I found that LM sometimes cannot be accessed through Google browser, and it is normal after waiting for about 30s. When it is not accessible, the logic function inside LM cannot be realized either.
19.11.2020, 10:03 (This post was last modified: 19.11.2020, 10:17 by Rick.)
(19.11.2020, 10:03)Daniel. Wrote: In the app store there is app to monitor ruining processes on LM.
Got it!
(19.11.2020, 10:03)Rick Wrote:
(19.11.2020, 10:03)Daniel. Wrote: In the app store there is app to monitor ruining processes on LM.
Got it!
It does not seem to occupy a lot, or may occupy a lot at a certain point in time.In the total, only about 30% is occupied.The most occupied is [b]/usr/bin/eibd[/b]-e 15.15.255 -q 100 -L 1 -Q 0 -f eth0 -D -R -T -S224.0.23.12 -F n,n,n,n,0,0 tpuarts:/dev/ttymxc5.
(19.11.2020, 07:44)admin Wrote: Try this as a resident script. Edit serial.open with correct port name and settings.
Code:
1234567891011121314151617181920212223242526
ifnotportthenrequire('serial')
port = serial.open(...)
functionread()
localbuf = {}
whiletruedolocaltimeout = #buf > 0and0.5or15localchar = port:read(1, timeout)
ifcharthenbuf[ #buf + 1 ] = char:byte()
elsereturnbufendendendendres = read()
log(res)
if #res == 16then-- process 16 bytes of dataend
Return value for read function is a table containing bytes that have been read converted to numbers. It assumes that there's at least 0.5 seconds between consecutive messages. You can edit the timeout value to suit your needs.
How can I extract the 12th or 13th data separately from the 16 reads?