4 minutes A big microphone on a standIn my bedroom, I have a small audio recording studio. I use this studio for podcast and voiceover purposes. While recording your voice, it is of the most importance that there is no background noise. That’s difficult when it’s above 35 degrees Celsius outside. At such moments, my fan is spinning at full speed, a nice playlist with summer music on the speakers to increase the summer vibes and I can throw all myr recordings away due to disturbing background noises. So, I have to turn everything off when I start recording and back on as soon as I’m finished. This process takes time, but I think I have the perfect smart home solution to solve this problem.

I decided to create a ‘Recording mode’ within Home Assistant. By turning this mode on, everything will get quiet in my bedroom and when I turn it off, everything will go back to the state it was before. For example: when my fan is turned on and I activate the recording mode, the fan turns off. When I deactivate the recording mode, the fan will turn on, since Home Assistant knows it was on while the recording mode was activated. If the fan was turned off, it won’t turn on again. The same thing happens with the music and it will also toggle the do not disturb switch on my phone. So, one button press on a remote will get my bedroom ready for recording audio.

In order to retrieve this result, I created three things in Home Assistant. First, I made an Input Boolean. You can do so by going to configuration > Helpers. A toggle will do fine in this situation. I named it ‘Recording Mode’. I also added some lines to my configuration file to create a switch (since Input Booleans don’t show up in Apple’s Homekit app) and I created a template binary motion sensor so my Amazon Echo speakers can also react to this mode.

# Switch example
switch:
  - platform: template
    switches:
      recording_mode:
        friendly_name: "Recording Mode"
        value_template: "{{ is_state('input_boolean.recording_mode', 'on') }}"
        turn_on:
          service: input_boolean.turn_on
          data:
            entity_id: input_boolean.recording_mode
        turn_off:
          service: input_boolean.turn_off
          data:
            entity_id: input_boolean.recording_mode
# Binary sensor example
binary_sensor:
  - platform: template
    sensors:
      recording_mode:
        friendly_name: "Recording Mode Sensor Sensor"
        device_class: motion
        value_template: "{{ is_state('input_boolean.recording_mode', 'on') }}"

Before restarting Home Assistant, I unchecked the expose entity for the Input Boolean so it won’t show up in the Google Assistant and Amazon Alexa app. This will prevent duplicated switches for the recording mode. After restarting, I started to create some automations.

First, the bedroom fan. I added a new automation. I used the state change of the recording mode as trigger. Since I would like to toggle the fan, only when it is on, I added a condition in which the bedroom fan has to be on. The action is a remote command to toggle the fan. Since this fan uses an infrared remote, the command for on and off are the same. That’s why I got away with just one automation for this. Also, please notice that I don’t toggle the bedroom fan switch in this automation, because tha’ts the secret why Home Assistant knows if the fan was on or off while the recording mode was activated. If I turn off the fan while the recording mode is on, the fan won’t go back on after I deactivate the recording mode. This is my automation.

  alias: Bedroom fan toggle when recording mode is on
  description: ''
  trigger:
  - entity_id: switch.recording_mode
    from: 'off'
    platform: state
    to: 'on'
  - entity_id: switch.recording_mode
    from: 'on'
    platform: state
    to: 'off'
  condition:
  - condition: state
    entity_id: switch.bedroom_fan
    state: 'on'
  action:
  - data: {}
    service: rest_command.br_fan
  mode: single

Because of the infrared remote for this fan, I’ve also just one automation to toggle my fan on and off. I added a condition to this automation. The recording mode has to be off in order to execute the actions (toggle the fan on or off). This way, I can turn the fan on or off while recording mode is on, without actually toggling the fan.

One more thing for the fan. I created a second automation that will turn off the recording mode when I leave my home. It will do so with a small delay of one minute. I did this to make sure the bedroom fan switch has turned off before deactivating the recording mode and prevent conflicting infrared commands.

The music is second. Since I’ve created a template binary motion sensor for the recording mode, I can trigger routines on my Amazon Echo speakers by activating or deactivating it. I made two routines. The first to mute the volume on the bedroom speaker when the recording mode is activated and a second one to reset the volume to 30% when the recording mode is deactivated. This way, I don’t have to start the music again when the recording mode is turned off. When there is no music playing, it won’t start. Just that easy!

Lastly, I wanted my phone to enable do not disturb when the recording mode is switched on. I fixed this via IFTTT, since Home Assistant doesn’t support this function. I trigger a webhook, which tells my phone through IFTTT to turn on do not disturb. I made use of a rest command, which looks as follows in my configuration file:

# IFTTT webhooks example
rest_command:
  do_not_disturb_on:
    url: 'https://maker.ifttt.com/trigger/do_not_disturb_on/with/key/YOUR_WEBHOOK_KEY'
  do_not_disturb_off:
    url: 'https://maker.ifttt.com/trigger/do_not_disturb_off/with/key/YOUR_WEBHOOK_KEY'

I know that there are easier ways to trigger webhooks. The benefit of this method is that I don’t have to remember all te trigger words in my webhooks.

I already have two automations controling do not disturb on my phone. So I added the recording mode state change as an extra trigger to those automations.

And that’s it! An easy to use and quick recording mode that keeps my bedroom quiet during voice recording sessions. What’s left is a button which toggles this fantastic pease of work, which willliterally be saving me time… and a heatstroke.