How to create statistic values for "Energy" consumption page?

Hi all,

i recently added the Kostal Solar integration and now receive a lot of data, which are quite useful, eg, Energy consumption of current month, current power consumption,…

Now i thought i could use one of them for my energy calculation but i keep receiving the notification that there are no statistic values available:

I already created a code into my configuration.yaml:

#Power
customize: !include customize.yaml

and my customize.yaml

#Power
customize_glob:
sensor.scb_energy_yield_month:
    unit_of_measurement: kWh
    device_class: energy
    friendly_name: Hausverbrauch aktueller Monat
    state_class: measurement
    last_reset: '1970-01-01T00:00:00+00:00'

as i ready some of it in the forum but i still get the notification of non-existent statitics.

Can somebody please give me quick guideline on how i get my power consumption/costs ect. work via the Energy-Page?

Would be very happy.

customize: must be under homeassistant.

homeassistant:
  customize: !include customize.yaml

For an entity to be added to the energy dashboard it must have the state class:

state_class: total_increasing 

Not measurement.

Also you dont need the last_reset attribute and that should be removed.

You can read more here: https://developers.home-assistant.io/docs/core/entity/sensor/#how-to-choose-state_class-and-last_reset

Hi @tom_l , many thanks for the fast reply.

So i changed the code accordingly, but still no appearance. Also a already checked the page you recommended. Ist the path /config/customize.yaml correct for the customize-file?

Ist there any way i can check why it’s not working/showing up?

This is what you should have, take note of the indentation:

homeassistant:
  customize_glob: # you don't have any of these so you can remove this line if you like
  customize: !include customize.yaml

Then put this in that new file /config/customize.yaml

# Energy
sensor.scb_energy_yield_month:
  unit_of_measurement: kWh
  device_class: energy
  friendly_name: Hausverbrauch aktueller Monat
  state_class: total_increasing

So after i added some sensors from my Kostal-Integration, two of them actually showed up in the dropdown, which made me quite happy. Even though knowing that “total consumption from grid” is not the correct parameter, i picked it for testing. Now it seems to work. HA then appearantly created an own sensor (the last one on the very bottom):

So progress yes, perfect no. How can i alter the sources for “Energy” once i set them up initially?! (see next post as i can only add one embedde picture)

there seems to be no “Edit”-button or else. As “Energy” is also not an integration or add-on (correct me if I’m wrong), i don’t know how to change the parameters.

here the picture:

Go back to the Configuration / Dashboards / Energy settings page and you will see a pencil icon and a garbage bin next to each sensor you have added. Pencil = edit, garbage = delete.

Found it! in my GUI it’s three little dots which are barely clickable but seems to be a resolution issue, shame on me. Thanks for that. What i discovered is that if a activate sensors from my Kostal-Integration get available in the dropdown:

but the “custom made” ones are not availble. So i assume i configured the file not correct or sth. I tried it by costumzie a sensor so it will be the same setup as one of the generic ones which are available:

generic one (available in dropdown):

state_class: total_increasing
unit_of_measurement: kWh
device_class: energy
friendly_name: scb Home Consumption from Grid Total

customized one (not available in dropdown):

sensor.scb_home_consumption_from_grid_month:
    unit_of_measurement: kWh
    device_class: energy
    friendly_name: scb Home Consumption from Grid Month
    state_class: total_increasing
#    last_reset: '1970-01-01T00:00:00+00:00'

So two possible issues to be assumed:

  1. The customized sensor cannot be accessed/detected
  2. The Energy-Dashboard accepts only “total-total” values as my customized is “per month”.

Any ideas?

Did you restart after updating the customizations?

Or reload “Location & Cutomizations”?

Yes, i reloaded the whole HA application and as the generic sensors keep appearing in the dropdown the issue only affects customized sensors. Nevertheless maybe it’s even correct to have “total consumption” over “consumption of current month” and HA itself then limits the period of observation by day, month, etc., might that be right?

Because i now chose the total amounts of each and it seems to work (correct me if I’m wrong):

But still bothers me that i cannot use customized sensors as they should be set up the very same and i could image that this problem will affect me someday again