Energy Consumption per Year

Hi,

I’m using a shelly em3 for measuring my energy consumption. It works fine also with the energy dashboard. Unfortuanetly the shelly em3 shows the 3 phases separetly and only in total. So I added a template sensor in the configuration yaml.

# Total Energy 2023
  - unique_id: Gesamtenergieverbrauch_kWh_2023
    sensor:
      - name: "Shelly3EM Total Energy 2023"
        device_class: energy
        state_class: total
        unit_of_measurement: "kWh"
        state: >
           {{ 
           states('sensor.shelly_em3_channel_a_energy', state_ts_greater_than=timestamp('2023-01-01 00:00:00'))| float(0) + 
           states('sensor.shelly_em3_channel_b_energy', state_ts_greater_than=timestamp('2023-01-01 00:00:00'))| float(0) +
           states('sensor.shelly_em3_channel_c_energy', state_ts_greater_than=timestamp('2023-01-01 00:00:00'))| float(0) 
           }}

It works perfectly until I added the snippet for the time stamp, cause I want to see the consumption of the actual yaer only. In my personal opinion everything is programmed correctly, but I got the HA information, that the sensor is not available.

Does anyone here have an idea what went wrong?

Suggesting to remove the time stuff and using a utility meter (more), e.g. daily/weekly/monthly/yearly

1 Like

Great, that works fine for me!