Skip to content

Feature Request: Add state_class to power sensors for long-term statistics support #9

@2SilverBalls

Description

@2SilverBalls

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: power and unit_of_measurement: W but lack state_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: measurement per 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions