ERROR:rflink.protocol:disconnected due to exception
olskar opened this issue · 4 comments
I started out with this bug report in hass:
home-assistant/core#23942
I then tried what happened if I run rflink manually and it seems that the messages are kind of cut of?
This is what i get from rflink
ERROR:rflink.protocol:disconnected due to exception NoneType: None
and rflink -vv
DEBUG:asyncio:Using selector: EpollSelector DEBUG:rflink.protocol:connected ERROR:rflink.protocol:disconnected due to exception NoneType: None
Updating with more information
`
ERROR:asyncio:Exception in callback SerialTransport._read_ready()
handle: <Handle SerialTransport._read_ready()>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
self._callback(*self._args)
File "/home/olskar/.local/lib/python3.6/site-packages/serial_asyncio/init.py", line 106, in _read_ready
self._protocol.data_received(data)
File "/home/olskar/.local/lib/python3.6/site-packages/rflink/protocol.py", line 51, in data_received
data = data.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x86 in position 1: invalid start byte
`
Sorry for the late reply.
I believe this has to do with the serial buffer already being filled with partial data when python-rflink starts reading it but some data might be cut off causing it to be invalid. To my knowledge this problem also exists on the protocol level and it's solved there by ignoring errors the first time reading. Maybe we could implement this for the lower level as well.
No worries @aequitas !
Do you think this is related to home-assistant/core#23942 in home assistant?
As I write in that bug, I can "fix" it by running a rflink-python command in the underlying os, then it works fine in home assistant
Could be, but still would be strange. Let's discus further on the HA issue, I'll close this one if favour of the other one.