Shower timer (for families)- powerful lights

Hi,
For more than a year I’m using this shower timer automation and we love it. It is an automation which is not complicated and the idea maybe also not. But in the theme of " parents helping each other…" I share this.

Why…
We have two kids, now 4 and 9 years old. They LOVE the shower. The longer, the better. (same as the parents :slight_smile: ) … But a long shower is wasting a lot of water and a lot of energy.
For years we had every evening discussions about the time to stop the shower. Twice.
Then I made this automation.
When they start the shower, they push the button. A green light give confirmation that the automation/shower has started. After 3 minutes there is a short orange light. Which means: If you stil have shampoo in your hair, you have 1 minute to clean it al out!
One minute later there is a red light. This means: stop the shower.
Yeah… sounds simple… But it appears that the message of the light is way more powerful than the message of the parents…
And of course, this automation works for us as parents aswel.

How
It is a simple automation. Tigger-condition-action.
Trigger: You can use what you want. I use a button. (zigbee with deconz/conbee)
Condition: I have 2 different conditions to because I want a different " in between" light when I shower in the morning (more blue light) then when I shower in the evening and weekend (more yellow/red light).
Action: The action starts the sequence of lights. I recently did put the sequence in a script. Because when the kids push in a short time more then once on the button, it wil reset the first push (automation) instead of having two automations controlling the same light at one moment…

"eco-system"
Because I have a few more automations in my bathroom, all related to the motion sensor, this sensor needs to be put in a “pause” during the shower. It did this with a input_boolean. I also cancel the timers which are running when the shower-button is pushed.

extra’s…
When you push the same button twice (the aqara button can sent 4 different codes by pushing 1, 2, 3 of 4 times the button) It wil activate a automation which doubles the shower time. (my kids don’t know about this. My wife does. I think this is called the WAF-factor? :slight_smile:

Also made as a test a color therapy automation. This is just a few different colors behind each other. Still have to make this one better.

I share the yaml of this automation and also of the rest of my bathroom, so you can understand the context.

in automation:

- id: automation 9bcdef       
  alias: douchen01 ochtend start 
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: knop_vrij
      event: 1002
  
  condition:
    - condition: time
      after: '06:00:00'
      before: '09:00:00'
  
  action:
   - service: notify.pushberichten
     data:
       message: "start douche ochtend"
       title: "knop"
       target: ""               
        # Cancel ev. old timers
   - service: script.turn_off
     data:
       entity_id: script.douchen01, script.douchen02, script.douchen03, script.douchen04, script.timer_off8b, script.timer_off8bb
   - service: script.turn_on
     data:
       entity_id: script.douchen01      
   
 
 
- id: automation 99befg       
  alias: douchen avond start 
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: knop_vrij
      event: 1002
  
  condition:
    - condition: time
      after: '09:00:01'
      before: '05:59:59'

  action:
   - service: notify.pushberichten
     data:
       message: "start douche avond"
       title: "knop"
       target: ""               
        # Cancel ev. old timers
   - service: script.turn_off
     data:
       entity_id: script.douchen01, script.douchen02, script.douchen03, script.douchen04, script.timer_off8b, script.timer_off8bb
   - service: script.turn_on
     data:
       entity_id: script.douchen02

     
- id: automation 99befgf       
  alias: douchen avond start dubbel
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: knop_vrij
      event: 1004
  
  condition:
    - condition: time
      after: '09:00:01'
      before: '05:59:00'

  action:
   - service: notify.pushberichten
     data:
       message: "start douche avond dubbel"
       title: "knop"
       target: ""               
        # Cancel ev. old timers

   - service: script.turn_off
     data:
       entity_id: script.douchen01, script.douchen02, script.douchen03, script.douchen04, script.timer_off8b, script.timer_off8bb
   - service: script.turn_on
     data:
       entity_id: script.douchen03

           
##### codes/events knop ######    
# 1002	One	single short press
# 1004	One	double short press
# 1005	One	triple short press
# 1006	One	quad short press           

- id: automation 99befgfeg       
  alias: douchen kleurentherapie
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: knop_vrij
      event: 1006
  
  action:
   - service: notify.pushberichten
     data:
       message: "start douche kleurentherapie"
       title: "knop"
       target: ""               
        # Cancel ev. old timers
   - service: script.turn_off
     data:
       entity_id: script.douchen01, script.douchen02, script.douchen03, script.douchen04, script.timer_off8b, script.timer_off8bb
   - service: script.turn_on
     data:
       entity_id: script.douchen04



In script:

#####
#scripts douchen
###############
douchen01:
  alias: "douchen ochend"
  sequence:
    - service: homeassistant.turn_on
      entity_id: input_boolean.douchen
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [235,255,67]
        brightness: 254
    - delay: '00:00:05'        
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 156
    - delay: '00:03:00'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,145,38]
        brightness: 254
    - delay: '00:00:10'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 156
    - delay: '00:01:00'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,0,0]
        brightness: 254
    - delay: '00:00:30'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 156   
    - service: homeassistant.turn_off
      entity_id: input_boolean.douchen
   # - service: homeassistant.turn_on
    #  entity_id: script.timed_lamp8b      


douchen02:
  alias: "douchen avond"
  sequence:
    - service: homeassistant.turn_on
      entity_id: input_boolean.douchen
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [235,255,67]
        brightness: 254
    - delay: '00:00:05'        
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 447
    - delay: '00:03:00'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,145,38]
        brightness: 254
    - delay: '00:00:10'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 447
    - delay: '00:01:00'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,0,0]
        brightness: 254
    - delay: '00:00:30'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 447   
    - service: homeassistant.turn_off
      entity_id: input_boolean.douchen
#    - service: homeassistant.turn_on
 #     entity_id: script.timed_lamp8b  

douchen03:
  alias: "douchen avond start dubbel"
  sequence:
    - service: homeassistant.turn_on
      entity_id: input_boolean.douchen
    - service: homeassistant.turn_on
      entity_id: input_boolean.douchen
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,58,191]
        brightness: 254
    - delay: '00:00:05'        
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 447
    - delay: '00:14:00'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,145,38]
        brightness: 254
    - delay: '00:00:10'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 447
    - delay: '00:01:00'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,0,0]
        brightness: 254
    - delay: '00:00:30'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 447   
    - service: homeassistant.turn_off
      entity_id: input_boolean.douchen
#    - service: homeassistant.turn_on
 #     entity_id: script.timed_lamp8b    

douchen04:
  alias: "douchen kleurentherapie"
  sequence:
    - service: homeassistant.turn_on
      entity_id: input_boolean.douchen
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,58,191]
        brightness: 254
    - delay: '00:00:05'        
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,0,0]
        brightness: 254
    - delay: '00:01:00'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [255,189,46]
        brightness: 254
    - delay: '00:01:00'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [0,0,255]
        brightness: 254
    - delay: '00:01:00'
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        rgb_color: [0,255,0]
        brightness: 254
    - delay: '00:01:00'   
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 200
        color_temp: 447   
    - service: homeassistant.turn_off
      entity_id: input_boolean.douchen
 #   - service: homeassistant.turn_on
  #    entity_id: script.timed_lamp8b      
             
      


context of automations in my bathroom:



# Badkamer

- id: automation 24b
  alias: wakker worden badkamer door de week1
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'on'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '06:00:01'
          before: '09:00:00'
        - condition: time
          weekday:
            - mon
            - tue
            - wed
            - thu
            - fri
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off'    
  action:
    # Cancel ev. old timers
    - service: script.turn_off
      data:
        entity_id: script.timer_off8b
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 254
        color_temp: 156
        #rgb_color: [255, 230, 192]
        
- id: automation 24bb
  alias: wakker worden badkamer door de week2
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'off'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '06:00:01'
          before: '09:00:00'
        - condition: time
          weekday:
            - mon
            - tue
            - wed
            - thu
            - fri
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off'    
  action:
    service: homeassistant.turn_on
    entity_id: script.timed_lamp8b
    
- id: automation 24bbb
  alias: wakker worden badkamer weekend1
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'on'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '06:00:01'
          before: '09:00:00'
        - condition: time
          weekday:
            - sat
            - sun
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off'    
  action:
    # Cancel ev. old timers
    - service: script.turn_off
      data:
        entity_id: script.timer_off8b
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 240
        color_temp: 346
        #rgb_color: [255, 204, 127]
        
- id: automation 24bbbb
  alias: wakker worden badkamer weekend2
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'off'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '06:00:01'
          before: '09:00:00'
        - condition: time
          weekday:
            - sat
            - sun
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off'    
  action:
    service: homeassistant.turn_on
    entity_id: script.timed_lamp3b      
       
       
- id: automation 11b
  alias: overdag badkamer1
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'on'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '09:00:01'
          before: '20:00:00'
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off'  
  action:
    # Cancel ev. old timers
    - service: script.turn_off
      data:
        entity_id: script.timer_off8bb, script.timer_off8b
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 240
        color_temp: 346
        #rgb_color: [255, 204, 127]
    
- id: automation 11bb
  alias: overdag badkamer2
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'off'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '09:00:01'
          before: '20:00:00'
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off'  
  action:
    service: homeassistant.turn_on
    entity_id: script.timed_lamp3b    
    

- id: automation 26a
  alias: avond badkamer1
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'on'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '20:00:01'
          before: '23:00:00'
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off'   
  action:
    # Cancel ev. old timers
    - service: script.turn_off
      data:
        entity_id: script.timer_off8b
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 210
        color_temp: 447
        #rgb_color: [250, 179, 80]
 
- id: automation 26aa
  alias: avond badkamer2
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'off'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '20:00:01'
          before: '23:00:00'
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off'
  action:
    service: homeassistant.turn_on
    entity_id: script.timer_off8b 

- id: automation 26bbb
  alias: nacht badkamer1
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'on'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '23:00:01'
          before: '06:00:00'
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off'  
  action:
    # Cancel ev. old timers
    - service: script.turn_off
      data:
        entity_id: script.timer_off8b, script.timer_off8bb
    - service: light.turn_on
      data:
        entity_id: light.badkamer01
        brightness: 150
        #color_temp: 500
        rgb_color: [255,0,0]
 
    
- id: automation 26bb
  alias: nacht badkamer2
  trigger:
    - platform: state
      entity_id: binary_sensor.beweging_badkamer01
      to: 'off'
  condition:
      condition: and
      conditions:
        - condition: time
          after: '23:00:01'
          before: '06:00:00'
        - condition: state
          entity_id: input_boolean.douchen
          state: 'off' 
  action:
    service: homeassistant.turn_on
    entity_id: script.timer_off8b

scripts:

# scripts Badkamer

timed_lamp8b:
  alias: "badkamer wakker worden timer"
  sequence:
    # Cancel ev. old timers
    - service: script.turn_off
      data:
        entity_id: script.timer_off8b
#    - service: light.turn_on
 #     data:
  #      entity_id: light.badkamer01
   #     brightness: 254
#        color_temp: 156
        #rgb_color: [255, 230, 192]
    # Set new timer
    - service: script.turn_on
      data:
        entity_id: script.timer_off8b

timer_off8b:
  alias: "lamp uit na 2 minuten badkamer"
  sequence:
    - delay:
        minutes: 2
    - service: light.turn_off
      data:
        entity_id: light.badkamer01
        
timer_off8bb:
  alias: "lamp uit na 30 seconden badkamer"
  sequence:
    - delay:
        seconds: 30
    - service: light.turn_off
      data:
        entity_id: light.badkamer01        
        
timed_lamp3b:
  alias: "badkamer overdag"
  sequence:
    # Cancel ev. old timers
    - service: script.turn_off
      data:
        entity_id: script.timer_off8bb
#    - service: light.turn_on
#      data:
#        entity_id: light.badkamer01
#        brightness: 240
#        color_temp: 346
#        #rgb_color: [255, 204, 127]
    # Set new timer
    - service: script.turn_on
      data:
        entity_id: script.timer_off8bb  

ps. the notify is optional. For me it was to check if this automation works. Now I know when someone starts taking a shower.

**edit 11-2-2020: I made some changes to the script of the shower sequins. You don’t need the last two lines. I also had a little annoying thing in script timed_lamp8b. Made the changes by adding " # " .

used hardware: raspberry pi 3b + raspbee (deconz)
motion sensors: hue and aqara (aliexpress)
lights: hue
software: hassio

5 Likes

Genius. Thanks for sharing the idea.

1 Like

Brilliant. I already have a few buttons being delivered and I order extra just incase. This will be used.

1 Like

Awesome, will be installing this too! First need to add the RGB light somewhere.

1 Like

I don’t have an RGB light, I just plan on making it flash. Then just turn off when they are supposed to be done :smiling_imp:

1 Like

I just create one script using Sono Speaker on the kids bathroom. It is more efficient that looking at the light bulbs color for kids. I am using the TTS Sono speaker. Plus with the script I can execute it from Alexa voice routine.

Hey mrteaiot, that sounds like a great addition! Light and sound. Can you share this?
FYI, the lights still works great. The bulbs enlighten the whole bathroom. I use it for myself to. When I have to get up early, I don’t wake up anyone with these timer lights.

Scripts.yaml file:
sonos_say:
alias: Sonos Say
sequence:

  • service: sonos.snapshot
    data_template:
    entity_id: ‘{{ sonos_entity }}’
  • service: sonos.unjoin
    data_template:
    entity_id: ‘{{ sonos_entity }}’
  • service: media_player.volume_set
    data_template:
    entity_id: ‘{{ sonos_entity }}’
    volume_level: ‘{{ volume }}’
  • service: tts.google_translate
    data_template:
    entity_id: ‘{{ sonos_entity }}’
    message: ‘{{ message }}’
  • delay: ‘{{ delay }}’
  • service: sonos.restore
    data_template:
    entity_id: ‘{{ sonos_entity }}’

shower_timer_warning:
alias: kids shower timer warning
sequence:

  • service: script.sonos_say
    data:
    sonos_entity: media_player.kids_bathroom
    volume: 0.7
    message: You have 10 minutes to shower and the timer starts now. You will have
    5 minutes reminder later.
    delay: 00:00:10
  • delay: 00:05:00
  • service: script.sonos_say
    data:
    sonos_entity: media_player.kids_bathroom
    volume: 0.7
    message: Get ready to finish up. You have another 5 minutes more to shower. You
    will get another final reminder.
    delay: 00:00:10
  • delay: 00:05:00
  • service: script.sonos_say
    data:
    sonos_entity: media_player.kids_bathroom
    volume: 0.8
    message: Your shower time is done, slowly get out of the shower now. Your
    daddy thank you for make yourself clean everyday!.
    delay: 00:00:10

Nice!

I’m looking for a script which tells how many minutes someone had showered. Any tips?

Thanks.
I like your idea. No clue how to do so. Using a rain meter? :grinning:

They way that I’ve handled it, is via an Aqara Humidity sensor sticking it on the fixed shower head ( sticking it on ceiling works as well).

Next steps is to check the Humidity and based of the humidity you can trigger the rest of your automation and even determine how long you were showering.
image

- trigger:
    - platform: event
      event_type: state_changed
      event_data:
        entity_id: "sensor.lumi_lumi_weather_humidity"
  binary_sensor:
    - name: "Showering Wet/Dry"
      unique_id: showering_wet_dry
      state: >
        {% if (trigger.event.data.new_state.state|float)>=60%}
          {% if ((trigger.event.data.new_state.state|float)-(trigger.event.data.old_state.state|float))>=0%}
          True
          {%else%}
            {% if (trigger.event.data.new_state.state|float)>=90%}
            True
            {%else%}
            False
            {%endif%}
          {%endif%}
        {%else%}
        False
        {%endif%}
      device_class: moisture

Note: True = it is wet, False = it is dry

So in my automation I have added:

          - variables:
              start: "{{as_timestamp(states.binary_sensor.showering_wet_dry.last_changed)}}"
              stop: "{{as_timestamp(now())}}"
              total_seconds: "{{(as_datetime(stop)-as_datetime(start)).total_seconds()}}"
              hours: "{{(total_seconds//3600)|int}}"
              minutes: "{{((total_seconds%3600)//60)|int}}"
              seconds: "{{(total_seconds%60)|int}}"
              duration_msg: >
                {% if hours>=1 %}{{hours|int}} uur {% endif %}{% if hours>1 and
                (minutes>0 or seconds>0)  %}en {% endif %}{% if minutes>=1 and
                minutes<2 %}{{minutes|int}} minuut {% endif %}{% if minutes>=2
                %}{{minutes|int}} minuten {% endif %}{% if minutes>=1 and
                seconds>=1 %}en {% endif %}{% if seconds>=1 and
                seconds<2%}{{seconds|int}} seconde {% endif %}{% if seconds>=2
                %}{{seconds|int}} seconden {% endif %}
              message: >-
                {{"Hallo, was het douchen lekker? Hierbij je statistiek: Je hebt
                net "~duration_msg~" gedoesht."}}
          - service: script.sonos_tts
            data:
              speakers:
                - media_player.badkamer
              ttsvolume: 40
              ttsmessage: "{{message}}"

Side note: Google TTS doesn’t understand the word “gedoucht”, therefor I created the word “gedoesht”

All-in-all it means that no one has to press any buttons, and you build some funny automation when having a binarysensor :smiley:

3 Likes

I tried this a couple of days but my wife went crazy of the announcements because she didn’t have time to finish shaving her legs so now she wants me to stop being a ‘douche bag’ and revert back. So WAF is zero unfortunately :grinning_face_with_smiling_eyes:

2 Likes