jeroenterheerdt / presence-light-ha-api

Creates an API bridge to Home Assistant for use with the simplified Custom API interface in Presence Light

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Presence Light Home Assistant API Bridge

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.

How to use

  1. Get a Long-lived Access Token from your Home Assistant installation
  2. 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 use switch.office_status_light in mine.)
    • HA_TOKEN: The long-lived access token you generated earlier
  3. 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
  4. 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. Example Custom API Config

API Behavior

  • /off: Turns the entity off
  • /on: Turns the entity on

About

Creates an API bridge to Home Assistant for use with the simplified Custom API interface in Presence Light

License:MIT License


Languages

Language:Python 87.5%Language:Dockerfile 12.5%