Update OpenHAB items based on video calling status

Not sure if this is of interest to anyone else, but while I’ve been working from home I’ve set up an RGB light outside my office door to notify my Wife and Children that I’m on a video call and don’t want to be disturbed.

Initially this was set purely manually by me flicking an OpenHAB switch which triggered a rule to send the correct commands to my light.

However, I wanted to automate this based on when I was actually using any of the various tools my work use for video calling, thus the following script was born: GitHub - andrew-schofield/openhab-video-call-updater: Updates OpenHAB with video call status

It’s a simple powershell script (I use Windows at work), which polls a list of applications every 30 seconds to detect whether a video call is in progress, and then updates a bunch of OpenHAB switches, grouped with an “Any One” aggregation to toggle the light state automatically.

1 Like

What does it detect to determine a call is taking place? Zoom, lync, teams?

So I looked through the example json, and see teams in there, it looks for a process name…so I seem that I have 9 teams.exe processes, how do you determine which one is when a call is active?

I have something that I manually trigger (customisable keyboard buttons help here).

It counts how many UDP endpoints are open for a given application. If they are above a certain threshold (usually 0), then a video call is in progress.
Currently it will detect Zoom, Slack, Teams and GoToMeeting calls.

Also I might be thick, but I couldn’t get anything out of that command for finding the process:

(Get-NetUDPEndpoint -OwningProcess ('Teams').Id -EA 0|Measure-Object).count

No, you’re not being thick, there is an error in the documentation.

You actually need to run

(Get-NetUDPEndpoint -OwningProcess (Get-Process Teams -EA 0).Id -EA 0|Measure-Object).count

In my tests, while Teams is running, but not in a call, it maintains 2 open UDP connections, but as soon as you start a call this jumps to ~10 connections.

Ahh right, yeah that helped…ok, so in a call I see 10 now.

Obviously you’re Openhab 3…there were a few changes i had to make for Openhab 2.5.

$url = $SettingsObject.openhabbasepath + $item 

No State on OH2.5

No Bearer token

And POST over PUT:

Invoke-RestMethod $url -Method 'POST' -Headers $headers -Body $body

But other than that got it working for Teams and Lync. Have to see if lync - which is 0 for off. Does the same for 1:1 calls rather than meetings.

Ta, was looking at hooking to teams apis and all that jazz, but this is much simpler.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.