Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in async_update when dispatching 'bosch_recording_update #455

Open
PeterHolgersson opened this issue Nov 28, 2024 · 1 comment
Labels
wontfix This will not be worked on

Comments

@PeterHolgersson
Copy link

PeterHolgersson commented Nov 28, 2024

Describe the bug

When the integration tries to log the values of the recording sensors (old gathering) an exception is thrown and the sensors does not update until the integrations is reloaded even if it seems as the integration fetches the sensors every hour according to the log:
_Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 664, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: 'unavailable'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/bosch/sensor/recording.py", line 90, in async_update
await self.async_old_gather_update()
File "/config/custom_components/bosch/sensor/recording.py", line 73, in async_old_gather_update
self.attrs_write(last_reset=last_hour)
File "/config/custom_components/bosch/sensor/recording.py", line 50, in attrs_write
self.async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1267, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, 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
self.__async_calculate_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 666, in state
raise ValueError(
ValueError: Sensor sensor.reheater has device class 'energy', state class 'total' unit 'kWh' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unavailable' (<class 'str'>)

It have also happened for sensor "sensor.routputproduced"

There are also the following warnings about State Class:
2024-11-28 17:05:17.210 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.routdoor_t1 (<class 'custom_components.bosch.sensor.recording.RecordingSensor'>) is using state class 'total' which is impossible considering device class ('temperature') it is using; expected None or one of 'measurement';
2024-11-28 17:05:17.229 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ractualtemp (<class 'custom_components.bosch.sensor.recording.RecordingSensor'>) is using state class 'total' which is impossible considering device class ('temperature') it is using; expected None or one of 'measurement';

To Reproduce
Reload the integration and the exception is thrown as soon the integration handles the sensor "sensor.reheater"

  1. See error

Expected behaviour
No exception thrown.

Screenshots
If applicable, add screenshots to help explain your problem.

Version

  • HA version: 2024.11.3
  • HA Bosch component version: 0.26.3
  • Python Bosch HTTP client version: 0.26.2

** Debug SCAN **
** IMPORTANT **
Go to Developer tools in Home Assistant, choose Service tab and choose bosch.debug_scan
Download file to your computer and upload it somewhere eg. https://jsonblob.com/

Additional context
Add any other context about the problem here.

bosch_scan(1).json
home-assistant_2024-11-28.log

Copy link

stale bot commented Jan 31, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant