I have a similar pulse meter setup to yours and I do this to calculate the total usage over the last 24 hours:
- platform: statistics
entity_id: sensor.water_usage
name: "Water Usage Stats"
# 10s sampling, so 6*60*24 points
sampling_size: 8640
max_age:
hours: 24
- platform: template
sensors:
water_usage_total:
friendly_name: Total Usage
value_template: >-
{% if not is_state("sensor.water_usage_stats", "unavailable") %}
{{ state_attr('sensor.water_usage_stats','total') | float }}
{% else %}
0.00
{% endif %}
unit_of_measurement: "gals used last 24h"
Displaying it in Lovelace looks like this:
- type: entities
entities:
- entity: sensor.water_usage_total
icon: 'mdi:water-pump'
My ESPHome sensor is pretty simple:
sensor:
- platform: pulse_counter
pin: 12
name: "Water Usage"
update_interval: 10s
unit_of_measurement: 'gal'
filters:
# reports in pulses/min, so divide by 6 and by 64 pulses per gallon
multiply: 0.0026041667