Closed Dehumanizer77 closed 2 months ago
To further explain, the problem is that if the connection is lost just for a few seconds (like accidentally disconnecting the usb cable and connecting it back immediately), I am unable to detect this and after reconnection the integration does not work anymore, everything looks normal but it does not communicate, until the integration is restarted. Previously I had an automation which would restart the integration when this happened (i.e. the alarm section became unavailable), but now I have no way of knowing that something happened and that the integration needs to be restarted, if the disconnection is shorther than the 30 or so seconds when the jablotron_active sensor catches it.
I have checked logs and I might have an idea what is a problem (or how can it be fixed/changed)
I see this:
OSError: [Errno 30] Read-only file system: '/dev/jablotron' 2024-05-08 11:07:02.905 ERROR (ThreadPoolExecutor-110_1) [custom_components.jablotron100] Write error: [Errno 30] Read-only file system: '/dev/jablotron' Traceback (most recent call last): File "/config/custom_components/jablotron100/jablotron.py", line 1069, in _keepalive self._send_packet(self.create_packet_command(COMMAND_HEARTBEAT)) File "/config/custom_components/jablotron100/jablotron.py", line 1097, in _send_packet self._send_packet_by_stream(packet) File "/config/custom_components/jablotron100/jablotron.py", line 1100, in _send_packet_by_stream stream = self._open_write_stream() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/jablotron100/jablotron.py", line 1114, in _open_write_stream return open(self._serial_port, "wb", buffering=0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
which means the integration is trying to write to the device while it's not available (resulting in the "read-only filesystem" error, since it can't create anything in /dev of course)
Maybe it would be to sufficient to catch this exception and set the whole alarm to unavailable if this happens.
Actually, the binary_sensor.jablotron_active is my own sensor, which I was trying to mitigate this issue with, so please disregard that. But everything else is still valid.
Ive got very similar problems since HA 2024.5
Can this be fixed somehow?
The log mentioned in https://github.com/kukulich/home-assistant-jablotron100/issues/92#issuecomment-2100147908 is the only log when this happens?
I think there wasn't anything more, but I can test again tomorrow (as there were few new HA versions since I created the issue). I'll post my findings here.
Ok I have checked and that is the only error I see. Here is the full log, after this, there is the same error twice per second until the connection is reestablished. err.txt
Please try latest dev version.
I am quite busy right now, but I'll try to test it until the end of week if noone else willl.
OK I had some time to test it now, but still the same error. I have selected to install the "master" version of the integration in HACS, is that correct?
@Dehumanizer77 yes, master version should be the latest. You can check the latest commit if you have the changes in your HA.
what means “the same error”? Logs should be same, only entities should be unavailable.
Ok sorry for the confusion. I have removed the USB cable, but the entities were still unchanged and available in the last state.
@Dehumanizer77 Please try the "new" latest version again.
Works perfectly! Thanks!
Hi, I'm not sure what has changed, if it's caused by changes in HA or in the integration, but previously when a connection to the controller was lost (e.g. the usb cable was disconnected), all alarm sections immediately changed to "Unavailable". Now this does not happen anymore, I can only detect it using binary_sensor.jablotron_active, but that lags a log (like 30 seconds or so) and all other sensors look like everything is fine (alarm sections keep their previous state etc.). Is there any way how to bring back the previous behaviour?