3 minutes An Amazon Echo Dot on top of a bathroom closet beneath a sinkI am a big fan of music. There is almost always some kind of music playing around my house. My bathroom is no exception. So, when I enter my bathroom, the light turns on automatically and music starts playing. In this article, I will tell you how I made my entertainment bathroom.

In order for this to work, I used one smart lightbulb, one motion sensor and one Amazon Echo Dot. I created one virtual motion sensor and three automations in Home Assistant. I also made two Alexa routines.

First, the virtual motion sensor. I could have done it without this and use the real motion sensor for the Alexa routines instead, but this is not convenient. The routines will restart each time there is motion detected. From my own experience, these unwanted restarts can’t be fixed with the default suppressing options. A virtual motion sensor, directly connected to the light, will gave a steady result, so I used this option. I added the following lines to my configuration file:

# Binary sensor example
binary_sensor:
  - platform: template
    sensors:
      bathroom_occupied:
        friendly_name: "Bathroom Occupied Sensor"
        device_class: motion
        value_template: "{{ is_state('light.bathroom_light', 'on') }}"

Now, I have a motion sensor within the Alexa app which tells me if the bathroom light is turned on or off. I created two routines which this sensor. One to set the volume of the Echo Dot to 40% when the light turns on and one to mute the speaker when the light turned back off. This way, I can adjust the volume while the light is on, without intervention from routines triggered by unsteady motion detections.

Screenshot of Alexa routine to turn on the bathroom speaker Screenshot of Alexa routine to turn off the bathroom speaker

Second, I needed the light to be triggered by the real motion sensor. I went for the holy grail and created a nice color loop. The automation is below:

  alias: Bathroom light to color loop
  description: ''
  trigger:
  - device_id: 0385cf9110cf4445ae2c285efaa5b6ce
    domain: binary_sensor
    entity_id: binary_sensor.bathroom_motion
    platform: device
    type: motion
  condition:
  - condition: device
    device_id: d8f671c6b604408ebb5bee7a912e4e01
    domain: light
    entity_id: light.bathroom_light
    type: is_off
  action:
  - data:
      brightness_pct: 75
      effect: colorloop
      entity_id: light.bathroom_light
      transition: 3
    service: light.turn_on
  mode: single

When I enter the bathroom now, the light will turn on and so will the virtual motion sensor I created. What’s left is a trigger to turn off the bathroom light and the music. A simple command to turn off the light will take care of both things. The trigger for this automation is the same motion sensor, after detecting no motion for 2.30 minutes.

  alias: Bathroom light off
  description: ''
  trigger:
  - device_id: 0385cf9110cf4445ae2c285efaa5b6ce
    domain: binary_sensor
    entity_id: binary_sensor.bathroom_motion
    for:
      hours: 0
      minutes: 2
      seconds: 30
    platform: device
    type: no_motion
  condition: []
  action:
  - device_id: d8f671c6b604408ebb5bee7a912e4e01
    domain: light
    entity_id: light.bathroom_light
    type: turn_off
  mode: single

Lastly, there are moments when it would be nice to have bright white light in the bathroom. For this, I used a button press on my switch. Since the light stays on, the music will keep playing.

  alias: Bathroom light bright white
  description: ''
  trigger:
  - device_id: 6e386f60dba843798027a1492f41281d
    domain: zha
    platform: device
    subtype: turn_on
    type: remote_button_short_release
  condition:
  - condition: device
    device_id: d8f671c6b604408ebb5bee7a912e4e01
    domain: light
    entity_id: light.bathroom_light
    type: is_on
  action:
  - data:
      brightness_pct: 100
      color_name: white
      entity_id: light.bathroom_light
      transition: 3
      white_value: 255
    service: light.turn_on
  mode: single

There you have it. A cool entertainment bathroom. Very easy to make. What’s left is a method to prevent the light from turning off while I am showering and out of the motion sensor’s sight. Currently, I’m building a shower mode to solve this issue. It’s in beta and as soon as I have finished it, I will tell you. What are your bathroom automations or do you have recommendations for the shower mode? Tell me!