bosch-thermostat / home-assistant-bosch-custom-component

HA custom component for Bosch thermostats
Apache License 2.0
234 stars 45 forks source link

AttributeError: 'BoschSensor' object has no attribute '__attr_state_class' #376

Closed The-real-Urb closed 7 months ago

The-real-Urb commented 10 months ago

Describe the bug The log is clogging up with error messages from BoschSensor

To Reproduce It occurs constantly, like every minute.

Expected behavior Everything works as expected. The error doesn't seem to have an impact on functionality.

Logs

2024-01-19 11:24:36.633 WARNING (MainThread) [custom_components.bosch] Unloading Bosch module.
2024-01-19 11:24:42.599 WARNING (MainThread) [bosch_thermostat_client.sensors.sensor] Can't update data for actualSupplyTemperature. Trying uri: /heatingCircuits/hc1/actualSupplyTemperature. Error message: Error requesting data from /heatingCircuits/hc1/actualSupplyTemperature
2024-01-19 11:24:42.600 WARNING (MainThread) [bosch_thermostat_client.sensors.sensor] Can't update data for supplyTemperatureSetpoint. Trying uri: /heatingCircuits/hc1/supplyTemperatureSetpoint. Error message: Error requesting data from /heatingCircuits/hc1/supplyTemperatureSetpoint
2024-01-19 11:24:42.630 ERROR (MainThread) [homeassistant.util.logging] Exception in async_update when dispatching 'bosch_sensor_update': ()
Traceback (most recent call last):
  File "/config/custom_components/bosch/sensor/base.py", line 120, in async_update
    self._state = None if self._attr_state_class == "measurement" else self._bosch_object.state
                          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 339, in _getter
    return getattr(o, private_attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BoschSensor' object has no attribute '__attr_state_class'

2024-01-19 11:24:42.654 ERROR (MainThread) [homeassistant.util.logging] Exception in async_update when dispatching 'bosch_sensor_update': ()
Traceback (most recent call last):
  File "/config/custom_components/bosch/sensor/base.py", line 120, in async_update
    self._state = None if self._attr_state_class == "measurement" else self._bosch_object.state
                          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 339, in _getter
    return getattr(o, private_attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BoschSensor' object has no attribute '__attr_state_class'

2024-01-19 11:24:42.677 ERROR (MainThread) [homeassistant.util.logging] Exception in async_update when dispatching 'bosch_sensor_update': ()
Traceback (most recent call last):
  File "/config/custom_components/bosch/sensor/base.py", line 120, in async_update
    self._state = None if self._attr_state_class == "measurement" else self._bosch_object.state
                          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 339, in _getter
    return getattr(o, private_attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BoschSensor' object has no attribute '__attr_state_class'
...

Version

Debug SCAN IMPORTANT link to debug log

Additional context Device: Buderus CT100

pszafer commented 7 months ago

fixed in dev version https://github.com/bosch-thermostat/home-assistant-bosch-custom-component/releases/tag/v0.25.0-dev.6

I will release stable, when I got confirmation that everything is working.

jockebq commented 6 months ago

I get the same issue on the latest stable version 25.1? It floods the logs with this error

2024-05-17 09:56:10.175 ERROR (MainThread) [homeassistant.util.logging] Exception in async_update when dispatching 'bosch_sensor_update': () Traceback (most recent call last): File "/config/custom_components/bosch/sensor/base.py", line 118, in async_update if self._attr_state_class ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'BoschSensor' object has no attribute '__attr_state_class'. Did you mean: '_attr_state_class'?