home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.17k stars 29.85k forks source link

AirNow - "The unit of sensor.airnow_aqi (None) cannot be converted to the unit of previously compiled statistics (aqi)" #96625

Closed ziptbm closed 10 months ago

ziptbm commented 1 year ago

The problem

I'm seeing this error with each reboot related to the AirNow AQI Sensor. Do I just need to delete all old statistic data or will this change back?

Logger: homeassistant.components.sensor.recorder
Source: components/sensor/recorder.py:405
Integration: Sensor (documentation, issues)
First occurred: 11:55:15 (1 occurrences)
Last logged: 11:55:15

The unit of sensor.airnow_aqi (None) cannot be converted to the unit of previously compiled statistics (aqi). Generation of long term statistics will be suppressed unless the unit changes back to aqi or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this

Within the Developer Stastics Menu, I get this option:

image

Selecting the first option does nothing apparently, so that's why I'm filing this here.

What version of Home Assistant Core has the issue?

2023.7.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

AirNow

Link to integration documentation on our website

https://www.home-assistant.io/integrations/airnow

Diagnostics information

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.7.2", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.4", "docker": true, "arch": "x86_64", "timezone": "America/New_York", "os_name": "Linux", "os_version": "6.1.34", "supervisor": "2023.07.1", "host_os": "Home Assistant OS 10.3", "docker_version": "23.0.6", "chassis": "embedded", "run_as_root": true }, "custom_components": { "hacs": { "version": "1.32.1", "requirements": [ "aiogithubapi>=22.10.1" ] }, "ge_home": { "version": "0.6.7", "requirements": [ "gehomesdk==0.5.10", "magicattr==0.1.6", "slixmpp==1.8.3" ] }, "zha_toolkit": { "version": "v0.9.3", "requirements": [ "pytz" ] }, "redfin": { "version": "1.1.4", "requirements": [ "redfin==0.1.1" ] }, "adaptive_lighting": { "version": "1.14.0", "requirements": [ "ulid-transform" ] }, "xiaomi_cloud_map_extractor": { "version": "v2.2.0", "requirements": [ "pillow", "pybase64", "python-miio", "requests", "pycryptodome" ] }, "awnet_local": { "version": "1.1.3", "requirements": [] }, "soma_connect": { "version": "2023.3.2b1", "requirements": [ "aiosoma==1.1.3" ] }, "mail_and_packages": { "version": "0.3.17", "requirements": [ "beautifulsoup4", "Pillow>=9.0" ] }, "webrtc": { "version": "v3.2.1", "requirements": [] }, "google_home": { "version": "1.10.0", "requirements": [ "glocaltokens==0.7.0" ] }, "powercalc": { "version": "v1.8.0", "requirements": [ "numpy>=1.21.1" ] }, "watchman": { "version": "0.5.1", "requirements": [ "prettytable==3.0.0" ] }, "average": { "version": "2.3.0", "requirements": [] }, "tesla_custom": { "version": "3.15.1", "requirements": [ "teslajsonpy==3.9.0" ] }, "jvcprojector": { "version": "2.0.0a3", "requirements": [ "jvc-projector-remote == 0.2.1" ] }, "fordpass": { "version": "0.1.46", "requirements": [] }, "mjpeg_timelapse": { "version": "2021.12.30", "requirements": [] } }, "integration_manifest": { "domain": "airnow", "name": "AirNow", "codeowners": [ "@asymworks" ], "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/airnow", "iot_class": "cloud_polling", "loggers": [ "pyairnow" ], "requirements": [ "pyairnow==1.2.1" ], "is_built_in": true }, "data": { "entry": { "entry_id": "ecd15731bb31794a576f3817eb008dfd", "version": 1, "domain": "airnow", "title": "REDACTED", "data": { "api_key": "REDACTED", "latitude": "REDACTED", "longitude": "REDACTED", "radius": 150 }, "options": {}, "pref_disable_new_entities": false, "pref_disable_polling": false, "source": "user", "unique_id": "REDACTED", "disabled_by": null }, "data": { "O3": 0.049, "PM2.5": 6.7, "HourObserved": 20, "DateObserved": "2023-07-15 ", "StateCode": "REDACTED", "ReportingArea": "REDACTED", "Latitude": "REDACTED", "Longitude": "REDACTED", "PM10": 9, "AQI": 45, "Category.Number": 1, "Category.Name": "Good", "Pollutant": "O3" } } }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.sensor.recorder
Source: components/sensor/recorder.py:405
Integration: Sensor (documentation, issues)
First occurred: 11:55:15 (1 occurrences)
Last logged: 11:55:15

The unit of sensor.airnow_aqi (None) cannot be converted to the unit of previously compiled statistics (aqi). Generation of long term statistics will be suppressed unless the unit changes back to aqi or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @asymworks, mind taking a look at this issue as it has been labeled with an integration (airnow) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `airnow` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign airnow` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


airnow documentation airnow source (message by IssueLinks)

pcmoore commented 1 year ago

FWIW, I'm seeing the exact same problem.

asymworks commented 1 year ago

The AirNow side of this is due to the change-over to use the new Device Classes in #94986. The SensorDeviceClass.AQI corresponds to a None unit of measurement, while my original code used aqi as the unit of measurement, which seems to be deprecated now.

I think using the dialog to change the historical units from aqi to ` (i.e.None`) is the right way to fix this and get statistics working again, but if that isn't working, that is probably a separate bug unrelated to the AirNow integration.

issue-triage-workflows[bot] commented 10 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.