unit ° thus indicating it has a numeric value; however, it has the non-numeric value: unknown
Closed this issue · 2 comments
Environment
- Home Assistant Core release with the issue: Home Assistant 2023.3.3 Supervisor 2023.03.1 Frontend 20230309.0 - latest
- This custom component release with the issue: 2.5.1
- Last working this custom component release (if known):
- Operating environment (Home Assistant/Supervisor/Docker/venv):
Describe the bug
Configuration.yaml
weather:
- platform: gismeteo
Steps to Reproduce
Expected behavior
Debug log
Add your logs here.
Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:597
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 8:16:41 AM (1 occurrences)
Last logged: 8:16:41 AM
Sensor sensor.my_smart_home_wind_bearing has device class None, state class None and unit ° thus indicating it has a numeric value; however, it has the non-numeric value: unknown (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
**Additional context**
<!--
Add any other context about the problem here.
-->
In 2023.5 the log is FLOODED by these errors.
To remove these error messages edit custom_components/gismeteo/api.py and replace STATE_UNKNOWN by 0 in definition:
def wind_bearing(self, src=None):
"""Return the current wind bearing."""
src = src or self._current
bearing = int(src.get(ATTR_WEATHER_WIND_BEARING, 0))
return (bearing - 1) * 45 if bearing > 0 else STATE_UNKNOWN
Looks like this not a bug in this integration, but a feature of the new version of Sensor integration, which does not accept "unknown" for numeric values; the same type of error is reported in HA 2023.5 by many other integrations, including Energy, Mobile, etc.
My guess is that it happens on a regular basis with wind_bearing and does not happen with other entities of Gismeteo integration is that wind will have no direction, if there is no wind at all :) ...i.e. wind speed equals zero. All other entities of the integration are always defined.