I’ve been wanting to add an automatic ‘On a call’ light outside my office so that my kids know not to come into my office during work calls. A manual light would suffice, but I wanted to automatically turn on when I start a call. An added complication for me is that I use Slack, Zoom and Google Meet for calls, which makes automation a bit tricky.
I finally decided to tackle this automation and built RTC-Call-Monitor . It has been reliably detecting the start and end of any call on my machine that uses UDP.
RTC Call Monitor isn’t a HA Integration since it needs to run on the same machine that you use to make voice/video calls. The application will call a webhook at the start and end of a call, which works great with HA Webhook Triggers.
Currently the application can only be run via the command line, but I’ll be adding support for installing as a Windows service in a few days.
It depends on how MS Teams tells the client app that there is an incoming call. Slack sends a burst of UDP packets when an incoming call is ringing. Hopefully Teams will work in a similar manner.
Curious how we tie this into HA. I have the service running and it sees my calls from different calling applications but all my logic and automation is in HA. Would you be able to add mqtt connectivity and have the ability to update busy status (available, busy, etc) and activity status (in a call)?
I figured out how to get this working VERY reliably. First off THANK YOU @ericgla for writing a service that works for all web meeting/conference software. THIS is awesome! For those who are beginners attempting to get this going do the following:
Setup HA Requirements:
HACS: Install Virtual Components
Add to your configuration.yaml file/switches section add:
platform: virtual
name: On a Call
Go to Configuration/Automations
Add a new Automation
Name: Call Start
Mode: Single
Trigger Type: Webhook
Webhook ID: callstart
Actions type: Call Service
Service: switch.turn_on
Target Entity: switch.virtual_on_a_call
Save and go back to Automations
Add a new Automation
Name: Call Stop
Mode: Single
Trigger Type: Webhook
Webhook ID: callstop
Actions type: Call Service
Service: switch.turn_off
Target Entity: switch.virtual_on_a_call
Save and go to Configuration/Server Controls and restart HA
Setup RTC Monitor on your PC:
Download the windows.zip file from the GitHub and unzip into a folder (example C:\Scripts)
Run an elevated Powershell
Navigate to your directory
Execute: Unblock-File .\install.ps1
Execute: .\install.ps1
Edit appsettings.json
Modify the “LocalNetwork” to represent your network and subnet space
Modify the “CallStartWebhook” with http://[your_HA_ip_address]:8123/api/webhook/callstart
Modify the “CallEndWebhook” with http://[your_HA_ip_address]:8123/api/webhook/callstop
Save and Exit
Start services.msc
Start the RTC Monitor Service
Make a call and watch in your developer tools in HA the switch turn on/off.
@PrayerfulDrop, curious as to why you need the custom component in steps 1 and 2. Why not use one of the helpers like an input boolean? I couldn’t find the component in HACS as well, so I’m not sure if there is something special that it provides. Let me know. Thanks.
Great to hear it’s working well for you. I’ve been using it for about a month now and it’s been completely reliable, and my kids now know to look at my LIFX panels to see if daddy is on a call…
FYI - I’m also using an input boolean as mentioned by @stephack
I am not a fan of the input Boolean. Idk why but some automations in NR don’t seem to work as expected. So I use a virtual component. Maybe it is from the Hubitat days?
Anyways, the above directions at least help the new ppl looking to do this.
I hear ya. Wasn’t a fan of it initially as well. Virtual Device creation is a lot better with a lot of options and dwvixe types in HE.
Kinda why I’m curious about this component. I wasn’t able to find it in HACS, so I dug around the forum and found a post pointing to this. Is this is what you were referring to?
I know this one is a bit late, but does anyone using this tool see a weird issue where a call will basically start and stop a number of times, tripping up the automation? I also posted an issue in the GitHub, but wanted to ask here. Essentially, a single call (example here, Discord) will show as start/stop/start/stop/start/stop which keeps triggering automations.
Thanks @ericgla this is brilliant. Its working fine on my work computers to show current status. I’m using an automation to control an input boolean which is fine.
I’m wondering if you can help with using the POST body provider data - I thought it’d be good to include the provider in a template binary sensor attribute but I’m a bit lost on how to do this!
Explanation:
In the application settings you need to specify the same webhook for both events.
The sensor checks, when triggered by the webhook, if it is a start message (which includes the key ‘provider’) and respons with an on-state. You only get values for one of the two attributes, depending on the last message from the service.
Thanks so much, I really like this - it also cuts down on the input_boolean and automation I had to handle the status before. Always like when I can make these things simpler, AND I now get these extra attributes!
Not quite sure what I’ll do with them, might use duration to log how much time I spend (or waste?!) on calls a week…
Did anyone get this running under Ubuntu(20.04)?
I’m getting the following ill-formatted error message:
<3>RtcCallMonitor.Worker[0] System.PlatformNotSupportedException: Socket.IOControl handles Windows-specific control codes and is not supported on this platform. at System.Net.Sockets.SocketPal.WindowsIoctl(SafeSocketHandle handle, Int32 ioControlCode, Byte[] optionInValue, Byte[] optionOutValue, Int32& optionLength) at System.Net.Sockets.Socket.IOControl(Int32 ioControlCode, Byte[] optionInValue, Byte[] optionOutValue) at RtcCallMonitor.NetworkListener.CreateAndBindSocket() in /home//RTC-Call-Monitor/src/NetworkListener.cs:line 39 at RtcCallMonitor.NetworkListener.Start() in /home//RTC-Call-Monitor/src/NetworkListener.cs:line 59 at RtcCallMonitor.NetworkListener.UpdateIpAddress(IPAddress newAddress) in /home//RTC-Call-Monitor/src/NetworkListener.cs:line 71 at RtcCallMonitor.TrafficMonitor.NetworkChange_NetworkAddressChanged(Object sender, EventArgs e) in /home//RTC-Call-Monitor/src/TrafficMonitor.cs:line 116 at RtcCallMonitor.TrafficMonitor.Start() in /home//RTC-Call-Monitor/src/TrafficMonitor.cs:line 79 at RtcCallMonitor.Worker.ExecuteAsync(CancellationToken stoppingToken) in /home//RTC-Call-Monitor/src/Worker.cs:line 29