Cannot add my sensors to the new Energy dashboard

I have a lot of sensors that come from MQTT for grid import and export etc.
However I cannot select any of them in the “Energy” configuration, they are not on the list and no idea why.
This is the sensor that comes from MQTT:


And the associated utility meter:

The yaml:

- platform: mqtt
  name: "Grid Import Today"
  state_topic: "home/solar/grid/today_import"
  device_class: energy
  state_class: measurement
  unit_of_measurement: "kWh"

inverter_daily_energy_import:
  source: sensor.grid_import_today
  cycle: daily
  tariffs:
    - peak

Can anyone see anything wrong?

They are missing rhe attribute last_reset, you can add the missing attribute through customization, e.g. from my system:

homeassistant:
  customize:
    sensor.energy_daily_lights:
      last_reset: "2021-07-30T00:00:00+00:00"

I can see it after adding that but it doesn’t sound right.
Surely it shouldn’t have a static reset value and it should reset daily/monthly/etc

It works fine for me, and anyway it’s probably only a matter of time until this can be added to mqtt sensors dirwctly in the config. This was suggested by some dev on discord.

Thanks for the suggestion, let’s see how it works, says it can take up to 2 hours for the dashboard to update

Added my solar sensor
image
But it’s showing some crazy value on the dashboard not sure why
image
And the consumption also doesn’t seem to work right:
image
On the energy pane:


Grid export is 0 today but it looks like it didn’t reset the value at midnight
image

I had a similar issue (I think). It has to do with the fact that your sensors reset on a daily basis. That causes some strange effects in the calculation, since the Energy dashboard uses sensors which only accumulate. I got around the issue with creating 2 utility meters and 2 sensors to convert to ‘kWh’ and use those in the dashboard.

configuration.yaml

homeassistant:
  customize_glob:
    sensor.*_power_yearly_kwh:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: measurement
    sensor.*_power_yearly:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: measurement
      
utility_meter:
  imported_power_yearly:
    source: sensor.solaredge_imported_power
    cycle: yearly 
  exported_power_yearly:
    source: sensor.solaredge_exported_power
    cycle: yearly 
  battery_power_yearly:
    source: sensor.solaredge_storage_power
    net_consumption: true
    cycle: yearly 


template:
  sensor:
    - name: "Imported Power Yearly kWh"
      unique_id: imported_power_yearly_kwh
      state_class: measurement
      device_class: energy  
      unit_of_measurement: 'kWh'
      state: "{{(states('sensor.imported_power_yearly') | float) / 1000}}"  
    - name: "Exported Power Yearly kWh"
      unique_id: exported_power_yearly_kwh
      state_class: measurement
      device_class: energy    
      unit_of_measurement: 'kWh'
      state: "{{(states('sensor.exported_power_yearly') | float) / 1000}}" 

Now every thing looks good and the values seem pretty accurate…

Yup that’s is what I have done, created new utility meters from the sensors and now it’s starting to look ok

Thank you for the code. Has anyone added the battery? I can’t get it to work.

Hmm the same trick did not work for the battery for me.
I have the new battery utility meters and they work ok but they do not show up on the dropdown lists no matter what I do.

inverter_battery_charged_today:
  source: sensor.solar_battery_charged_today_temp
  cycle: daily
  tariffs:
    - peak
inverter_battery_discharged_today:
  source: sensor.solar_battery_discharged_today_temp
  cycle: daily
  tariffs:
    - peak         

here is my solution, there are still a few deviations from the battery. Does anyone have a better solution?
My Code is This:

homeassistant:
  customize_glob:
    sensor.*_power_yearly_kwh:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: total_increasing
    sensor.*_power_yearly:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: total_increasing
      
     
utility_meter:
  imported_power_yearly:
    source: sensor.solaredge_imported_power
    cycle: yearly 
  exported_power_yearly:
    source: sensor.solaredge_exported_power
    cycle: yearly 


template:
  sensor:
    - name: "Imported Power Yearly kWh"
      unique_id: imported_power_yearly_kwh
      state_class: total_increasing
      device_class: energy  
      unit_of_measurement: 'kWh'
      state: "{{(states('sensor.imported_power_yearly') | float) / 1000}}"  
    - name: "Exported Power Yearly kWh"
      unique_id: exported_power_yearly_kwh
      state_class: total_increasing
      device_class: energy    
      unit_of_measurement: 'kWh'
      state: "{{(states('sensor.exported_power_yearly') | float) / 1000}}" 

    - name: "Solar Charge Yearly kWh"
      unique_id: solar_charge_power_yearly_kwh
      state_class: total_increasing
      device_class: energy  
      unit_of_measurement: 'kWh'
      state: >
        {% if ((states('sensor.solaredge_storage_power') | float) > 0) %}
          {{(states('sensor.solaredge_storage_power') | float)}}
        {% else %}
          0
        {% endif %}

    - name: "Solar Discharge Yearly kWh"
      unique_id: solar_discharge_power_yearly_kwh
      state_class: total_increasing
      device_class: energy  
      unit_of_measurement: 'kWh'
      state: >
        {% if ((states('sensor.solaredge_storage_power') | float) < 0) %}
          {{(states('sensor.solaredge_storage_power') | float*-1)}}
        {% else %}
          0
        {% endif %}

For the solaredge modbus integration I created a new topic. Everything working fine now and values are accurate (inlcuding battery)

Hi,
I will restart this topic as I have a weird behavior.
I have a ViCare integration that provides several entities with gas consumption like


The thing is I cannot add any of them as gas consumtion but I can add all of them as my solar production:

I even tried to create my own templates from those entities and it’s all the same. I can add any of them as solar production but none of them as gas consumption.
The only entity I can see on the list doesn’t work and had typo and was changed/removed long time ago, after it stopped working.

I’ve created 2 utility meters one called Electricity Utility Meter and one called Export
Each meter has 3 modes, Normal, Peak, Super Cheap which are controlled by an automation according to the time.

image

I can add the Electricity Utility Meter into the energy dashboard, but NOT the export meter and I cannot figure out why I’m pretty sure I created them the same.

image

The utility meter for export is MISSING from the list

image

Export (not working)
image

Import (working)

I can’t figure out why this won’t work, it should in theory. Any help would be appreciated.

So I have figured out what caused this. Turns out my HA was set to EUR so I fixed the values from the statistics screen but I’ve lost my super cheap entity in doing so.

It Looks like I accidentally lost the unit of measurement, not sure how to get this back now.

image

image

I worked out that I have to wait until the data starts flowing before the helper automatically gets the unit of measurement I think this needs to be logged as a bug