Utility meter stats?

Hello

I’m trying to follow energy consumption.

I’m from Belgium and I have a p1 device.

So in my yaml file to start with consumption by quarter :


utility_meter:
  energy_quarter:
    source: sensor.p1_meter_energy_import
    unique_id: energy_quarter
    cycle: quarter-hourly

Then I tried template sensor :

Those works good :

template:
  - sensor:
    - name: "energy_quarter_current"
      unique_id: energy_quarter_current
      unit_of_measurement: "kWh"
      state: "{{ states('sensor.energy_quarter') | float(0) }}"
    - name: "energy_quarter_before"
      unit_of_measurement: "kWh"
      state: "{{ state_attr('sensor.energy_quarter', 'last_period') | float(0) }}"

But what if I want to set energy_quarter_before_before (so 2 quarter before)?
Because I don’t have other attibutes like this.

Thanks for your help

Why are you just copying this sensor?

Then you can’t do it.

Yes I don’t have to copy it it’s just for test for now.

So I can’t for exemple with days having statistics of consumption for 7 days?

Sure you can. Just create another utility meter with a weekly cycle.

I’m not sure I using right words (english is not my mother tong)

So I want stats for example :

  • today
  • yesterday
  • day -2
  • days - 3
  • day -4
    -day -5

and so on

Then create a daily cycle utility meter.

Yes but I only can get currently and last_periode
How can I two days before?

Wait two days.