On a Meet, Part 2: The CLI

Picture by Gemini Nano Banana + Ommi

Two years ago, I wrote an article about how to turn on a “LIVE” light sign when the webcam is on (and turn it off when the webcam turns off).

As I mentioned in the original post, this is very useful for me, as I share a home office with my wife. It allows us to know when the other is in a meeting, even if they are not talking, so we can avoid making noise.

Thanks to the power of Home Assistant, the use case has become more complex. For example, I now turn on a 32x32-pixel screen, the Govee Hexa, and other appliances when we are “live.”

When I joined New Relic in 2024, I started using a macOS computer and needed to find a way to do the same on a Mac, as the detection method (v4l2) doesn’t work on macOS. I adapted the script @antonmry created for macOS, but macOS Tahoe changed the log entry monitored by the script, so I had to modify it.

It was at that moment that I thought of creating a CLI tool to simplify this for both Linux and macOS:

https://github.com/sergiocarracedo/on-a-meet

on-a-meet CLI

This is a simple CLI tool. You only need to install it using Homebrew:

brew tap sergiocarracedo/homebrew-tap
brew install on-a-meet

Then run the onboarding assistant:

on-a-meet onboard

It will ask you about:

  1. The detection mode: on Linux, we can use v4l2 or lsof
  2. The camera to monitor: all cameras or a specific camera
  3. The debounce and polling times
  4. The commands to execute when the state changes to ON or OFF. They can contain environment variables. For example, to set the input boolean in Home Assistant: curl -X POST http://192.168.0.104:8123/api/states/input_boolean.on_a_meet -H 'Content-Type: application/json' -d '{\"state\": \"on\"}' -H 'Authorization: Bearer ${HASS_TOKEN}'
  5. The file from which to load environment variables, if you use them (optional)
  6. It will ask you to test that everything works and that the camera state is detected
  7. Whether to install the service

After that, the tool is installed as a service that manages changes in the camera status.

Check the documentation for more details: https://github.com/sergiocarracedo/on-a-meet#configuration

See it in action (again)

Working with multiple computers in Home Assistant

As I mentioned before, I share this “LIVE” signal with my wife. This means the light must be on if one of the computers’ webcams is on, but it should not turn off immediately when one camera turns off while the other is still on.

In Home Assistant, I manage that by creating an input boolean helper for each computer and turning on the light via an automation:

Turn ON automation

alias: On a meet light
  description: ''
  triggers:
    - entity_id:
        - input_boolean.on_a_meet
      to:
        - 'on'
      trigger: state
    - entity_id:
        - input_boolean.on_a_meet_mac
      to:
        - 'on'
      trigger: state
    - entity_id:
        - input_boolean.on_a_meet_patri
      to:
        - 'on'
      trigger: state
    - trigger: state
      entity_id:
        - input_boolean.on_a_meet_patri_xps
      to:
        - 'on'
  conditions:
    - condition: state
      entity_id: input_boolean.office_sleep_mode
      state: 'off'
  actions:
    - action: scene.turn_on
      metadata: {}
      target:
        entity_id: scene.office_on_a_meet
      data: {}
  mode: single

Turn off automation

alias: On a meet off
description: ''
triggers:
  - entity_id:
      - input_boolean.on_a_meet
    to: 'off'
    trigger: state
  - entity_id:
      - input_boolean.on_a_meet_mac
    to: 'off'
    trigger: state
  - entity_id:
      - input_boolean.on_a_meet_patri
    to: 'off'
    trigger: state
  - trigger: state
    entity_id:
      - input_boolean.on_a_meet_patri_xps
    to:
      - 'off'
conditions:
  - condition: state
    entity_id: input_boolean.on_a_meet
    state: 'off'
  - condition: state
    entity_id: input_boolean.on_a_meet_mac
    state: 'off'
  - condition: state
    entity_id: input_boolean.on_a_meet_patri
    state: 'off'
  - condition: state
    entity_id: input_boolean.on_a_meet_patri_xps
    state: 'off'
actions:
  - action: scene.turn_on
    metadata: {}
    target:
      entity_id: scene.office_on_a_meet_off
mode: single

As you can see, we use this method for four computers (personal and work laptops), and it works fine.

I hope you find this CLI tool useful, and any feedback is welcome, as usual.

Select Sergio Carracedo as a preferred source on Google