Wanted: Microsoft Teams Binding

I’m looking for a way to use my Microsoft Teams presence status in OpenHAB to change the color of a fibaro plug led.
It’s time for home office and then the kids could see, when it’s possible to enter the office…
image
Is there any existing binding or way to get this status?

6 Likes

Yesterday I’ve read something about Microsoft Flow, to automate tasks. Perhaps you can use this to create a rule sending openhab messages with the status?

I believe the status variable is exposed in ActiveDirectory. An experienced windows developer should be able to pull that and format to JSON or similar output for youth consume in OH.

I tried this - but there’s no way to use the status as a trigger…

In Teams for web I can see this information in a browser.
But using the http-binding seems too complicated for me.

I could imagine that is will be a bit complicated. As far as I know, you would need to have an OpenHAB app in Teams. Meaning it needs to get certified from Microsoft. And this app would then need to talk to the OH cloud instance…

I think you can develop you own app and upload it without any certification. Docs for App development are here

1 Like

Very cool idea!

There is a beta endpoint for querying status:


But there is (not yet) the possibility to subscribe to changes using a callback url.

1 Like

I don’t understand the possibilities of MS Graph yet.
Would that need an OpenHAB-App for Teams or a Teams-Binding for OpenHAB?

Both ways could open interesting combinations beyond my first need…

OpenHAB in Teams could work like a chat bot - like habot native in Teams.
But Teams in OpenHAB would be better for presence-updates…

This is a brilliant idea, I would love to help you but all what I can contribute is tutorials how to use connectors and webhooks


https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-outgoing-webhook

I thought about a similar solution (light indicating ‘Do not disturb’) status and using presence indication from Teams or Skype. The reality is: I don’t not only use Teams for communicating, I do phone calls, Zoom Sessions, Skype and other stuff which won’t be reflected in my Teams status. What I do: if my office door is closed, it means “Please knock once, if I don’t answer I’m busy”. If the door is not closed, anyone can enter. This works very well for my homeoffice. I can’t see a comprehensive technical solution that does the same thing.

There exists an Windows store app called “Presence Light” which can directly control philips hue or LIFX lights according to your Microsoft Teams status.
(In my case this app had to be approvced by our IT admin - because it reads out sensible data from our Active Directory/O365.)

Additionally there exists an API tab in this app, where the status can be set via GET or POST requests to other systems like IFTTT. If it works also to set/change an OpenHAB item - I don’t know so far. I just got the admin approval.

1 Like

This fella integrated MS Graph into Homebridge -> DIY: Building a busy light to show your Microsoft Teams presence · Elio Struyf
Maybe somebody can pull some knowledge out of the plugin he wrote for Homebridge…

1 Like

(Adding back a reply that was lost due to the failed forum upgrade)

I use this Powershell script to update an openHAB Item with my Teams status. Instead of calling another script at the end I just contact the openHAB REST API to set the Item.

Item

String strTeamsMode "My Teams Mode"

PowerShell script

Get-Content $env:APPDATA\Microsoft\Teams\logs.txt -Wait -Tail 0 | ? { $_ -match "(?<=StatusIndicatorStateService: Added )(\w+)" } | % { if($matches[0] -ne "NewActivity") {& Invoke-WebRequest 'http://192.168.1.92:8080/rest/items/strTeamsMode' -Body $matches[0] -Method 'Post' -ContentType 'text/plain' }}

I have this working with OH2.5, with the work laptop in my local network (hence using the local IP address).

1 Like