Help: converting well pump usage into water meter

I have a well pump with an energy sensor telling HA when is it on or off. The pump fills up a water tank every night. I know how many liters per hour the pump provides. Can anybody help me with a template to convert that info into a sensor that I can use in the Energy Dashboard as water usage? Thank you.

I understand that you need the time that the pump is on and multiply that with a figure to get to the volume of water … You could try to use history stats for that
below is for current day, i.e. fro start… it uses ‘now’ and trips off the time making it start of day

sensor:
  - platform: history_stats
    name: PumpOn
    entity_id: MYPUMPSENSOR
    state: "on"
    type: time
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"

Thanks for the suggestion. The result of that sensor comes in X.X format (i.e. 2.5). Is that hours + minutes in decimal? (2.6 = 2 hours and 30 minutes). As far as I understand, I’ll have to create another sensor based on the result of sensor.pumpon…
Thanks again.

I guess so, you would have to verify the correctness of the response of course
And then yes, for as far as I can see you cannot use templating in the state of this history_stats (but I may very well be wrong too), else you could combine this …worth further investigating ?
Else you would need a second sensor for the multiplying, but you could possibly (??) do that directly in the utility meter setup.
Just bringing views/ideas as I donot have this setup…else I would have given the full solution :slight_smile: