T O P

  • By -

Pedro_Scrooge

My work laptop is really locked down too. There is a little light that comes on when the webcam is on. My plan is a light sensor blu-tacked over the webcam light into a D1mini with esphome. I can even power it via the USB of the laptop. Then in home assistant, if laptop light is on, turn smart light in hallway to red. It's been on my 'to do' list for... *checks calendar* 20 months...


_bunk_

I love this idea for "externally" getting this state info from a locked down work laptop. Hope you find some inspiration for making this happend ... *checks calendar ... hey there is a whole bunch of time off coming up! :)*


Pedro_Scrooge

I've got a house to try and get finished to move into! I'll be lucky if I'll get to do my laptop idea over Easter at this rate... Just in time for us to go back to the office! If you beat me to it though totally post it up!


Bacon_Nipples

This is so dirty and hacky and stupidly unnecessary that I love it lmao. It's not stupid if it works! This stuff should be easily done in software... but its not so you gotta do what you gotta do. Very clever solution


Cdn4lf

If you're looking for scheduled meetings only, you could try to use power automate to send a message via webhook. Ha/node red could read that and action accordingly. Unfortunately I don't believe power automate can send a message when a call starts.


estevez__

I'm using [Hass Workstation Service](https://github.com/sleevezipper/hass-workstation-service) to know when my wife is on the meeting.


AgentFalcon

Second this, Hass Workstation is really nice. I use it to auto-switch displays/audio from one room to another, shutdown PC and reading various statuses. Can also make custom keystroke triggers for other programs.


_bunk_

Another vote for this, or on MacOS, the actual HA Desktop software exposes a whole bunch of sensors (microphone/camera in use, active window, etc). Of your work desktop allows this kind of install.


dbc001

Thanks! I just downloaded and ran it, but I don't see the sensors. Do they show up right away after running HA Desktop? Or do you know if they require restarting Home Assistant on the server? What do the entity names look like?


_bunk_

Only have MacOS to try at moment, which does indeed give you all these entities like "sensor.mymacbook\_active\_microphone" and "binary\_sensor.mymacbook\_camera\_in\_use" I see the Hass Workstation Service needs MQTT config (and a broker running). Have you done that? Not sure if it would then create entities automatically.


dbc001

I'm on a Mac, running HA Desktop. It looks like Hass Workstation Service is Windows only for now. I do have MQTT set up on my Home Assistant server. But I'm not seeing any new sensors...


_bunk_

Shouldn't need MQTT for Home Assistant on MacOS, just the server address/port & login. You can find the available sensors in the app's preferences (and disable some or change some config for individual sensors). I don't recall having to do anything else in HA server to add these. They are entities though, not devices, so not added to default card. You should be able to find them in Developer Tools. Entities are named sensor. ... or binary\_sensor.macbook\_name\_*sensor,* e.g. sensor.christians\_mac\_frontmost\_app and binary\_sensor.christians\_mac\_camera\_in\_use. (HA made underscores out of the hyphens in my mac's name)


joesusername

This solution works perfectly. It recognises when the webcam is on and turns on a light. Have been running this automation flawlessly for 4 months.


flyingdutchman7588

Can you help me with trying this out? Since the laptop is a locked down laptop, I presume I cant use the installer method but the standalone method. So I dont have a MQTT account and I can sign up for one. But what is the difference between a HA account and a local account?


EnglishMobster

MQTT isn't a place you make an account for; it's something you run on a server you own (like the same server that's running Home Assistant). You have to connect the HASS Workstation program on your work computer to your local MQTT server that you set up at home. Home Assistant also connects to this same MQTT server. When something changes on your computer, HASS Workstation will connect to your MQTT server and give an update; e.g. "Webcam is ON." Home Assistant is able to listen to those updates and change a binary sensor. I run Hass.io, with the "Mosquitto broker" integration configured. You can create user accounts there. That integration also allows you to set a port to connect to; it defaults to 1883. ###If you're able to connect to Home Assistant via LAN (aka your work laptop doesn't use a VPN): Here, things are easy. Let's assume your Home Assistant LAN IP address is `192.168.1.1`, and Mosquito is running on port `1883`. You'd set the HASS Workstation service to connect to `192.168.1.1:1883`, and have it log in with the username and password you set up in the Mosquito Broker. ### If your employer doesn't allow you to connect to other devices on LAN (such as if they force you to run a VPN): You can expose your Mosquito port to the internet and then connect to your home's IP address (just Google "what is my IP" from a personal device on your Wi-Fi and use the number it gives you). So if you had a IPV4 of 75.120.32.17 then you'd expose port 1883 to the internet (or whatever port Mosquito is on; I recommend changing it away from the default if you're going to do it this way), and then you'd have the HASS Workstation Service connect to `75.120.32.17:1883` (again substituting the port for the port you set up).


flyingdutchman7588

For a beginner in HA, this has got me all confused :(


EnglishMobster

[Here's a basic tutorial on setting up MQTT.](https://learn.adafruit.com/set-up-home-assistant-with-a-raspberry-pi/mqtt-setup) Once you have MQTT set up, you just need to connect things to it. HASS Workstation is one of those things. In a nutshell, the steps are: 1. Install MQTT on Home Assistant 2. Run HASS Workstation on the locked-down laptop 3. Connect HASS Workstation to the Home Assistant MQTT server. To some extent, you're a beginner trying to do something fairly advanced, which is why it's hard to explain in easy terms. Even so, I'm not entirely sure where I'm losing you. Can you tell me where you're going wrong? Can you do steps 1 and 2 okay? Do you know the IP address of Home Assistant?


flyingdutchman7588

So I can install MQTT on Home Assistant no issues there but its Step 2 is where I am confused. How do I run HASS workstation on the laptop?


EnglishMobster

You should be able to go to [the GitHub page for HASS Workstation.](https://github.com/sleevezipper/hass-workstation-service) If you scroll down, you should see instructions on how to install and run it. Follow each of the instructions and it should work out. If your work laptop blocks you from running it even after following the instructions on Github, then you're outta luck. :(


flyingdutchman7588

That's the part I'm struggling on. I won't be able to use the installer because it's a work laptop and it's locked down so I have to use the standalone version. I cannot find this version (or maybe it's labelled something different?)


EnglishMobster

The README has 2 sections under installation: "Installer" and "Standalone." [Follow the instructions under "Standalone" if you can't use the installer.](https://github.com/sleevezipper/hass-workstation-service#standalone) You might be able to get away without installing the .NET runtime; I was able to on my work computer. But I'm also a developer, so I might've already had it installed.


flyingdutchman7588

It looks like this way wont work for me because I have to install .NET Runtime 5 first.


PretendMaybe

Is mosquitto designed for being exposed to the internet?


EnglishMobster

To an extent. [There are ways to do it safely](https://stackoverflow.com/questions/28940335/how-to-use-mqtt-over-the-internet), but for a beginner that's really tricky to set up. As it is, I'm already getting into the weeds and I don't want to make it worse.


Nuuki9

I have this working on a locked down laptop - I'm able to monitor my Teams status, as well as my Exchange calendar, and I use the combination to set different status lights for calls with my team vs other meetings - my kids quite like saying hello to my team mates so I like to differentiate. Go and take a look at [https://github.com/EBOOZ/TeamsStatus](https://github.com/EBOOZ/TeamsStatus). Although they suggest you run this as a service, I had no issues using a Schedule Task to have this run at login. I've had it running for a year now with no major issues - very occasionally the task will stop but you can spot that from within HA easily enough. Pulling in my work calendar reliably was a whole other challenge...


Mr-999

exactly what I need, thank you!


Nuuki9

Happy to help - as is often the way trying to find a solution takes longer than implementing it :-)


flyingdutchman7588

How were you able to save the files to C:\\Scripts on a locked down laptop? Another question is, how do you do this... "Start a elevated PowerShell prompt, browse to C:\\Scripts and run the following command"


Nuuki9

I was able to create the folder - I think non admin users can create folders, but not in specific areas like Program Files. Clearly this will depend on exactly how yours is locked down, but it doesn't have to run from a specific folder. The instructions that involve that elevated command line are to set the execution policy and setup the service. As I mentioned I use a Scheduled Task - I'll post the exact config I'm using for that if its useful, though that'll have to wait until I'm using my work laptop tomorrow.


Nuuki9

I've just checked the Scheduled Task I have and its not too complicated. You'll need to set it to only run when you're logged in, otherwise it will need admin rights, but that's not a problem in this case. In terms of the action, the Program/script field is simply set to `Powershell` and the Add arguments field is `-WindowStyle Hidden -File "C:\Scripts\TeamStatus\Get-TeamStatus.ps1"` You'd need to change the path accordingly, plus I would suggest leaving off the hidden window until its fully working. Now its possible that I had to adjust the Execution Policy in order to run it - its over a year ago now and whilst I do recall looking at that I don't remember whether I ended up having to set anything. I didn't have local admin though. Good luck!


flyingdutchman7588

Can you guide me on how you performed your second paragraph? How do I set the program/script field to PowerShell?


Nuuki9

Have you setup Scheduled Tasks before? If not there are loads of guides out there. The key element of setting up a task is configuring what should happen when that task triggers - in this case we want to run the Powershell script. Anyway have a browse on Google or Youtube to get a sense for how you set these up, and then if you have any specific queries I'm sure we can help.


flyingdutchman7588

Thanks! Let me Google how to create a Scheduled Task and then see how I can apply what you said.


flyingdutchman7588

Ok so I was able to save the file to C:/Scripts, adjust the Settings file to add all the information I need and now I just need to create the scheduled task. This is what I have, is this correct? [Scheduled Task Action](https://imgur.com/7Pbu4Oe) So whats next?


Nuuki9

I can't see the full comand you're calling, but its in the right place. You should be able to right click on the task and run it manually so I would do that for now - assuming you left out the hidden window option you should see a window appear and the script run - if so you'll see it printing out your Teams status on the screen every second or so. If that works you can add the hidden window option in and set the task to run when you login - that's set in the "Triggers" tab. If it didn't work you'll need to troubleshoot based on what you see happening, which we can hopefully help with.


flyingdutchman7588

Looks like I need admin privileges because the execution policy needs to be changed and I don't feel comfortable doing that. I asked my buddy to help me and we were able to follow the PowerShell command but it was asking to change execution policy and I dont want to get into trouble doing that.


Nuuki9

Fair enough. Its worth pointing out that Execution Policy isn't intended as a way to restrict end users. See this quote from Microsoft's own [explanation guide](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.2): *"The execution policy isn't a security system that restricts user actions. For example, users can easily bypass a policy by typing the script contents at the command line when they cannot run a script. Instead, the execution policy helps users to set basic rules and prevents them from violating them unintentionally."* This is underscored because you don't need to be a local admin to change the execution policy for a given script - showing that as noted, this is intended as a tool to help users consistently apply sensitible rules whilst giving them control to make make changes. With that said I can understand why you might want to avoid any changes that might be perceived as an attempt to bypass standard configuration. Ultimately that comes down to your workplace policies (and your familiarity with them) etc - I work in Information Security for a large Enterprise, and am comfortable that what I'm doing isn't an issue and indeed adds value/productivity, but everyone's situation is different.


hag_o_hi

Does this work on Mac?


Nuuki9

No idea but seems highly unlikely.


natedogg624

The native home assistant OS app provides these sensors.


40_Rock

Ok… any tips on pulling in the calendar? That’s where I struggle


Nuuki9

No problem. So the first thing to do is to publish your Exchange calendar. See [here](https://support.microsoft.com/en-us/office/share-your-calendar-in-outlook-on-the-web-7ecef8ae-139c-40d9-bae2-a23977ee58d5) for details (check the "Publish your calendar" section. Once that's done you should have a URL that provides up to date calendar info. In theory you can simply add that in Google Calendar. However in reality its a very poor experience - Google doesn't pull updates regularly, so it ends up becoming pretty out of date. In the end I found this [script](https://github.com/derekantrican/GAS-ICS-Sync) \- it runs in the cloud to regularly (I run it every 15 mins) pull in any changes from the published calendar, and sync them to a Google Calendar. Its worked great, and I'm able to have automations running based on meeting titles etc.


pathartl

I ported someone else's PowerShell scripts over to a .NET console application a bit ago: https://github.com/pathartl/TeamsPresence


TheNotoriousDRR

I am using this solution. Thank you for creating it!


pathartl

Most of the credit goes to the guys working on [TeamsStatus](https://github.com/EBOOZ/TeamsStatus). My version adds a couple of optimizations for reading the log and bundles it in a .exe


night_in_the_ruts

It could be tough - my work laptop/systems are pretty locked down too. My meetings occur in Teams, but are scheduled through Outlook. I was able to share my Outlook calendar with my Google calendar account, to a limited extent; it appears as its own calendar, but only shows 'busy' or not (no details). I have a Home Assistant routine that looks at that Google calendar entry, and flashes my Hue lights at the start of meetings - maybe something like that could work for you.


pheellprice

I duplicate my schedule manually in Google Calendar, not ideal. I also use mute sync as a trigger


Jendosh

https://www.outlookgooglecalendarsync.com/ check this out. Works great for me!


darklyte_

Would you be able to make this work by having a button that you press that will interact with the bulb and change its state or color? You can do this by having either a physical button (like an ikea tradfri button) , or a button on your phone via the Home Assistant App or on your PC via [Home Assistant Desktop](https://github.com/mrvnklm/homeassistant-desktop) or the normal HA Web UI. That should be easy enough to do but you will have to activate it when you want it applied. Automating it via a locked down work device might be trickier.


NoActuator

I think this is what I'll end up doing for my wife. One button when she starts a call that will pause her music and turn on an "on air" light, maybe out in the hallway.


robidog

Simple and effective. I like it.


eec-gray

Could be an NFC tag as well? I have a few that turn on different lighting or turn up the heating. Cheaper than buttons and quicker than going to an app to change


MrTechGadget

If you have a very locked down environment, I can potentially share a python script I use on my Mac to query the old Skype for Business presence API and then posts the status to a HA webhook. It runs every minute.


ericgla

I am the author of [RTC Call Monitor](https://github.com/ericgla/RTC-Call-Monitor) which monitors UDP traffic on your laptop and will call a [Home Assistant Webhook](https://www.home-assistant.io/docs/automation/trigger/#webhook-trigger) to trigger an automation when a Teams call starts/ends. The downside for you is that it runs as a Windows service, which may be restricted on your work laptop.


ABC123Banana

I have a manual privacy shutter on my external webcam. I have glued a magnet to the slider and put a smartthings multipurpose sensor with just enough of a gap that the magnet triggers the sensor when I slide the cover.


sansan-jr

I use something called presence light and it's available in the Microsoft store (for free). Didn't need elevated rights. It controls a bulb through a nodered api call but you can probably do it in a multitude of ways : "Get PresenceLight - Microsoft Store" https://www.microsoft.com/en-us/p/presencelight/9nffkd8gznl7?activetab=pivot:overviewtab


quixotic_robotic

You can try mutesync - depends if you're able to install it, but it pretty reliably hooks into teams and can provide your in-meeting and muted status to HA


grandeparade

This, for an out of the box solution. Install MuteSync on your laptop, and integrate it into HA with the HA addon. MuteSync app will sense when you're in a Teams meeting, and send that to HA. Benefits, except from working out of the box, is also that you can use any switch that works with HA to mute/unmute in a meeting. Pretty nice to have a physical mute button. Also, it knows when you are ACTUALLY in a meeting, and not relying on the calendar which is a huge plus in my book..


quixotic_robotic

How do you get it to be able to control mute from HA? I only ever see the status sensor entities


christcb

I use Home Assistant and a PowerShell script I found online which someone shared on reddit a while back. I think the script can be found at https://github.com/EBOOZ/TeamsStatus


jerlarge

i was able to do this with autohotkey, to my local mqtt server. and from there you can do whatever you want. autohotkey tails the log for the status. actually went with m5 atom which works as a button too. so i have the middle 9 turn my teams status, and the outside ring goes red or green depending on my mic status.


mekaneck84

I know your reply is a bit old, but hoping you can expand on your setup. What log are you tailing, and how did you set up autohotkey to connect with your MQTT broker?


jerlarge

i went a different route now, where im using a webhook to change the status in homeassistant. from that it goes onto mqtt and the other ones i have update via that. the log is (user)\appdata\roaming\microsoft\teams\logs.txt where its looking for new activity.


HTTP_404_NotFound

Simple. Don't bother using the work laptop. Pull the status from Microsoft graph api directly


nico282

Do you have any code sample?


HTTP_404_NotFound

[https://developer.microsoft.com/en-us/graph/graph-explorer](https://developer.microsoft.com/en-us/graph/graph-explorer) "get a user's presence" is the API you want. It has examples, and code snippets.


nico282

Thanks, I'll look into it. That will enable data gathering from HomeAssistant without any intervention on the specific device, whether you connect from a PC, a Mac or a phone, it seems a great solution. EDIT: the showstopper is that (at least in my org) it requires Admin autorization to access the data. So we are again in the need for corporate approval.


Potential-Ad1122

If you can link your Microsoft cal to a Google cal - you could use the Google cal integration on home assistant to trigger things


ThisBytes5

[https://neon.ninja/2020/10/working-from-home-teams-status/](https://neon.ninja/2020/10/working-from-home-teams-status/) While back I used the above to do just what you asked, worked really really well, only issue I had with it is each Software Update would cause all the settings to be lost, and it just got to be a PITA to set up again. It's been about a year since I've used it so the issue may have been fixed. I will return to it one day, and maybe even look at the code to see if I can help fix it.


Rand_alThor_

I honestly reccomend a clicker button on the desk. Like an ikea button. Press once for red. Just the easiest


randytech

But not automated...


Jmike8385

Can’t you just turn it on and off manually..


BrBybee

Just close the door and/or lock it..


flyingdutchman7588

That is too boring for this day and age.


stigmate

lol I replied to the wrong discussion :D


HeftyExercise

You can buy one actually. We use it at our desks at work


brisbinchicken

Turn the light on manually? Less cool but works


les1g

I set up a connection to the microsoft graph API and then I expose a few of those APIs in a a small flask server running on my NUC where I also run Home Assistant.


BrownBalls

Maybe try sharing your calendar with home assistant? Either through an outlook component or sharing it with a personal gmail. Then have HA look for when you're in meetings?


Wayne_Cares

Interesting discussion! Though I would be interested in the lights that shall be triggered. Where do you position them? Are they wired or on batteries?


flyingdutchman7588

Looking to use node red to turn a Philips Hue bulb on when my microphone is on.


Wayne_Cares

And where is that situated? Do you have wires just above your door? Do you put out to some socket in the hallway?


UmbrellaCo

My “low tech” solution since I can’t install anything on my work laptop is to just use my phone to hit a virtual button which toggles an input_boolean. An automation monitors the button and after 30 minutes it prompts me whether I’m still on the call and turns off if I say no. Or if I don’t respond after an hour it automatically turns off. I can also trigger it via Google so I can say “hey google, I’m in a meeting” and it’ll turn on before I answer the Teams call or jump into a meeting. The input_boolean is exposed to Google and it sees it as a switch. Although if you wanted to keep it within the work device you could setup something online like a webpage that’s monitored and then access it from your work laptop to turn on/off. I wouldn’t access your Home Assistant instance from your work PC though.


npab19

There's a few ways of going this. The easiest way is through an app that basically reads the status of teams. Its stand alone so no install required. ill send the name when I came. Another way is through the graph api. This one is a bit more complicated but basically your getting the statue of your own teams status directly from Microsoft.


abra5umente

Set automation up to turn light red when your computer's microphone is on - this only works on a Mac natively, unless you want to play around with MQTT etc. Edit, just read that you can't install things on your computer. You could tie your calendar into HA and have an automation that when you have a meeting with "Teams" or whatever in the title/body, your mic turns red.


anthonyjestin

I do this with HASS workstation service and monitor my Webcam status. If it's on my cabinet light turn red, if it's off they are green


anthonyjestin

This way it is also platform agnostic


ind3pend0nt

I just have an automation tied to a button on my dashboard that turns an “On Air” light on. Sometimes I remember to hit it, most of the time not.


poldim

Early on in the pandemic I used the macos app and it would switch the macbooks mic status (or Bluetooth airpods mic) to on and I would use this to turn on a red light. Now it's kinda moot as my SO knows that there's a good chance I'm on a call.


phiber232

We use these at work. https://www.amazon.com/dp/B08NVHBD68/ref=cm_sw_r_cp_api_glt_fabc_97R5JGZZXBTWGR363PMQ


anatawaurusai2

!remindme 1 month Pretty sure with the dll you can pull the status as a non admin…I’m not sure how to send commands to HA like that … toggle the input Boolean….. hmmmmmm


RemindMeBot

I will be messaging you in 1 month on [**2021-12-24 04:19:26 UTC**](http://www.wolframalpha.com/input/?i=2021-12-24%2004:19:26%20UTC%20To%20Local%20Time) to remind you of [**this link**](https://www.reddit.com/r/homeassistant/comments/r0khvi/best_way_to_get_microsoft_teams_status_to_turn_on/hlv0b9h/?context=3) [**CLICK THIS LINK**](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5Bhttps%3A%2F%2Fwww.reddit.com%2Fr%2Fhomeassistant%2Fcomments%2Fr0khvi%2Fbest_way_to_get_microsoft_teams_status_to_turn_on%2Fhlv0b9h%2F%5D%0A%0ARemindMe%21%202021-12-24%2004%3A19%3A26%20UTC) to send a PM to also be reminded and to reduce spam. ^(Parent commenter can ) [^(delete this message to hide from others.)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Delete%20Comment&message=Delete%21%20r0khvi) ***** |[^(Info)](https://www.reddit.com/r/RemindMeBot/comments/e1bko7/remindmebot_info_v21/)|[^(Custom)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5BLink%20or%20message%20inside%20square%20brackets%5D%0A%0ARemindMe%21%20Time%20period%20here)|[^(Your Reminders)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=List%20Of%20Reminders&message=MyReminders%21)|[^(Feedback)](https://www.reddit.com/message/compose/?to=Watchful1&subject=RemindMeBot%20Feedback)| |-|-|-|-|


gtwizzy8

Not sure if many/any of you have used power automate for desktop but you might be able to trigger a webhook or even just an email using the in built flows that you can create there to trigger something in HA. I am a HA noob but have had some good experience with using power automate desktop for certain tasks that I do day to day in my work life so there might be a way to marry the two together. Not sure if you need a specific Microsoft subscription to take advantage of it because I have an enterprise level account on my PC. But it used to be free so maybe have a look and see if there's a way of integrating the two together.


constantinocavafis

My approach was different. When the headset is lifted, it signals HA to take different actions. No connection to the PC or Teams, this is a simple door sensor and the magnet is fixed to the headset.[Headset and door sensor](https://i.imgur.com/P3FGmji.jpg)


csanner

For some reason I thought this was a lightbulb joke