Open Techwolf12 opened 2 years ago
+1 for this request
+1 for this request.
I'd like to add the device_class power and state_class measurement for current consumption entities.
Just a note, I had to wrap the glob in quotes for the snippet to work in configuration.yaml.
homeassistant:
customize_glob:
"sensor.shelly_*_total_consumption":
last_reset: '1970-01-01T00:00:00+00:00'
state_class: total_increasing
device_class: energy
Here is the corresponding documentation: https://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes
device_class power is for W and kW, device_class energy is for Wh, kWh, MWh
+1 for this request.
I'd like to add the device_class power and state_class measurement for current consumption entities.
Just a note, I had to wrap the glob in quotes for the snippet to work in configuration.yaml.
homeassistant: customize_glob: "sensor.shelly_*_total_consumption": last_reset: '1970-01-01T00:00:00+00:00' state_class: total_increasing device_class: energy
Thanks for the help, for @Octofinger solution to work the indentation needs to be as per the original example though
This is , I think, a duplicate to #571 , also note, that last_reset is not needed any longer.
Is your feature request related to a problem? Please describe.
The Shelly
total_consumption
is not selectable/usable in the energy dashboard.Describe the solution you'd like
Setting the
total_consumption
state_class tototal_increasing
and thedevice_class
toenergy
(Power should be real time power, not long term usage). Also add thelast_reset
for the dashboard to properly handle it, to epoch time 0 since it doesn't need to be updated anyway.Describe alternatives you've considered
A alternative that could be used is to set this snippet in the configuration.yaml:
This sets the attributes to the proper values for the Energy dashboard to handle it. But it would be nicer if it just worked for everyone without this change.
Additional context
Home Assistant dev docs on long term statistics