home-assistant / developers.home-assistant

Developers website for Home Assistant.

Home Page:https://developers.home-assistant.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

device_class of Long-term Statistics sensors

Strixx76 opened this issue · comments

Entities not representing a total amount seems to contain wrong information.
I have created a template sensor:

- name: "Total compensation"
  unit_of_measurement: "SEK/kWh"
  state_class: measurement
  device_class: monetary
  state: "{{ states('sensor.nordpool_kwh_se4_sek_3_10_0')|float(0) + (0.60 + 0.052) }}"

And Home Assistant for sure stores and calculates long-term statistics for thos sensor even tough it has device_class: monetary

I'm not sure if I follow...

Home Assistant for sure stores and calculates long-term statistics for thos sensor

Correct, as in the example provided, a state class is set?

quote from Entities not representing a total amount:
"and the device_class must not be either of energy, gas, or monetary"

in the above example I have set the device class to monetary...

Aah right, I guess that is an old reference 👍