'In Meeting' home automation

2021-05-17

We've all been there, especially during these COVID-19 times, you are in a meeting sharing your camera and/or audio and suddenly your girlfriend walks into the office. Wouldn't it be nice if others were notified automatically when you stepped into a meeting? Let's just do that!

Home Assistant Companion

Home Assistant Companion is a new application for Mac to control your Home Assistant instance, exposing your Mac sensors to Home Assistant and to receive notifications. Like many recent updates to the iOS app, we have @zacwest to thank for this. Zac has ported the iOS app over to Mac and added some great new features specifically for the Mac.

- https://www.home-assistant.io/blog/2020/09/18/mac-companion/

At the moment the releases for Mac can be downloaded at the tagged releases page over on Github. After installing the application you basically login to your home assistant instance and from there on sensor information is shared. In my automation 3 companion provided sensors will be used in the end:

  1. binary_sensor.jeroens_macbook_pro_microphone_in_use
  2. binary_sensor.jeroens_macbook_pro_camera_in_use
  3. sensor.jeroens_macbook_pro_ssid

binary_sensor

I created a new template based binary_sensor called binary_sensor.in_meeting:

1
2
3
4
5
6
7
template:
  - binary_sensor:
      - name: In Meeting
        state: >
          {{ is_state('sensor.jeroens_macbook_pro_ssid', 'Jeroen & Eline')
             and (is_state('binary_sensor.jeroens_macbook_pro_camera_in_use', 'on') 
             or is_state('binary_sensor.jeroens_macbook_pro_microphone_in_use', 'on')) }}

The sensor value will become active once I am connected to my home WiFi AND at least my camera OR microphone are in use.

The sensor is on if the template evaluates as True, yes, on, enable or a positive number. Any other value will render it as off. The actual appearance in the frontend (Open/Closed, Detected/Clear etc) depends on the sensor’s device_class value

- https://www.home-assistant.io/integrations/template/#state

Automation

We now have a binary_sensor.in_meeting sensor that we can use inside automations. In the automation below I activate a scene once the state of the sensor changes from off to on.

1
2
3
4
5
6
7
8
9
alias: Meeting Started
trigger:
  - platform: state
    entity_id: binary_sensor.in_meeting
    from: 'off'
    to: 'on'
action:
  - scene: scene.office_meeting
mode: single

Scene

scene.office_meeting controls the 2 Hue bulbs I have in my fixture next to my office. I set the top one to a bright white color and the bottom one to a warm yellow. I have no colored bulbs in my upper hallway (DAMN WALLET!) so this how I make my current status visible to my family.

Things that you can do in your home:

  • Use colored lights: red = camera and mic on, yellow = camera off and mic on, green = camera off and mic off
  • Lock the door to your office using one of those smart locks
  • Use the TTS integration to play a message over the sound system in the living room
  • Send a notification to the phones of all your family members
  • Use your imagination, there is no end :D

If you have any questions, do not hesitate to contact me or leave a comment below.

Created by Jeroen Druwé