A NodeJS solution to broadcast your Microsoft Teams presence to a Yeelight smart bulb. The app uses the Presence Api, which is available in Microsoft Graph, allowing to retrieve your presence. This could potentially allow someone to update the Yeelight light bulb from a remote machine they do not use, as long as it is on the same network.
A Yeelight bulb will help to make this work out of the box, but you can actually use any other bulb and update src/bulb.js
accordingly.
To run the application, you need the following:
- Node.js installed on your machine.
- Either a personal Microsoft account with a mailbox on Outlook.com, or a Microsoft work or school account.
If you don't have a Microsoft account, there are a couple of options to get a free account:
- You can sign up for a new personal Microsoft account.
- You can sign up for the Office 365 Developer Program to get a free Microsoft 365 subscription.
- Register an application in Azure Active directory
- Provide
user.read
&Presence.Read
permissions and get an admin concent - If you are a Microsoft employee, there is a procedure for getting this, contact me (salowenh) for assistance
- Provide
- Clone the repo
- Rename the
.env.example
file to.env
- Edit the
.env
file and make the following changes.- Replace YOUR_APP_ID_HERE with the Application Id you got from the App Registration Portal.
- Replace YOUR_APP_PASSWORD_HERE with the password you got from the App Registration Portal.
- Replace BULB_IP with the Yeelight local IP
- Set INTERVAL_SECONDS with the required presence query interval, default is 2 minutes
- On you CLI, run the following to install dependencies:
npm install
- On you CLI, run the following to run the application
npm start
- Open a browser and browse to
http://localhost:3000
- Sign in
- Hit the
Start
button on the top bar - As you Teams presence becomes " " (or equivalent), the bulb will turn on in a red light.
Node makes it super easy to turn applications into a docker image
- Make sure Docker daemon is running
- On your CLI, run the following to create a docker image
docker build -t on-air .
docker run -p 3000:3000 -d on-air
The output is the container ID (or look it up by running docker ps
), use it to view the logs
docker logs <ID>
Now everything should be running. Feel free to open an issue if you encounter any difficulties Code contributions are also welcomed
The application is based over this MS Graph training
- Isaac Levin has a similar WPF project for Windows which works with Philips Hue
- Toggle Tasmota Plugs via Bash Scripts based on Camera Status
- Ruby / C based on air camera status