{"id":18402593,"url":"https://github.com/adamskt/on-air-light","last_synced_at":"2025-10-09T13:34:19.532Z","repository":{"id":144906832,"uuid":"269218176","full_name":"adamskt/on-air-light","owner":"adamskt","description":"A way to make a light change colors because of your MS Teams presence info","archived":false,"fork":false,"pushed_at":"2024-07-09T21:19:16.000Z","size":40,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-07T16:21:08.781Z","etag":null,"topics":["dotnetcore3","hubitat-hub","iot-application","microsoft-graph-api"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adamskt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-03T23:46:33.000Z","updated_at":"2020-06-15T00:09:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a276aa7-98da-409d-ae4d-42218231bc7f","html_url":"https://github.com/adamskt/on-air-light","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamskt%2Fon-air-light","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamskt%2Fon-air-light/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamskt%2Fon-air-light/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamskt%2Fon-air-light/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamskt","download_url":"https://codeload.github.com/adamskt/on-air-light/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240593178,"owners_count":19825939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnetcore3","hubitat-hub","iot-application","microsoft-graph-api"],"created_at":"2024-11-06T02:42:54.041Z","updated_at":"2025-10-09T13:34:14.512Z","avatar_url":"https://github.com/adamskt.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"- [1. Introduction](#1-introduction)\n  - [1.1 Why?](#11-why)\n  - [1.2 What?](#12-what)\n- [2. Setup](#2-setup)\n    - [NB: No real light standards exists](#nb-no-real-light-standards-exists)\n- [3. Building](#3-building)\n- [4. Acknowledgements](#4-acknowledgements)\n\n# 1. Introduction\n\n## 1.1 Why?\n\nBecause everyone I know is currently working from home, we need a way to tell our families when we can \nand can't be interrupted. Since that generally lines up with my MS Teams presence information, I decided \nto see if I could bridge the gap between Microsoft Graph and the Hubitat Maker API with a .Net Core \nConsole App (and possibly an Azure Function).\n\n## 1.2 What?\n\nThis is a .Net Core 3.1 CLI that polls MS Teams presence information for an AAD/MS Teams account and then \ntells a cloud-enabled Hubitat Elevation API to change the color of a IoT RGB light bulb.\n\n# 2. Setup\n\n1. Register an application in AAD in the Azure Portal.  See [this tutorial](https://docs.microsoft.com/en-us/graph/tutorials/dotnet-core?tutorial-step=2)\n\n2. Setup the Hubitat [Maker API](https://docs.hubitat.com/index.php?title=Maker_API).\n\n3. Edit the appsettings.json or user secrets with values appropriate to your setup. Settings file structure:\n  ````javascript\n{\n  \"Azure\": {\n    \"UserId\": \"00000000-0000-0000-0000-000000000000\",   // The AAD Object Id of the user you want presence information for.\n    \"TenantId\": \"00000000-0000-0000-0000-000000000000\", // The Tenant Id of the AAD organization you want to query.\n    \"Scopes\": \"Presence.Read;Presence.Read.All\",        // The explicit rights your AAD app registration will use to query for presence information.\n    \"AppId\": \"00000000-0000-0000-0000-000000000000\"     // The application or client Id of the AAD app registration.\n  },\n  \"Hubitat\": {\n    \"Id\": \"{integer}\",                                  // Hubitat cloud id (only if not using a local network address)\n    \"Token\": \"00000000-0000-0000-0000-000000000000\",    // The Hubitat Maker API access token \n    \"NameOrIp\": \"192.168.1.15\",                         // The local DNS name or IP address of your Hubitat.\n    \"DeviceName\": \"On-Air Light\"                        // The Label (Name) of the Hubitat device you want to send command to.\n    \"StatusMap\": {                                      // Dictionary mapping MS Teams presence values to commands to send to the IoT light.\n      \"Available\": \"presetGreenFade\",\n      \"AvailableIdle\": \"presetGreenFade\",\n      \"Away\": \"presetYellowFade\",\n      \"BeRightBack\": \"\",\n      \"Busy\": \"presetRedFade\",\n      \"BusyIdle\": \"presetRedFade\",\n      \"DoNotDisturb\": \"presetRedFade\",\n      \"Offline\": \"\",\n      \"PresenceUnknown\": \"\"\n    }\n  }\n}\n  ````\n\n### NB: No real light standards exists\n\nThe actual implementation details of the commands your IoT light bulb may require are not standardized, so you may have to make changes to the flow or commands issued through the Hubitat in order to get this to work.  The lights I used in this project were a [\"MagicLight Smart Light Bulb (60w Equivalent), A19 7W Multicolor 2700k-6500k Dimmable WiFi LED Bulb, Compatible with Alexa Google Home Siri IFTTT\"](https://www.newegg.com/magiclight-mlight-wf-7w-3p-wifi/p/35B-0065-00010?Item=9SIAJ09AFU1364)\n\n# 3. Building\n\n1. Clone the repo\n2. Compile. Run:\n  ````console\nC:\\\u003e dotnet build\n  ````\n3. Generate binaries. Run:\n  ````console\nC:\\\u003e dotnet publish\n  ````\n4. Run the binary.  When prompted, visit https://microsoft.com/devicelogin and enter the displayed code to grant use of your AAD account to query for MS Teams presence information.\n\n# 4. Acknowledgements\n- This [blog post](https://developer.microsoft.com/en-us/graph/blogs/microsoft-graph-presence-apis-are-now-available-in-public-preview/?WT.mc_id=-blog-scottha)\n- This [wonderful framework](https://github.com/CamSoper/puppet)\n- This [other thing](https://github.com/isaacrlevin/PresenceLight)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamskt%2Fon-air-light","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamskt%2Fon-air-light","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamskt%2Fon-air-light/lists"}