home-assistant/core

Device/State Class Incompatibility and Statistics

Closed this issue · 0 comments

The problem

There are a number of cases where Device Classes have restricted State Classes which do not make sense.
Largely these come down to "Storage" devices (Volume/Energy Storage) which are not allowed to be "Measurement" classes which locks them out of Mean/Max/Min statistics collection.
Not only does this not make sense semantically, as the contents of a storage can absolutely be measured directly (e.g. tank volume from measuring fluid height), but even if a volume is being calculated based on net flow, being able to keep longterm statistics on it is useful to see trends over time (e.g. charge in a solar battery fluctuating over the day, it can be nice to see min/max/mean for this over a month to get an idea of solar trends etc)

What version of Home Assistant Core has the issue?

core-2024.10.3

What was the last working version of Home Assistant Core?

N/A

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Sensor

Link to integration documentation on our website

https://developers.home-assistant.io/docs/core/entity/sensor/

Diagnostics information

No response

Example YAML snippet

templates:
  - sensor:
      - name: Tank Level
        unit_of_measurement: "L"
        device_class: volume_storage
        state_class: measurement
        state: "1"

Anything in the logs that might be useful for us?

No response

Additional information

No response