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

Issues with "off" sensors and invalid numeric values #593

Closed
paoloantinori opened this issue Aug 27, 2023 · 4 comments
Closed

Issues with "off" sensors and invalid numeric values #593

paoloantinori opened this issue Aug 27, 2023 · 4 comments

Comments

@paoloantinori
Copy link

Describe the bug
Multiple instances of this message in the logs:

ValueError: Sensor sensor.frigorifero_fridge_temp 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: '-' (<enum 'StateOptions'>)

Expected behavior
Either not ending up in such an inconsistent state or adding some defensive logic to support and discard these values.

Screenshots

Screenshot from 2023-08-27 10-14-31

Environment details:

  • Environment (HASSIO, Raspbian, etc): hassio
  • Home Assistant version installed: 2023.8.4
  • Component version installed: 0.33.21
  • Last know working version:
  • LG device type and model with issue: 1REB1GLPX1___
  • LG devices connected (list):
2023-08-27 10:15:09.311 INFO (MainThread) [custom_components.smartthinq_sensors] Initializing ThinQ platform with region: IT - language: it-IT
2023-08-27 10:15:16.311 INFO (MainThread) [custom_components.smartthinq_sensors] LGE Device added. Name: Frigorifero - Type: REFRIGERATOR - Model: 1REB1GLPX1___ - ID: e256c140-...
2023-08-27 10:15:19.069 INFO (MainThread) [custom_components.smartthinq_sensors] LGE Device added. Name: Asciugatrice - Type: DRYER - Model: RC90U2_WW - ID: 2ca6ccd0-7c25-1...
2023-08-27 10:15:22.610 INFO (MainThread) [custom_components.smartthinq_sensors] LGE Device added. Name: Lavatrice - Type: WASHER - Model: WTWN3 - ID: d9bf16c0-...
2023-08-27 10:15:22.610 INFO (MainThread) [custom_components.smartthinq_sensors] Founds 3 LGE device(s)

Output of HA logs

2023-08-27 10:15:03.038 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 591, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: <StateOptions.NONE: '-'>

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 229, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 374, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 431, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 746, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 808, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 752, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 595, in state
    raise ValueError(
ValueError: Sensor sensor.frigorifero_fridge_temp 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: '-' (<enum 'StateOptions'>)

Additional context
The issue normally goes away if I force a reload of the integration from HA.
I've noticed from the screenshot that the appliance reports as being off despite I can confirm that from an hw point it is on and connected to wifi.

@ollo69
Copy link
Owner

ollo69 commented Aug 27, 2023

Please try if last release fix the issue.

@jazzyisj
Copy link

The update seems to have resolved the issue. Log errors are gone.

@ollo69
Copy link
Owner

ollo69 commented Aug 27, 2023

Fine, I close this issue.

@ollo69 ollo69 closed this as completed Aug 27, 2023
@paoloantinori
Copy link
Author

confirm it seems to have solved the issue. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants