-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Feature Request: Add state_class to power sensors for long-term statistics support
Describe the feature you'd like
Add state_class: measurement (or appropriate value) to power sensors like ge_inverter_*_battery_power so Home Assistant generates long-term statistics and they work in Statistics Graph cards and the Energy dashboard.
Why is this feature needed?
- Currently these sensors have
device_class: powerandunit_of_measurement: Wbut lackstate_class, so HA shows history data but "No statistics found" in graphs. - Users must create workaround template sensors to get stats working, which adds complexity for something as common as power monitoring.
- Energy dashboard integration is broken without this (instantaneous power sensors need
state_class: measurementper HA docs).
Example affected entity
sensor.ge_inverter_[SERIAL]_battery_power
Attributes:
unit_of_measurement: W
device_class: power
icon: mdi:battery-charging-wireless-60
friendly_name: GE Inverter [SERIAL] Battery Power
Missing: state_class
Suggested implementation
In custom_components/ge_cloud/sensor.py (or wherever these entities are defined), add to the sensor platform description:
SENSOR_SCHEMA = sensor.SensorEntityDescription(
# ... existing keys ...
state_class=sensor.StateClass.MEASUREMENT,
)Additional context
- HA docs: https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics
- Similar fixes in other integrations enable native stats without templates.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels