OpenTherm Gateway connection unstable

Since version 2022.7.0 my OTGW integration connected to Nodoshop MCU/Serialserver is unstable.
Sensors are constantly flipping from available to unavailable.

Anyone experiencing the same?

Log details:
Logger: homeassistant
Source: util/async_.py:141
First occurred: 18:55:22 (1646 occurrences)
Last logged: 20:19:25

Error doing job: Exception in callback SerialTransport._call_connection_lost(SerialExcepti…disconnected’))
Error doing job: Exception in callback SerialTransport._call_connection_lost(None)
Traceback (most recent call last):
File “/usr/local/lib/python3.10/asyncio/events.py”, line 80, in _run
self._context.run(self._callback, *self._args)
File “/usr/local/lib/python3.10/site-packages/serial_asyncio/init.py”, line 417, in call_connection_lost
self.serial.close()
File “/usr/local/lib/python3.10/site-packages/serial/urlhandler/protocol_socket.py”, line 104, in close
time.sleep(0.3)
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 180, in protected_loop_func
check_loop(func, strict=strict)
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 141, in check_loop
raise RuntimeError(
RuntimeError: Detected blocking call to sleep inside the event loop. Use await hass.async_add_executor_job(); This is causing stability issues. Please report issue

There were more people having issues in 2022.7.x. See github. However, it looks like it’s resolved in 2022.8.0

Maybe it’s worth trying to update to 2022.8.0 and see if it resolved this issue as well?

2022.8.0 didnt fix it for me least

I had the same problem after adding openthermgateway integration (2022.8.4)

A reboot of my otgw solved it, no more errors in the log

But now the error is back. I had disabled the integration because it was a test and domoticz was still my homesystem.

But now HA is my homesystem and the connection tot my OTGW is very unstable.

Errors are the same.

Any ideas?

Edit: https://github.com/home-assistant/core/issues/67430

Same issue here. It keeps disconnecting and connecting. Latest Home Assistant. Latest firmware for the opentherm gw (I did not update the Node MCU). The github issue suggests it is something with pyserial-asyncio. I guess we have to wait until that is fixed :frowning:

Solution/workaround:

If you have an opentherm gateway with NodeMCU and you were using the serial connection over a socket and having this problem:

A workaround is to not use this integration at all and flash your NodeMCU with the firmware from here:

And configure MQTT communication. Home Assistant will discover the entities and everything will work as before (at least for me it did), including the ‘set’ commands.

Thanks! I’ll give it a try soon!

1 Like

I have flashed the MCU with the firmware suggested, it works like a charm!

2 Likes

Ah good to know I’m not the only one with this issue. Information from the OTGW is constantly shown/unavaiable/shown/unavailable every two seconds or so. Switched it off until I could find a cause.

Currently running Home Assistant 2022.12.8 and OTGW ESP_Easy_mega_20211105_normal_ESP8266_4M1M, so no NodeMCU.

The only thing that’s changed is HA from docker to VM twee weeks ago… both were kept updated. Obviously something broke along the way. Will try to find a solution as well.

I also had the unavailable/shown problem. After flashing the above firmware all values are visible in HA via MQTT. The only problem left with MQTT is setting the setpoint. From HA I publish “otgw/value//TrSet” (21.00) to the OTGW:

service: mqtt.publish
data:
  topic: otgw/value//TrSet
  retain: true
  payload: "{{ states('input_select.thermostaat_setpoint') }}"

In the broker I briefly see the new value 21.00 at the subscribed topic but directly after that the TrSet returns to the original value (20.00) and the heater did nothing.

What am I doing wrong or what do I forget?

Turns out I’m an idiot. The old HA instance was still running in the background. OTGW cannot handle two direct connections, so the two instances were interfering with each other. Disabled the old docker, seems to be fine again. sigh

Newer firmware worked for me too.