Energy templates

Hi, I still struggling with setup the energy and water meter.

I got electricity and water sensor what are ESP with Tasmota firmware what are just the counters. The counters are zeroed when the esp is restarted.

I got tasmotas added to HA via the Tasmota integration auto-discover. So I calculate the right values via template → template.yaml

- sensor:
  - name: Today energy consumption
    unit_of_measurement: "kWh"
    device_class: energy
    state_class: total_increasing
    state: >
        {% set counter = states('sensor.tas_powermeter_counter_c1') | float(0) %}
        {{ ((counter/800)|float|round(2)) }}
        
  - name: Today water consumption home
    unit_of_measurement: "m3"
    state_class: total_increasing
    icon: mdi:water
    state: >
        {% set counter = states('sensor.tas_watermeter_counter_c2') | float(0) %}
        {{ ((counter/258000)|float|round(3)) }}
  - name: Today water consumption garden
    unit_of_measurement: "m3"
    state_class: total_increasing
    icon: mdi:water
    state: >
        {% set counter = states('sensor.tas_watermeter_counter_c1') | float(0) %}
        {{ ((counter/258000)|float|round(3)) }}

but the template does not support the last_reset_value_template. If I understand the configuration documentation right. so if the sensor is set as state_class: total_increasing I need to also set last_reset_value to DateTime when the tasmota was restarted and the counter was zeroed?

Any help? Or what is the right way to set up this energy and water meter? I’m interested in long term statistics (today, week, year) for electricity, and also for the water but the energy dashboard does not support water.
Thanks a lot

I haven’t used last rest, however if it’s an attribute on the sensor, then you just need to add it as an attribute in your attributes templates.

  attributes:
    whatever_the_attriubte_is: "{{ whatever the template should be }}"