mvn23 / pyotgw

A library to interface with the OpenTherm Gateway through serial or network connection.
GNU General Public License v3.0
28 stars 16 forks source link

"[pyotgw.protocol] Disconnected: None" crashes homeassistant #2

Closed wavemaking closed 5 years ago

wavemaking commented 5 years ago

pyotgw (as part of the opentherm_gw component) works partially for me. It works from the dev version of homeassistant (not from docker or the python install). I get updates from the monitored values and I can control the target temperature. But inevitable after some time homeassistant freezes with the following last messages in the log:

2019-01-10 12:20:19 DEBUG (MainThread) [pyotgw.protocol] Watchdog triggered! 2019-01-10 12:20:19 DEBUG (MainThread) [pyotgw.protocol] Canceling Watchdog task. 2019-01-10 12:20:19 DEBUG (MainThread) [pyotgw.pyotgw] Scheduling reconnect... 2019-01-10 12:20:19 DEBUG (MainThread) [pyotgw.pyotgw] Reconnecting to serial device on socket://192.168.71.103:6638 2019-01-10 12:20:19 ERROR (MainThread) [pyotgw.protocol] Disconnected: None

I note that I also have many repetition of these messages: 2019-01-11 01:33:26 WARNING (MainThread) [pyotgw.protocol] Command PR failed with SE, retrying... 2019-01-11 01:33:26 DEBUG (MainThread) [pyotgw.protocol] Got possible response for command PR: SE The component works regardles of these messages, so I am not sure if it is relevant.

maikelwever commented 5 years ago

Same problem for me: after this happens, HomeAssistant is not reachable via the WebUI anymore, and one core of the system it's on is pegged to 100% usage.

Installed versions of libraries: pyotgw==0.4b1 homeassistant==0.89.1 pyserial==3.4 pyserial-asyncio==0.4

The logs I got look the same:

Mar 11 08:34:24 hass hass[10783]: 2019-03-11 08:34:24 DEBUG (MainThread) [pyotgw.protocol] Watchdog triggered!
Mar 11 08:34:24 hass hass[10783]: 2019-03-11 08:34:24 DEBUG (MainThread) [pyotgw.protocol] Canceling Watchdog task.
Mar 11 08:34:24 hass hass[10783]: 2019-03-11 08:34:24 DEBUG (MainThread) [pyotgw.pyotgw] Scheduling reconnect...
Mar 11 08:34:24 hass hass[10783]: 2019-03-11 08:34:24 DEBUG (MainThread) [pyotgw.pyotgw] Reconnecting to serial device on socket://opentherm-gw-esp.skynet.lan:6638
Mar 11 08:34:24 hass hass[10783]: 2019-03-11 08:34:24 ERROR (MainThread) [pyotgw.protocol] Disconnected: None
maikelwever commented 5 years ago

How to reproduce this issue:

When connected, do either of these:

How to observe the bug afterwards:

maikelwever commented 5 years ago

A little debugging shows the code gets stuck here:

https://github.com/mvn23/pyotgw/blob/master/pyotgw/protocol.py#L64

andriej commented 5 years ago

Can't wait for the fix to be pushed to HA - this issue killed my HA today. :-)

mvn23 commented 5 years ago

Thanks for the report and PR, I've been rather busy the last few months but I will have a look at it this week.

mvn23 commented 5 years ago

Fixed in #5

andriej commented 5 years ago

I'm after first dropout of connection with updated (via pip install manually) pyotgw lib. It seems to work, HA is not consuming whole CPU and data seems to be updated (so the reconnection was successfull so far): image