Closed cinghialino closed 1 year ago
Same error here.
Sensor sensor.unnamed_device_2 has device class None, state class measurement and unit None thus indicating it has a numeric value; however, it has the non-numeric value: Fair (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Hello, I'm just wondering if a solution for this error will be included in the next release, thanks
Same here, flooding log, if you have some time to look at this that would be nice
Issue home-assistant/core/#92635 suggest to remove unit_of_measurement
from the entities.
That probably affects lines 79-81 in sensor.py
Current tests also fail with the same error message:
FAILED tests/test_sensor.py::test_entity_initialization - ValueError: Sensor sensor.unnamed_device has device class None, state class measurement unit None and suggested precision None thus indicating it has a numeric value; however, it has the ...
Results (0.27s):
17 passed
1 failed
- tests/test_sensor.py:26 test_entity_initialization
The problem remains with HA 2023.6.0
I think the dev got drafted..
2023.6.0
2023-06-08 12:16:05.830 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.childroom_iaq_level fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 581, in state
numerical_value = int(value)
^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'Good'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update
await self.async_update()
File "/config/custom_components/iaquk/sensor.py", line 102, in async_update
if self.state == LEVEL_EXCELLENT
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 585, in state
raise ValueError(
ValueError: Sensor sensor.childroom_iaq_level has device class 'None', state class 'measurement' unit 'None' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'Good' (<class 'str'>)
This has been fixed in #116 for HA >= v2023.5 (I just tested sucessfully against v2023.6.0).
This has been fixed in #116 for HA >= v2023.5 (I just tested sucessfully against v2023.6.0).
would it be possible to merge PR and release?
Hi, has this issue been resolved? Been holding back updating (currently still on 2023.4.6) and I just wanted to check before I do the update to 2023.6.3? Many thanks
as temp solution I copy / paste change on my custom_components folder and restart... no more warning message
Until the relevant PR (#116) is merged you can use my forked repo (containing the necessary fixes):
Remove the original integration and then add my forked one; restart afterwards.
! Do not forget to switch back to the original integration after the PR is merged !
cool thanks gents, is the only modified file sensor.py from what I can see?
Yes, only sensors.py
is affected. The fix basically is setting the state_class
attribute only for the IAQ-Index entities.
The PR additionally adjusts the tests, but that's is not relevant for the functionality of the integration.
cool, made the change and working like a charm, system now fully updated! I assume that when the component is updated and we update from HACS all the original repo source files will be restored as per this repo? Thanks all
Until the relevant PR (#116) is merged you can use my forked repo (containing the necessary fixes): Remove the original integration and then add my forked one; restart afterwards.
! Do not forget to switch back to the original integration after the PR is merged !
Thank you so much. Have swapped in the sensors.py file from your fork and all's well. Much appreciated
Environment
Describe the bug
Sensor sensor.iaquk_home_indoor_air_quality_level has device class None, state class measurement and unit None thus indicating it has a numeric value; however, it has the non-numeric value: Good (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Configuration.yaml
Steps to Reproduce update HA to 2023.02
Expected behavior not having an error in the log
Debug log
Additional context
none