I’ve been tinkering with getting Microsoft Teams status into Home Assistant and thought it might be useful for others as well.
I solved it by using PresenceLight:
I set it up to send a webhook to Home Assistant. I added this to all the fields under “Custom API”:
URI: http://homeassistant.local:8123/api/webhook/my-super-secret-webhook-id
Body: {"availability":"{{availability}}","activity":"{{activity}}"}
In Home Assitant I added this
template:
- trigger:
- trigger: webhook
allowed_methods:
- "POST"
webhook_id: my-super-secret-webhook-id
sensor:
- name: "Teams status"
unique_id: sensor.teams_status
state: "{{ trigger.json.availability }}"
icon: mdi:microsoft-teams
- name: "Teams activity"
unique_id: sensor.teams_activity
state: "{{ trigger.json.activity }}"
icon: mdi:microsoft-teams