rvdbreemen / OTGW-firmware

A ESP8266 devkit firmware for the Nodoshop version of the Opentherm Gateway (OTGW)
MIT License
152 stars 34 forks source link

Exception raised when updating state of sensor.otgw_status_maste #246

Closed mikeg-de closed 6 months ago

mikeg-de commented 6 months ago

Hi,

I just updated HASSIO to the most recent version and noticed these exceptions

2024-05-05 08:34:36.897 ERROR (MainThread) [homeassistant.components.mqtt.models] Exception raised when updating state of sensor.otgw_status_master, topic: 'OTGW/value/otgw-485519150FBB/status_master' with payload: b'CD---W--'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 658, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'CD---W--'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 661, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'CD---W--'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 378, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 665, in state
    raise ValueError(
ValueError: Sensor sensor.otgw_status_master has device class 'None', state class 'None' unit '' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'CD---W--' (<class 'str'>)
2024-05-05 08:34:42.795 ERROR (MainThread) [homeassistant.components.mqtt.models] Exception raised when updating state of sensor.otgw_status_slave, topic: 'OTGW/value/otgw-485519150FBB/status_slave' with payload: b'-C-F----'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 658, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '-C-F----'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 661, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: '-C-F----'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 378, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 665, in state
    raise ValueError(
ValueError: Sensor sensor.otgw_status_slave has device class 'None', state class 'None' unit '' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '-C-F----' (<class 'str'>)
2024-05-05 08:35:10.969 ERROR (MainThread) [homeassistant.components.analytics] Timeout sending analytics to https://analytics-api.home-assistant.io/v1
2024-05-05 08:44:18.705 ERROR (MainThread) [homeassistant.components.mqtt.models] Exception raised when updating state of sensor.otgw_status_slave, topic: 'OTGW/value/otgw-485519150FBB/status_slave' with payload: b'-C------'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 658, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '-C------'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 661, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: '-C------'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 378, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 665, in state
    raise ValueError(
ValueError: Sensor sensor.otgw_status_slave has device class 'None', state class 'None' unit '' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '-C------' (<class 'str'>)
2024-05-05 08:44:29.888 ERROR (MainThread) [homeassistant.components.mqtt.models] Exception raised when updating state of sensor.otgw_status_master, topic: 'OTGW/value/otgw-485519150FBB/status_master' with payload: b'-D---W--'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 658, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '-D---W--'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 661, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: '-D---W--'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 378, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 665, in state
    raise ValueError(
ValueError: Sensor sensor.otgw_status_master has device class 'None', state class 'None' unit '' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '-D---W--' (<class 'str'>)
2024-05-05 08:44:35.754 ERROR (MainThread) [homeassistant.components.mqtt.models] Exception raised when updating state of sensor.otgw_status_slave, topic: 'OTGW/value/otgw-485519150FBB/status_slave' with payload: b'--------'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 658, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '--------'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 661, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: '--------'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 378, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 665, in state
    raise ValueError(
ValueError: Sensor sensor.otgw_status_slave has device class 'None', state class 'None' unit '' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '--------' (<class 'str'>)

Here is my OTGW Debug data:

DeveloperRobert van den Breemen
Firmware Version0.10.3+e334c42
PIC Availabletrue
PIC Firmware Version6.1
PIC Device IDpic16f1847
PIC Firmware Typegateway
Compiled on (date/time)Apr 17 2024 05:03:34
HostNameNestTherm
IP address192.168.1.131
MAC address48:55:19:15:0F:BB
Free Heap Mem (bytes)14032
Max. Free Mem (bytes)12432
Unique Chip ID150fbb
Arduino Core Version2_7_4
Espressif SDK Version2.2.2-dev(38a443e)
CPU speed (MHz)160
Sketch Size (bytes)597840
Sketch Free (bytes)1499136
Flash ID0016405E
Flash Chip Size (MB)4
Real Flash Chip (MB)4
LittleFSsize1
Flash Chip Speed (MHz)40
Flash ModeDIO
Wifi Network (SSID)unsernest
Wifi RX Power (dBm)-55
Wifi Quality (%)96
Wifi QualityAmazing
NTP Enabletrue
NTP TimezoneEurope/Amsterdam
Uptime Since Boot9(d)-09:28(H:m)
Last Reset ReasonSoftware/System restart
Nr. Reboots2
MQTT Connectedtrue
Thermostat Connectedtrue
Boiler Connectedtrue
Gateway/Standalonefalse
HA Integrationtrue
rvdbreemen commented 6 months ago

hi @mikeg-de

Did you update the file system when you updated to 0.10.3? This contains a new mqttha.cfg file that should fix the issue you posted here. You can find out by checking your mqttha.cfg in the file explorer, just download it and then look for "status_slave".

When you see this: image

Then you are using the old v0.10.2 filesystem, and you do need to update your filesystem to v0.10.3

The same lines look like this now in the 0.10.3 (and up) configuration file: image

rvdbreemen commented 6 months ago

@mikeg-de I will close this issue, you can reopen it if this not solved the issue in your case.

mikeg-de commented 6 months ago

I thought I updated littlefs but maybe the upload of the mqttha.cfg cuased the issue. I just updated littlefs again an manually restored the settings. I will check the HA logs the coming week. If the issue persists, I will reopen the ticket. Thanks for your feedback @rvdbreemen 👍

rvdbreemen commented 6 months ago

Let me know either way please, so I can be at peace that this issue is fixed for you ;-)

mikeg-de commented 6 months ago

You can be in peace. I restarted everything and checked the logs. No trace of the issue.

rvdbreemen commented 6 months ago

Phew, thanks for that report. Lets hope its stable for you from now on.