Custom Components for Home Assistant.
Component to interface with Microsoft's Graph API on your organization's tenant. Currently only detects the authorized user's Microsoft Teams availability and activity but the possibilities are almost endless.
The Microsoft Graph integration allows Home Assistant to create sensors from various properties of your Office 365 tenant via Microsoft's Graph API. All queries are performed using the authenticated user's account and depend on the permissions granted when creating the Azure AD application.
Home Assistant authenticates with Microsoft through OAuth2. Set up your credentials by completing the steps in Manual Configuration and then add the integration in Configuration -> Integrations -> Microsoft Graph. Ensure you log in using a Microsoft account that belongs to your organization's tenant.
- If it doesn't already exist, create a directory called
microsoft_graph
underconfig/custom_components/
. - Copy all files in
custom_components/microsoft_graph
to yourconfig/custom_components/microsoft_graph/
directory. - Restart Home Assistant to pick up the new integration.
- Configure with config below.
You will need to register an application in Azure AD and retrieve the client ID and client secret:
- Register a new application in Azure AD
- Name your app
- Select "Accounts in any organizational directory (Any Azure AD directory - Multitenant)" under supported account types
- For Redirect URI, add:
https://<EXTERNAL_HOME_ASSISTANT_URL>/auth/external/callback
- Copy your Application (client) ID for later use
- On the App Page, navigate to "Certificates & secrets"
- Generate a new client secret and save for later use (you will not be able to see this again)
Then set the relevant permissions on the application on the API Permissions page. All of the following are required to function correctly:
- Presence.Read
- Presence.Read.All
- User.Read
- User.ReadBasic.All
Add the client id and secret to your configuration.yaml
:
# Example configuration.yaml entry
microsoft_graph:
client_id: YOUR_CLIENT_ID
client_secret: YOUR_CLIENT_SECRET
Finish setup in the UI through Configuration -> Integrations -> Microsoft Graph.
The Microsoft Graph sensor platform automatically tracks various resources from your Office 365 tenant.
There are 2 sensors that are added, both of which are enabled by default.
Entity ID | Default | Description |
---|---|---|
sensor.ms_teams_availability |
Enabled | Shows your availability (e.g. Available, AvailableIdle, Away). |
sensor.ms_teams_activity |
Enabled | Shows your activity (e.g. InACall, InAConferenceCall, Inactive, InAMeeting). |
See possible availability and activity values here.