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

Errors in sensor values continue to occur with continuous monitoring off. #16

Closed
limitless00net opened this issue May 4, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@limitless00net
Copy link

Errors in sensor values continue to occur with continuous monitoring off. Please indicate the last value or 0 value, not the off value.

Logger: homeassistant
Source: components/sensor/init.py:583
First occurred: 09:44:55 (41 occurrences)
Last logged: 09:52:55

Error doing job: Exception in callback Entity.async_write_ha_state()
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 579, in state
numerical_value = int(value)
ValueError: invalid literal for int() with base 10: 'off'

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

Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 583, in state
raise ValueError(
ValueError: Sensor sensor.seonpunggi_temperature 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-numeric value: off (<class 'str'>)

@dotvezz dotvezz self-assigned this May 4, 2023
@dotvezz dotvezz added the bug Something isn't working label May 4, 2023
@dotvezz dotvezz moved this to In Progress in Sensor Values Overhaul May 4, 2023
@dotvezz
Copy link
Member

dotvezz commented May 4, 2023

Thanks for the report! This ties right into some work I'm already doing for #4 and can be worked on together.

@dotvezz
Copy link
Member

dotvezz commented May 5, 2023

v0.19.0 has been released. It includes one small change to libdyson which will hopefully address your issue.

Unfortunately, I wasn't able to replicate the exact behavior from your logs. Disabling continuous monitoring on my 527K didn't have the same result. So if you continue to see this issue after updating, could you also let me know what model you're using?

@limitless00net
Copy link
Author

@dotvezz After 0.19.0 update, this issue is the same. The model number is Dyson Pure Cool TP04. The device number(?) is 438 on HA device information. The error doesn't occur only when I disable all sensors.

@mundschenk-at
Copy link

mundschenk-at commented May 6, 2023

According to a comment by Baloob, the problem is that for normally numeric states, unknown and unavailable should not be used. Instead, the None should be assigned as the native value. This is very likely related to home-assistant/core#87013.

I think this would be the blueprint to fix the issue: https://github.com/home-assistant/core/pull/92241/files

@limitless00net
Copy link
Author

After 0.19.1 update, this issue is the same. Please see the debug logs.

home-assistant_dyson_local_2023-05-08T01-10-01.504Z.log

Logger: homeassistant
Source: components/sensor/init.py:583
First occurred: 10:02:33 (187 occurrences)
Last logged: 10:11:33

Error doing job: Task exception was never retrieved
Error doing job: Exception in callback Entity.async_write_ha_state()
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 579, in state
numerical_value = int(value)
ValueError: invalid literal for int() with base 10: 'off'

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

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 204, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 349, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 146, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 406, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 583, in state
raise ValueError(
ValueError: Sensor sensor.seonpunggi_humidity has device class humidity, state class measurement unit % and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: off (<class 'str'>)

@haaino
Copy link

haaino commented May 9, 2023

I think the issues are similar, but not the same :-) The first one reported is the "state class measurement unit °C" and this one is "state class measurement unit %". Hope this helps?

@dotvezz
Copy link
Member

dotvezz commented Jul 3, 2023

v0.21.0 is released which should resolve this issue! Let me know if you have issues @limitless00net!

@github-project-automation github-project-automation bot moved this from In Progress to Done in Sensor Values Overhaul Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

4 participants