Issue with creating sensors - log attached · Issue #2 · EBOOZ/TeamsStatus (github.com)
A potential workaround for self-referencing template sensors would be to have the PowerShell script set the value of an input helper (input_text or input_select). For the UI etc. you could then (also) create a template sensor that inherits the input helper entity.
Hey guys,
this looks amazing! Unfortunately my organisation also doesn’t allow access to the API and I also don’t have elevated rights on my machine. The elevated rights are needed to access the teams logfile, right?
So, without these, it is not going to be possible to get the status from teams?
I have it running without admin rights. https://github.com/EBOOZ/TeamsStatus requires admin rights only because he wants to use a service daemon. Another option is to take the guts of his script and schedule tasks via task scheduler.
- Download https://github.com/EBOOZ/TeamsStatus/blob/ec83df37311f26493f3034c1303f73e2d177f673/Get-TeamsStatus.ps1 and https://github.com/EBOOZ/TeamsStatus/blob/ec83df37311f26493f3034c1303f73e2d177f673/Settings.ps1
- Place into a folder in your user directory, wherever you wish (desktop, docs, whatever)
- Edit settings as needed
- Create the entities in Home Assistant as documented by EBOOZ
- Test the script by running Get-TeamsStatus.ps1 with PowerShell. Ctrl+c to kill it
- Open task scheduler - you can create tasks as you without any admin rights required, in most orgs (may depend on GPO)
- Set action to start a program, “powershell.exe”. Set arguments to be -WindowStyle Hidden -File “C:\Users\UserID\pathToFolder\Get-TeamsStatus.ps1”
- Set triggers; I did two triggers, one at login, and one at workstation unlock. Make sure it won’t run if already running, make sure it runs on battery, and on settings tab make sure it won’t stop the task.
Hopefully you’re familiar with task scheduler… if not, google.
Awesome man!. I’ll try this out either today or tomorrow!
Thanks for the info.
So, for what it’s worth, I created a pull request on EBOOZ’s repo to add in a webcam monitor capability with registry key. Basically it monitors the following key which is “0” if the camera is on (replace username):
Get-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam\NonPackaged\C:#Users#USERNAME#AppData#Local#Microsoft#Teams#current#Teams.exe -Name LastUsedTimeStop | select LastUsedTimeStop
You can add in to his script in the elseif block at line 136.
ElseIf ($TeamsActivity -like "*Pausing daemon App updates*" -or `
$TeamsActivity -like "*SfB:TeamsActiveCall*" -or `
$TeamsActivity -like "*name: desktop_call_state_change_send, isOngoing: true*") {
$webcam = Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam\NonPackaged\C:#Users#$UserName#AppData#Local#Microsoft#Teams#current#Teams.exe" -Name LastUsedTimeStop | select LastUsedTimeStop
if ($webcam.LastUsedTimeStop -eq 0){
$Activity = $lgInACallWebcamOn
$ActivityIcon = $iconInACall
}
else {
$Activity = $lgInACall
$ActivityIcon = $iconInACall
}
Write-Host $Activity
}
In settings, replace line 18 with these two lines:
$lgInACall = "In a call - camera off"
$lgInACallWebcamOn = "In a call - camera on"
Hello all!
As my teams state from the log file no longer works, I have built a python application to fetch the teams state directly from MS Graph api.
Its available as docker image!
Have a look at here:
@EBOOZ Thanks for your great PowerShell solution for Teams. I have used this one to control my sonos in my home office. It will pause and then resume after a call/meeting. Works splended!
I have creeated a Gist for others if they are interested: https://gist.github.com/mark-veenstra/01aeccf357ced3c5be048f6b2c704e97
This is much better than running as a service or the Azure solutions for me. With the service if my computer sleeps the service seems to hang and requires a restart. For the Azure service (though VERY good too) I only want to monitor my laptop and not all my devices. The “In a Call” status I tend to do a lot of automations with and if I am doing the Teams call on my phone I don’t want those automations to occur as I am most likely not home.
Yep, same for me. Just keep in mind if your computer is awake but locked, the scheduled task is still running - so getting on teams on your phone will change status and your PC will relay that to Home Assistant. You may be able to somehow set the task to be killed on PC logoff or lock, or just sleep your PC in those cases.
Yes but it doesn’t register “In a Call.” This is where my automations are derived from.
I just pushed RTC-Call-Monitor to Github and may be an alternate solution.
I end up using multiple conference services during my work day, and rather than have an integration for each service, I wrote an application that monitors the UDP packet rate along with network block matching to detect a call for most of the popular web conference providers.
This looks great, I’ll try it later
ReadMe mentions modifying appsettings.config do you mean appsettings.json?
Can this just be run from windows scheduler to get it to start at boot?
Regards
Simon
Follow his instructions here: Microsoft Teams Status - Feature Requests - Home Assistant Community (home-assistant.io)
There was a mistake in the readme. The correct file is appsettings.json. I’ll be adding support to install the app as a windows service in the next day or so.
That sounds good, I’ll propbly hold off until then to try it then.
Thanks
Simon
I am very interested in this also. You may want to spin off another conversation thread. Also interested in your code that updates HA.
I’ve been using this for about a month and it works well, but I am getting an issue where my status is not going back to ‘Not in a call’ when I close out a call. I have to kill Teams and reopen it to get things synced again. Has anyone run into this?
“access denied”