Announce time spent on bathroom upon exit REQUEST (UNSOLVED)

LOL, i know its silly but I live in a house with two of my mates and some of them tend to take too long doing their business.
I’d like a routine to TTS announce the total time spent in the bathroom but I dont know how. I understand there is a built in counter function but not sure how to propely use it or if it’s even the right way to tackle this.

Very thankful for inputs :slight_smile:

If you have a motion sensor/door sensor in the bathroom then you can set up an automation. Say for example the automation would repeat until motion is off and increment a counter entity every second. After motion is off, then do a service call to tts. You can also reset the counter before or after the counting starts/stops

I’m not sure it’s so simple personally.

You need to look into room occupancy approaches which isn’t so straight forward.

Motion detectors are pretty good at detecting entry but not tracking occupancy.

What do you suspect is the process which is time consuming? Is it the shower or the can or the mirror etc? Might be able to localise around that a bit…

My 2 cents.

I have a magnet sensor on the door, i figured it would be used to track the time spent inside as the door will always be open/closed during the occupancy. The biggest issue for me is that i dont know how to use the counter properly along with having that counted time announced in minutes.

Appreciate your responses

So is the door only closed when people are in there?

That would make it pretty straight forward.

There should be lots of similar examples on the forum.

1 Like

Anyone of those suffers from OCD? Spending too much time washing hands is one of the symptoms OCD: Types, Symptoms, Causes, Diagnosis, Treatment, and Related Conditions.

I read the entire thread but never managed to figure out how to bend the code to fit my needs. I’ve tried to search for something similar myself without any luck.

Im surprised this isnt a common question, id also like to learn how this works to announce my total time spent in bed after ive initiated my “bedtime” routine when i run my “good morning” routine.

so im bumping the thread again, any ideas? :frowning:

First off, what attributes does the sensor have? Does it have an “open since”? You might be able to invert that.

Then there are probably a few ways you can tackle it. Not sure if my way is the best way, but you can have a go.

You could create a blank automation like this which is triggered when the door is closed

- id: '1756'
  alias: Door was just closed
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d0001bf8643
    from: 'off'
    to: 'on'
#Do  nothing

Then you should be able to access the time since it was triggered like this in a template sensor.

{{((as_timestamp(now()) - as_timestamp(states.binary_sensor.door_window_sensor_158d0001bf8643.last_changed))|int)}}

If you get that working, probably check that it’s updating ok. I recall they changed the behaviour of that a while back.

Edit: Looking back at this I don’t think what I suggested is quite right…

Thankful for your suggestion.

Anyhow - the mystery remains :frowning: anyone else have any suggestions?


Assuming a 2-code door sensor…
A simple automation that triggers on door close, and waits for the door to open. If it doesn’t open it sounds a buzzer. Variations on this are endless.

Nothing to do with a blueprint at all, however, so not quite the right topic to get good answers.
The closest thing I know of would be adapting my blueprint, it sorta does that, with a bit of tweaking…