A server logs guests into Home Assistant automatically. For more info, see https://nathanorick.com/ha-automatic-guest-login.
Here are some example snippets to help you get started creating a container.
You can copy the following into a docker-compose.yml
file locally, change the environment variables to match your setup, then run docker-compose up
to start the service.
---
version: "3"
services:
ha-auto-guest-login:
image: norick/ha-auto-guest-login:main
container_name: ha-auto-guest-login
environment:
- CLIENTID=http://homeassistant.local/
- URL=http://homeassistant.local
- DASH=lovelace-guest
- USER=username
- PASS=password
ports:
- 80:80
restart: unless-stopped
docker cli (click here for more info)
docker run -d \
--name=ha-auto-guest-login \
-e CLIENTID=http://homeassistant.local/ \
-e URL=http://homeassistant.local \
-e DASH=lovelace-guest \
-e USER=username \
-e PASS=password \
-p 80:80 \
--restart unless-stopped \
norick/ha-auto-guest-login:main
Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate <external>:<internal>
respectively. For example, -p 8080:80
would expose port 80
from inside the container to be accessible from the host's IP on port 8080
outside the container.
Parameter | Function |
---|---|
-p 80 |
WebUI |
-e CLIENTID=http://homeassistant.local/ |
Usually matches URL. See Getting ClientId for instructions on finding it |
-e URL=http://homeassistant.local |
URL of Home Assistant instance |
-e DASH=lovelace-guest |
Home Assistant Dashboard to automatically be directed to. In this example setup: http://homeassistant.local/guest-dashboard |
-e USER=username |
Home Assistant user that is automatically logged into |
-e PASS=password |
Password of Home Assistant user above |
- Log out of Home Assistant
- In Chrome, press F12 to open dev tools, then navigate to the Network Tab
- Check the "Preserve Log" option
- Navigate to your Home Assistant Url
- Log in (you can use incorrect credentials so you don't get redirected)
- Look in the Network tab for a fetch request made to a random string of characters
- Click that request and check that it was made to /auth/login_flow
- Open the "Payload" tab and find the clientId