Creates a FastAPI bridge to Home Assistant for use with the simplified Custom API interface in Presence Light.
Fork from https://github.com/loganjohnlong/presence-light-ha-api. Instead of changing the color of a light, this fork just turns an entity (for example a switch, but might also be a light) on or off.
If you are looking to pass along the actual Teams status to Home Assistant, please see https://github.com/jeroenterheerdt/presence-status-ha-api.
- Get a Long-lived Access Token from your Home Assistant installation
- Set the following environment variables in Docker:
- HA_IP: The IP Address or FQDN of your Home Assistant installation that the Docker container will be able to access
- HA_PORT: The port that your Home Assistant installation runs on (Normally, this is
8123
) - HA_ENTITY: The entity name of the light you want to use in the
<domain>.<name>
format. (I useswitch.office_status_light
in mine.) - HA_TOKEN: The long-lived access token you generated earlier
- Run the Docker container with the command
docker run -d --restart=unless-stopped -e "HA_IP=<your-ip>" -e "HA_PORT=<your-port>" -e "HA_ENTITY=<domain>.<name>" -e "HA_TOKEN=<your-token>" --name=presence-light-ha-api jeroenterheerdt/presence-light-ha-api
- Set the Custom API values in Presence Light. You should replace the IP and port seen below with the IP and port of this Docker container (not your Home Assistant installation). All calls in this application use POST.
/off
: Turns the entity off/on
: Turns the entity on