Calculate total water consumption

Hey Folks,

I am using 5 Shelly1’s to turn electric valves on or off.
I want to display the total amount of water used.

For Example:
When the State of “Alle_Sprinkler” is “ON” → Add “1.0” every second to a value.
When the State is “OFF” pause the counter
When the State switches to “ON” again continue to add a certain amount of water per second or minute.

I have already managed to get the current consumption displayed in a Number Item when the Switch is turned on.

Can someone help me? :slight_smile:

Not sure if still relevant, but you could use a rule that,

  • whenever the switch is switched on and off, save the respective time stamps…
  • and, when being switched off, subtract the two time stamps from another…
  • and add it to a third variable where you accumulate the # of seconds.

I used this when converting cumulative readings into daily readings. Maybe you can recycle some of the code: Convert cumulative meter reading (e.g. for heat/energy (kWh) or water (l)) into daily / hourly consumptions (W or l/h)