Restarting Integration results in Failure State
Rinnai Touch Integration Version 0.13.0 HAOS Core 2025.10.2 Supervisor 2025.10.0 OS 16.2
This issue seems to have started with the last release of this integration 0.13.0 I have Automations setup to reset the Wifi port to the Rinnai Touch and then Restart the Integration, this automation would only run if a 'turn on the Heating' automation did not have the Rinnai Touch in 'heating' mode after a minute. Previously the 'reset automation' was enough to kick things back into life and life was good.
Since 0.13.0 when I restart the Automation, all entities go to 'UNKNOWN' state, and the Integration shows: 'Failed setup, will retry: Cannot have two connections to the same address'
Now if I restart this Integration manually, the same results. But there is NO other connection to the Rinnai touch.. No Rinnai Apps running anywhere ! (not even installed any more). So I I disable the Rinnai touch, it is offline ! and I 'reload' the Rinnai touch integration. and get the same result.. So this has to be a false positive ? There is no way there is another connection to the module, when the Module is turned off !
Here is the trace when I run a integration 'reload'. from when the Module was working fine with HA....
2025-10-15 11:22:42.993 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Read 893 bytes from socket 2025-10-15 11:22:42.993 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Receive buffer now has 893 bytes of data to process 2025-10-15 11:22:42.993 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Received sequence number 0 2025-10-15 11:22:42.993 DEBUG (Thread-361 (poll_loop)) [pyrinnaitouch.system_status] We are in HEAT mode 2025-10-15 11:22:42.993 DEBUG (Thread-361 (poll_loop)) [pyrinnaitouch.unit_status] Unit is OFF 2025-10-15 11:22:42.994 DEBUG (Thread-361 (poll_loop)) [custom_components.rinnaitouch.climate] Ext. temp sensor entity name: sensor.indoor_temperature 2025-10-15 11:22:42.994 DEBUG (Thread-361 (poll_loop)) [custom_components.rinnaitouch.climate] Ext. temp sensor reports: 18.7 2025-10-15 11:22:42.994 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Internal temperature sensor reports: 999 2025-10-15 11:22:43.996 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Read 893 bytes from socket 2025-10-15 11:22:43.996 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Receive buffer now has 893 bytes of data to process 2025-10-15 11:22:43.996 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Received sequence number 0 2025-10-15 11:22:43.997 DEBUG (Thread-361 (poll_loop)) [pyrinnaitouch.system_status] We are in HEAT mode 2025-10-15 11:22:43.997 DEBUG (Thread-361 (poll_loop)) [pyrinnaitouch.unit_status] Unit is OFF 2025-10-15 11:22:43.997 DEBUG (Thread-361 (poll_loop)) [custom_components.rinnaitouch.climate] Ext. temp sensor entity name: sensor.indoor_temperature 2025-10-15 11:22:43.997 DEBUG (Thread-361 (poll_loop)) [custom_components.rinnaitouch.climate] Ext. temp sensor reports: 18.7 2025-10-15 11:22:43.998 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Internal temperature sensor reports: 999 2025-10-15 11:22:44.024 DEBUG (MainThread) [custom_components.rinnaitouch] Removing controller with IP: 192.168.37.195 2025-10-15 11:22:44.024 DEBUG (MainThread) [custom_components.rinnaitouch.climate] removing entity from hass 2025-10-15 11:22:44.097 DEBUG (MainThread) [pyrinnaitouch.system] Connection thread stopped 2025-10-15 11:22:44.097 DEBUG (MainThread) [pyrinnaitouch.system] Removed instance for IP: 192.168.37.195 2025-10-15 11:22:44.097 DEBUG (MainThread) [custom_components.rinnaitouch] Controller with IP: 192.168.37.195 removed 2025-10-15 11:22:44.098 DEBUG (MainThread) [custom_components.rinnaitouch] Get controller with IP: 192.168.37.195 2025-10-15 11:22:44.098 DEBUG (MainThread) [pyrinnaitouch.pollconnection] Poll connection inited 2025-10-15 11:22:44.098 DEBUG (Thread-361 (poll_loop)) [pyrinnaitouch.system] Shutting down the polling thread 2025-10-15 11:22:44.099 DEBUG (SyncWorker_5) [pyrinnaitouch.pollconnection] Starting thread 2025-10-15 11:22:44.102 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Starting event loop within thread 2025-10-15 11:22:44.102 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.CONNECTING 2025-10-15 11:22:44.104 INFO (MainThread) [custom_components.rinnaitouch.climate] Set up RinnaiTouch entity 192.168.37.195 2025-10-15 11:22:44.105 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Ext. temp sensor entity name: sensor.indoor_temperature 2025-10-15 11:22:44.105 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Ext. temp sensor reports: 18.7 2025-10-15 11:22:44.107 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Set up RinnaiTouch zone A entity 192.168.37.195 2025-10-15 11:22:44.107 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Ext temp sensor (A): sensor.0x158d00044f3ded_temperature 2025-10-15 11:22:44.107 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Ext temp sensor reports: 17.54 2025-10-15 11:22:44.126 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.CONNECTED 2025-10-15 11:22:44.355 ERROR (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket error on recv: [Errno 104] Connection reset by peer. Reconnecting 2025-10-15 11:22:44.358 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.IDLE 2025-10-15 11:22:44.358 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.CONNECTING 2025-10-15 11:22:44.455 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.REFUSED 2025-10-15 11:22:44.641 DEBUG (MainThread) [custom_components.rinnaitouch] Removing controller with IP: 192.168.37.195 2025-10-15 11:22:44.641 DEBUG (MainThread) [custom_components.rinnaitouch.climate] removing entity from hass Exception ignored in: <function RinnaiPollConnection.__del__ at 0x7f2ebb81dbc0> Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/pyrinnaitouch/pollconnection.py", line 85, in __del__ 2025-10-15 11:22:49.456 DEBUG (MainThread) [pyrinnaitouch.system] Error stopping the connection thread self.stop_thread() File "/usr/local/lib/python3.13/site-packages/pyrinnaitouch/pollconnection.py", line 89, in stop_thread 2025-10-15 11:22:49.456 DEBUG (MainThread) [pyrinnaitouch.system] Removed instance for IP: 192.168.37.195 2025-10-15 11:22:49.456 DEBUG (MainThread) [custom_components.rinnaitouch] Controller with IP: 192.168.37.195 removed 2025-10-15 11:22:49.457 DEBUG (MainThread) [custom_components.rinnaitouch] Get controller with IP: 192.168.37.195 2025-10-15 11:22:49.457 ERROR (MainThread) [pyrinnaitouch.pollconnection] Attempting duplicate connection to unit at 192.168.37.195, which the hardware will not support 2025-10-15 11:22:49.457 ERROR (MainThread) [custom_components.rinnaitouch] Get controller error: Cannot have two connections to the same address if self._socketthread is not None and self._socketthread.is_alive(): AttributeError: 'RinnaiPollConnection' object has no attribute '_socketthread' Exception ignored in: <function RinnaiPollConnection.__del__ at 0x7f2ebb81dbc0> Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/pyrinnaitouch/pollconnection.py", line 85, in __del__ self.stop_thread() File "/usr/local/lib/python3.13/site-packages/pyrinnaitouch/pollconnection.py", line 89, in stop_thread 2025-10-15 11:22:54.737 DEBUG (MainThread) [custom_components.rinnaitouch] Get controller with IP: 192.168.37.195 if self._socketthread is not None and self._socketthread.is_alive(): AttributeError: 'RinnaiPollConnection' object has no attribute '_socketthread' 2025-10-15 11:22:54.737 ERROR (MainThread) [pyrinnaitouch.pollconnection] Attempting duplicate connection to unit at 192.168.37.195, which the hardware will not support 2025-10-15 11:22:54.738 ERROR (MainThread) [custom_components.rinnaitouch] Get controller error: Cannot have two connections to the same address
The only way I can recover from the 'failed' state is to restart HA.
I have the same issue, receiving the same error message. No other instances of HA or the intergration, and no instances of the app. Has only occured since upgrading to v0.13.1
I have the same issue, receiving the same error message. No other instances of HA or the intergration, and no instances of the app. Has only occured since upgrading to v0.13.1
What version did you upgrade from? If you were on 0.13.0 before this I have no idea how that could have affected things.
Maybe a leftover from coding/debugging in pollconnection.py line 91?
self._socketthread.join(11)
0.13.2b1 has been released in an attempt to fix this issue. Please download and test it out.
Note that as a beta release HACS will not automatically suggest it to you. You need to go to the integration in HACS, click the three dots in the top right, click Redownload and use that dialog to select the beta version.
Loaded 0.13.2b1 Looking good so far! Tested restarting the integration and all worked. Thank you for your fast work!
Unfortunately the Integration 'Reload' did not work for me. The connection state landed at REFUSED. I am working remotely so cannot power cycle the Touch, but rebooting the router reset the connection and it recovered. Could it be another timing issue? 'Shutting down the polling thread' is logged after 'Socket state is now RinnaiConnectionState.CONNECTING'
[36m2025-10-18 17:32:13.389 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Read 893 bytes from socket[0m [36m2025-10-18 17:32:13.390 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Receive buffer now has 893 bytes of data to process[0m [36m2025-10-18 17:32:13.390 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Received sequence number 0[0m [36m2025-10-18 17:32:13.390 DEBUG (Thread-3 (poll_loop)) [pyrinnaitouch.system_status] We are in HEAT mode[0m [36m2025-10-18 17:32:13.390 DEBUG (Thread-3 (poll_loop)) [pyrinnaitouch.unit_status] Unit is OFF[0m [36m2025-10-18 17:32:13.390 DEBUG (Thread-3 (poll_loop)) [custom_components.rinnaitouch.climate] Ext. temp sensor entity name: sensor.rinnai_touch_common_zone_temperature_sensor[0m [36m2025-10-18 17:32:13.390 DEBUG (Thread-3 (poll_loop)) [custom_components.rinnaitouch.climate] Ext. temp sensor reports: 23.1[0m [36m2025-10-18 17:32:13.392 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Internal temperature sensor reports: 999[0m [36m2025-10-18 17:32:13.849 DEBUG (MainThread) [custom_components.rinnaitouch] Removing controller with IP: 192.168.117.18[0m [36m2025-10-18 17:32:13.849 DEBUG (MainThread) [custom_components.rinnaitouch.climate] removing entity from hass[0m [36m2025-10-18 17:32:13.894 DEBUG (MainThread) [pyrinnaitouch.pollconnection] Monitoring thread confirmed stopped[0m [36m2025-10-18 17:32:13.895 DEBUG (MainThread) [pyrinnaitouch.system] Connection thread stopped[0m [36m2025-10-18 17:32:13.895 DEBUG (MainThread) [pyrinnaitouch.system] Removed instance for IP: 192.168.117.18[0m [36m2025-10-18 17:32:13.895 DEBUG (MainThread) [custom_components.rinnaitouch] Controller with IP: 192.168.117.18 removed[0m [36m2025-10-18 17:32:13.895 DEBUG (MainThread) [custom_components.rinnaitouch] Get controller with IP: 192.168.117.18[0m [36m2025-10-18 17:32:13.895 DEBUG (MainThread) [pyrinnaitouch.pollconnection] Poll connection inited[0m [36m2025-10-18 17:32:13.896 DEBUG (SyncWorker_0) [pyrinnaitouch.pollconnection] Starting connection thread[0m [36m2025-10-18 17:32:13.897 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Starting event loop within thread[0m [36m2025-10-18 17:32:13.897 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.CONNECTING[0m [36m2025-10-18 17:32:13.900 DEBUG (Thread-3 (poll_loop)) [pyrinnaitouch.system] Shutting down the polling thread[0m [32m2025-10-18 17:32:13.901 INFO (MainThread) [custom_components.rinnaitouch.climate] Set up RinnaiTouch entity 192.168.117.18[0m [36m2025-10-18 17:32:13.901 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Ext. temp sensor entity name: sensor.rinnai_touch_common_zone_temperature_sensor[0m [36m2025-10-18 17:32:13.902 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Set up RinnaiTouch zone U entity 192.168.117.18[0m [36m2025-10-18 17:32:13.902 DEBUG (MainThread) [custom_components.rinnaitouch.climate] Ext temp sensor (U): None[0m [36m2025-10-18 17:32:13.942 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.CONNECTED[0m [31m2025-10-18 17:32:14.197 ERROR (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket error on recv: [Errno 104] Connection reset by peer. Reconnecting[0m [36m2025-10-18 17:32:14.199 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.IDLE[0m [36m2025-10-18 17:32:14.200 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.CONNECTING[0m [36m2025-10-18 17:32:14.250 DEBUG (RinnaiPollConnection) [pyrinnaitouch.pollconnection] Socket state is now RinnaiConnectionState.REFUSED[0m
The polling thread is different to the connection thread, so that's not necessarily a problem.
Connection Refused is a pretty common occurance with these controllers I think; in fact that's what led me to write pollconnection in the first place. I use the socket state entity as a trigger for a smart switch to reset the unit. I believe if you leave it long enough if will eventually allow you to connect but I use the switch to shorten that time. My automation is set to reset the unit if it stays in teh REFUSED state for 3 minutes.
Nonetheless if you're sure this used to work well before I can look a bit more into making the the socket is closing cleanly, but beyond that I don't think there's much I can do to help.
Unfortunately today mine isnt working at all, No matter what I do, power cycle the touch, reboot HA, the integration cycles between TIMEOUT and REFUSED, very briefly it went to CONNECTED after a reboot, but soon went to REFUSED, I havnt managed to get it to work all day, But havnt had a chance to get logs.
Spent a long time on this today but didn't get far. After "Reload": The socket.shutdown was catching an exception, which I think is due to the Touch responding to the FIN message with a RST. This leaves it in the refusing condition.
So I commented out any socket.shutdown, and added the option for socket.close to send a RST
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0)) # force RST
This sent a RST to the Touch, but the Touch responded with an ACK and stuff went wrong from there.
Contrasting this to the messaging when all is working and HA is restarted, HA sends a RST but the Touch does not respond with an ACK. It then starts sending the UDP and accepts the next connection request.
So, it 'should' be possible to get the integration reload message to look like a HA restart???
I believe this is another timing problem. After a HA restart it takes the touch 0.5-1.0 seconds to start sending the UDP. After a Reload the integration sends an RST (previous post) and immediately tries to re-establish the connection. The Touch responds to the new connection with it's own RST and the port is left in a refusing state.
Inserting a delay before trying to re-establish the connection make the Reload successful.
Apologies for the lack of formatting.
stop_thread
if self._socket is not None:
# Do our best to tidy up the socket.
#try:
# self._socket.shutdown(socket.SHUT_RDWR)
#except OSError:
# _LOGGER.debug("Socket shutdown failed, likely was not connected")
try:
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0)) # force RST self._socket.close()
except OSError:
_LOGGER.debug("Socket close failed, likely was not open")
_create_socket_and_connect
time.sleep(1)
self._update_socket_state(RinnaiConnectionState.CONNECTING) # If an old socket exists, try and clean it up.
if self._socket is not None:
try:
#self._socket.shutdown(socket.SHUT_RDWR) self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0)) # force RST self._socket.close()
except Exception: # pylint: disable=broad-exception-caught # noqa: BLE001 # It's not worth reporting anything here as we already knew the socket # was a bit broken.
#***
#pass
_LOGGER.debug("Old socket cleanup exception")