Show sensor state from date till now

Hi,

I am looking for a way to show sensor data from a date till now. Let me explain. First of all I life in the Netherlands, we have something called “Saldering” for our solar energie production. This is based on the Contract date and done at the end of the year.

A lot has been written about it and yes HA can’t predict anything. What i want to do is see where i am standing. Which is basically easy. Export - Import for both tariffs But here is the snag… My contract starts on 7 aug. And my values are based on the entire history. which is incorrect in a way.

So here is the main question:

How can i make the values show everything from 7 aug. till now. (So just Day/Month). So when 7 aug 2024 come, it starts at 0 again.

Do I need to set it in the sensor or in the frontend and how.

# Calculate Saldering
  - platform: template
    sensors:
      saldering_hoog:
        value_template: >
          {{ '%0.1f' | format(states('sensor.p1_meter_5c2faf0b0b78_total_power_export_t2') | float - 
                              states('sensor.p1_meter_5c2faf0b0b78_total_power_import_t2') | float) }}
        unit_of_measurement: 'W'
        friendly_name: Saldering Trarief Hoog

  - platform: template
    sensors:
      saldering_laag:
        value_template: >
          {{ '%0.1f' | format(states('sensor.p1_meter_5c2faf0b0b78_total_power_export_t1') | float - 
                              states('sensor.p1_meter_5c2faf0b0b78_total_power_import_t1') | float) }}
        unit_of_measurement: 'W'
        friendly_name: Saldering Trarief Laag

HA_FrontEnd

ThanX

Wijnand

Yes, t he utility meter should be what you are looking for.

you should not use a yearly cycle for reset, because it would then reset every year at the end of the year - but you could implement an automation, which reset the utility meter on aug.7th…

I am gone try it. Guess i was thinking a step ti far.

Thanks for the push in a other direction.

I looked in to the suggested Utility Meter integration. It does partly what i am looking for. My biggest problem is the start date.

I need to see the values from 7 august on the front end.

Is there anyway to make the front end data start from date till date.
Within the Energy Dashboard I can select it every time.

GreetingX,

Wijnand