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

Cannot import name 'STATE_CLASS_MEASUREMENT' from 'homeassistant.components.sensor' #258

Closed
4 tasks done
32u-nd opened this issue Jan 4, 2025 · 5 comments
Closed
4 tasks done
Labels
bug Something isn't working. duplicate This issue or pull request already exists.

Comments

@32u-nd
Copy link

32u-nd commented Jan 4, 2025

System Health details

System Information

version core-2025.1.0
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.13.1
os_name Linux
os_version 6.6.62-haos-raspi
arch aarch64
timezone Europe/Berlin
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
HACS Data ok
GitHub API Calls Remaining 4994
Installed Version 2.0.1
Stage running
Available Repositories 1493
Downloaded Repositories 11
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 14.1
update_channel stable
supervisor_version supervisor-2024.12.3
agent_version 1.6.0
docker_version 27.2.0
disk_total 116.7 GB
disk_used 19.2 GB
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Mosquitto broker (6.4.1), Advanced SSH & Web Terminal (19.0.0), File editor (5.8.0), ESPHome Device Builder (2024.12.2), Samba share (12.3.2), Node-RED (18.1.1)
Dashboards
dashboards 4
resources 1
views 2
mode storage
Recorder
oldest_recorder_run 24. Dezember 2024 um 07:50
current_recorder_run 4. Januar 2025 um 09:37
estimated_db_size 820.88 MiB
database_engine sqlite
database_version 3.47.1

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of any previous issues..

Describe the issue

After upgrade to 2025.1.0, all my 4 average sensors are broken.

Reproduction steps

existing sensors are just broken.

Debug logs

Logger: homeassistant.config
Quelle: config.py:1055
Erstmals aufgetreten: 10:55:49 (4 Vorkommnisse)
Zuletzt protokolliert: 10:55:49

Platform error: sensor - cannot import name 'STATE_CLASS_MEASUREMENT' from 'homeassistant.components.sensor' (/usr/src/homeassistant/homeassistant/components/sensor/__init__.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 1055, in _async_load_and_validate_platform_integration
    platform = await p_integration.integration.async_get_platform(domain)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1108, in async_get_platform
    platforms = await self.async_get_platforms((platform_name,))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1203, in async_get_platforms
    platforms[platform_name] = await future
                               ^^^^^^^^^^^^
ImportError: cannot import name 'STATE_CLASS_MEASUREMENT' from 'homeassistant.components.sensor' (/usr/src/homeassistant/homeassistant/components/sensor/__init__.py)

Diagnostics dump

No response

@32u-nd 32u-nd added the bug Something isn't working. label Jan 4, 2025
@32u-nd
Copy link
Author

32u-nd commented Jan 4, 2025

example:

# sensor.yaml
- platform: average
  name: "PV MPP-Leistung (10 min)"
  unique_id: pv_mpp_leistung_10_min
  duration: 00:10:00
  entities:
    - sensor.pv_mpp_leistung

@MiNi33
Copy link

MiNi33 commented Jan 4, 2025

I have this too.

@machintrucbidule
Copy link

Same too

@Limych Limych added the duplicate This issue or pull request already exists. label Jan 4, 2025
@Limych
Copy link
Owner

Limych commented Jan 4, 2025

This bug has been fixed about 1 year ago. #214, #226
Why you not updated component to the latest version before open this issue?..

@Limych Limych closed this as completed Jan 4, 2025
@32u-nd
Copy link
Author

32u-nd commented Jan 5, 2025

I was staring 10 minutes on my screen until I realized that my version was < 2.4. HACS didn't show the available upgrade. Reinstalled v2.4.0 and all is fine now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. duplicate This issue or pull request already exists.
Projects
None yet
Development

No branches or pull requests

4 participants