I work from home and wanted an easy way to let my family know that I’m on a call. The lights are the easy part - something like this works really well. I put one outside my door and one inside (so I can easily see the status of the light). Note that this is RF based not IR so it can easily go through walls.
Next I wanted to automate it:
I decided that instead just looking for specific programs running I needed to know if the mic was being accessed. To do that I (with a lot of help from ChatGPT) found a way to accomplish that by checking if the mic icon was present in the task bar.
I’m using Windows 11 so this part will vary based on your OS, but the goal is to see if the mic is being accessed and if so, call a webhook.
I ended up with this (in python):
from pywinauto import Desktop
import requests
import time
# Home Assistant Webhook details
WEBHOOK_URL = "YOUR WEBHOOK"
def find_microphone_icon():
"""Check if the microphone icon is present in the taskbar."""
try:
# Connect to the Taskbar
taskbar = Desktop(backend="uia").window(title_re=".*Taskbar.*")
# Iterate through all descendants in the taskbar
for element in taskbar.descendants():
element_info = element.element_info # Get detailed info about the element
# Check if the element contains "microphone" in its name (adjust for localization)
if element_info.name and "microphone" in element_info.name.lower():
return True # Microphone icon found
return False # Microphone icon not found
except Exception as e:
print(f"Error: {e}")
return False
def send_webhook(mic_status):
"""Send the microphone status to Home Assistant via webhook."""
try:
data = {"mic_in_use": mic_status}
response = requests.post(WEBHOOK_URL, json=data)
response.raise_for_status()
print(f"Webhook sent. Mic status: {mic_status}")
except requests.exceptions.RequestException as e:
print(f"Failed to send webhook: {e}")
if __name__ == "__main__":
previous_status = None # Track the previous mic status to avoid duplicate webhooks
while True:
mic_in_use = find_microphone_icon()
# Only send a webhook if the status changes
if mic_in_use != previous_status:
send_webhook(mic_in_use)
previous_status = mic_in_use
time.sleep(15) # Check every 15 seconds
I set this up to start on startup using Task Scheduler.
Next, I setup a webhook in HA but needed a way to emit the RF signal on demand. For that I ended up with the Broadlink RM4 Pro. I tried a cheaper one from AliExpress, but it couldn’t read the RF signals from the remote. The RM4 worked really well.
To connect the RM4 to HA, use the Broadlink integration.
Then in Developer > Actions call this (I called my device “universal_remote” adjust as needed):
action: remote.learn_command
data:
device: status_light
command: COMMAND_NAME
command_type: rf
target:
entity_id: remote.universal_remote
For COMMAND_NAME, use the name of the button, for example on, off, 15 minutes etc…
After clicking Perform Action, you’ll hold the button for around 10 seconds, then it will tell you (in Notifications) to just press it one time. If it worked, the Perform Action button should change to a green check mark.
Do this for each of the buttons you want to use, just replacing the “command” you want to train.
Next, add the scripts to control each button in scripts.yaml:
send_status_light_on:
alias: Turn Status Light On
sequence:
- target:
entity_id: remote.universal_remote
data:
device: status_light
command: 'on'
action: remote.send_command
send_status_light_off:
alias: Turn Status Light Off
sequence:
- target:
entity_id: remote.universal_remote
data:
device: status_light
command: 'off'
action: remote.send_command
send_status_light_preset:
alias: Set Status Light Preset
sequence:
- target:
entity_id: remote.universal_remote
data:
device: status_light
command: preset
action: remote.send_command
send_status_light_15:
alias: Set Status Light to 15 Minutes
sequence:
- service: remote.send_command
target:
entity_id: remote.universal_remote
data:
device: status_light
command: 15 minutes
send_status_light_30:
alias: Set Status Light to 30 Minutes
sequence:
- service: remote.send_command
target:
entity_id: remote.universal_remote
data:
device: status_light
command: 30 minutes
send_status_light_45:
alias: Set Status Light to 45 Minutes
sequence:
- service: remote.send_command
target:
entity_id: remote.universal_remote
data:
device: status_light
command: 45 minutes
send_status_light_60:
alias: Set Status Light to 60 Minutes
sequence:
- service: remote.send_command
target:
entity_id: remote.universal_remote
data:
device: status_light
command: 60 minutes
Then add your automation, here’s mine:
alias: Mic Status
description: ""
triggers:
- trigger: webhook
allowed_methods:
- POST
- PUT
local_only: true
webhook_id: "WEBHOOK ID"
conditions: []
actions:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.json.mic_in_use == true }}"
sequence:
- action: script.send_status_light_preset
data: {}
- conditions:
- condition: template
value_template: "{{ trigger.json.mic_in_use == false }}"
sequence:
action: script.send_status_light_off
data: {}
mode: single
send_status_light_preset is the “Set” button on the remote, I set that to the color and brightness I want, but you can call any button that you trained here.
I have not yet found a way to make anyone in my house pay attention to the light, but at least I know I tried!
Hope this helps someone!