Start timer on water usage

Hi all,

I’m looking for a way to monitor the time my kids are using the shower. I want to avoid putting a separate sensor within the bathroom so I’m thinking of a solution like:

If water_usage grows with 6.5 L/min (estimated shower usage), start timer
If water_usage drops with 6.5 L/min stop timer

A front-end card with 3 timers below each other which refresh as soon as a new timer event started. The order in which they shower is almost the same everyday so I can pre-configure each timer to a person.

I’ve really got no clue on how to achieve this? Anyone who can point me in the right direction?

So you already have a sensor that detects the water used per minute in litres for the whole house ?

I’d start by detecting when the usage per minute exceeds a threshold, using something like a device trigger:-

trigger:
  - type: humidity
    platform: device
    id: shower_started
    device_id: 809dad8c720348089599f9c2aa2ad6ff
    entity_id: sensor.my_water_litres_per_minute
    domain: sensor
    above: 6.5

  - type: humidity
    platform: device
    id: shower_stopped
    device_id: 809dad8c720348089599f9c2aa2ad6ff
    entity_id: sensor.my_water_litres_per_minute
    domain: sensor
    below: 6.5

Then use a choose action to decide what actions to take depending on whether the trigger id means the shower has started or stopped. You can use a trigger id or template condition for this:-

condition:
  - condition: trigger
    id: "shower_started"

For starting, you’ll want to start your timer, and for stopping, stop the timer.

If you can guarantee the order that the showers take place, you could simply use some input booleans that are set to true each time the automation is called, and used them as conditions to decide which timer to start or stop.

Hi Rofo,

Thanks a lot, this really helps me configuring this feature.
I’ve already got a device measuring the water usage so…that’s no problem.

The only issue I see is that with your configuration I measure the water usage above a certain value, but I really have to measure the usage when it grows with a certain value.

For instance:
My washing machine already uses like 10 liters a minute so…it will detect this as showering.
The only way to avoid that is by triggering on the fact that the water usage is growing with 6.5 liters a minute.

You know what I mean?

I’ll see how far I can get with your suggestions.

You’ll pretty much just need 6 choose conditions based on the state of the booleans and whether or not you are turning the timers on or off.

For example, for the on conditions:-

First check if the first input boolean has been set or not, if not set, set it , and then start timer 1.
For the second, check if boolean 1 has been set already, and 2 has not, then set timer 2.
And finally for the third, check if 1 and 2 have been set and not 3, then start timer 3.

And exactly the same for the off’s, with one addition.

For each off, unset the input boolean for the relevant timer, so its reset for the morning.
Or, have a separate automation trigger at (say) 3am to reset all the input booleans for the next day.

As for your other problem, using one shared sensor to measure water consumption does make it tricky to determine whats actually using the water. Is it a shower or something else ?

You could try adding both an above and below like so:-

trigger:
  - type: humidity
    platform: device
    id: shower_started
    device_id: 809dad8c720348089599f9c2aa2ad6ff
    entity_id: sensor.my_water_litres_per_minute
    domain: sensor
    above: 6.0
    below: 9.0

So this would only trigger if the water was between those values. So this wouldn’t trigger the washing machine as it uses 10 litres. however, it becomes more complicated if you have the washing machine AND the showers running at once.

EDIT:- The above I think is slightly incorrect. Adding an above and below will trigger if either threshold is passed. What you need (I think) is a device trigger above 6 (or 6.5), and a separate condition to check its below 9.