MySensor values not presented in HA UI after a random amount of time, causing a Python error

I’m running HA 2024.12.5 on an RPi. I have a few MySensors nodes connected and after a random amout of time (many days) working as expected, some of the sensors are no longer updating in the HA UI. When this happens other sensors from the same MySensor node are still reporting values that are presented as expected in the HA UI.

I have managed to capture the log below. It looks like there is something going wrong in Python when trying to decode the incoming mysensors message from the sensors. This tells me that at least my MySensors node is still transmitting the sensor values, and they are received in HA. The two sensors not updating are in node 2, child 4 and 5. These sensors are reporting temperature and humidity.

When I check the mysensors.json file, I can see the two sensors being updated as expected, so this is working as expected despite the python error.

If I do a restart of HA, without doing anything to the MySensors node, the values are updating again as expected. A few days later the same problem happens again.

This has been ongoing for quite some time, even in earlier versios of HA. I’m currently still on 2024.12.5 as I had to do a rollback from one of the 2025.2.x releases as it messed up my Z-Wave network completely.

Mysensors config snippet:
MyMessage HumMsg(CHILD_ID_HUM, V_HUM);
MyMessage TempMsg(CHILD_ID_TEMP, V_TEMP);

present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_TEMP, S_TEMP);

Log from when the sensor values are received i HA, but causing a python error:

2025-02-27 19:32:45.661 DEBUG (MainThread) [mysensors.transport] Receiving 2;5;1;0;0;20.9
2025-02-27 19:32:45.671 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 2 child 5
2025-02-27 19:32:45.678 DEBUG (MainThread) [mysensors.transport] Receiving 2;4;1;0;1;43.2
2025-02-27 19:32:45.683 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 2 child 4
2025-02-27 19:32:45.693 DEBUG (MainThread) [mysensors.transport] Receiving 2;1;1;0;17;1865
2025-02-27 19:32:45.697 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 2 child 1
2025-02-27 19:32:45.704 DEBUG (MainThread) [mysensors.transport] Receiving 2;3;1;0;24;205143770
2025-02-27 19:32:45.719 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 2 child 3
2025-02-27 19:32:45.726 DEBUG (MainThread) [mysensors.transport] Receiving 2;2;1;0;18;205143.8
2025-02-27 19:32:45.729 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 2 child 2
2025-02-27 19:32:45.787 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback Debouncer._on_debounce() (None)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1620, in __repr__
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1029, in _stringify_state
ValueError: Sensor sensor.s1_pannrum_2_5 has device class 'temperature', state class 'measurement' unit '°C' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-finite value: 'nan'
2025-02-27 19:32:45.804 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback Debouncer._on_debounce() (None)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1620, in __repr__
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1029, in _stringify_state
ValueError: Sensor sensor.s1_pannrum_2_4 has device class 'humidity', state class 'measurement' unit '%' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-finite value: 'nan'

Any suggestion on what to do? Is this a known issue?

It isn’t a Python error, it is saying that this was the Python instruction where the error occurred. What is “MySensor”?

Hi @stevemann

MySensors is one of the HA integrations.

Any suggestions on how to troubleshoot this further?