I can not calculate the liters of water taken from the well

I was stuck, I do not find the solution, I have a water flow meter, my need is to measure how long the pump stays on to calculate how much water has entered the cistern, I created two sensors one is history_stats called “utilizzo_pompa” that should give the ignition time and this does not happen.

- platform: history_stats
  name: utilizzo_pompa
  entity_id: sensor.flusso
  state: 'pump on'
  type: time
  start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) | float * 60 }}'
  end: '{{ now() }}'

and one that measures the calculated time previously “utilizzo_pompa” multiplied by 5.0 (liters per minute) which is the average of the water flow of which they are already aware of it.

- platform: template
  sensors:
    pompa:
      friendly_name: litri
      icon_template: mdi:water-percent
      value_template: "{{ states('sensor.utilizzo_pompa') | float * 5.0 }}"
      unit_of_measurement: 'Lt'

but given my limited knowledge does not work, but the problem is in the first sensor that should start counting the time elapsed when the sensor is greater than zero (ie 5.0 when the water passes) until it returns to zero when the pump is stop, what do you think?

Why the ‘| float * 60’ in the start option?

thinking about it I do not have to put (| float * 60) in the first sensor that should give me only time, right?

You will see it if you paste the options in Dev Tools/Templates.

start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'

shows
start: ‘2019-01-28 00:00:00.083613+01:00’
end: ‘2019-01-28 10:17:32.083861+01:00’

with the float it shows
start: ‘0.0’
end: ‘2019-01-28 10:20:57.977493+01:00’

thanks I modified it, my doubt is: will this sensor measure me the time since the sensor status is greater than zero until the moment it returns to zero?

download

my need as mentioned above is to have the elapsed time indicated in the graph, e.g. in this case it is about 120 minutes that the pump has withdrawn, then with these minutes I multiply them by 5.0 liters per minute and so I could have the liters of water withdrawn.