Supervisor development
These instructions are for development of the Supervisor, the Supervisor frontend panel and thehassio
integration, by interacting with a development or remote supervisor, this assumes that you are using a development machine to do the development, these instructions will also use devcontainer and other tools that rely on Docker, so if you don't have that setup yet, do that before you continue.
Supervisor development
The instructions here is for development of the Supervisor itself.
- Fork the Supervisor repo (https://github.com/home-assistant/supervisor) and clone it to your development machine.
- Open the repo with Visual Studio Code devcontainer.
- Create a branch in your fork.
- Do your changes.
- Test your changes with the instructions below.
- Commit and push your changes, and create a PR against the
main
branch athttps://github.com/home-assistant/supervisor
Local testing
Start the task "Run Supervisor" in Visual Studio Code, this will start an instance of the Supervisor inside the devcontainer you can use to test your changes.When the initializing is complete you can access the Home Assistant frontend onhttp://localhost:9123
Testing on a remote system
For this you first need to create an account atDocker Hub.
- Access the remote system with SSH or with direct console access.
- Check the architecture on the machine with
ha info
or justinfo
if it's Home Assistant OS. - On your development machine use ourbuilder to build and publish your Supervisor image.
Example:
All examples will have values you need to adjust.
- Adjust
aarch64
with the architecture you found in step 2. - Adjust
awesome-user
to match your Docker Hub username. - Adjust
secret-password
to match your Docker Hub password or publish token.
docker run --rm \
--privileged \
-v /run/docker.sock:/run/docker.sock \
-v "$(pwd):/data" \
ghcr.io/home-assistant/amd64-builder:dev \
--generic latest \
--target /data \
--aarch64 \
--docker-hub awesome-user \
--docker-user awesome-user \
--docker-password secret-password \
--no-cache
- On your remote system change the channel to
dev
withha supervisor --channel dev
or justsupervisor --channel dev
if it's Home Assistant OS. - Pull down your Supervisor image with
docker pull awesome-user/aarch64-hassio-supervisor:latest
- Tag your Supervisor image as
homeassistant/aarch64-hassio-supervisor:latest
docker tag awesome-user/aarch64-hassio-supervisor:latest homeassistant/aarch64-hassio-supervisor:latest
- Restart the
hassio-supervisor
service withsystemctl restart hassos-supervisor
- Check for issues with
journalctl -fu hassos-supervisor
Integration development
The instructions here is for development of thehassio
integration, we're going to assume that you have aHome Assistant Core development environment set up, and that you haveSupervisor API Access set up.
To configure Home Assistant Core to connect to a remote supervisor, set the following environment variables when starting Home Assistant:
SUPERVISOR
: Set to the IP of the machine running Home Assistant and port 80 (the API proxy add-on)SUPERVISOR_TOKEN
: Set this to the token that you foundSupervisor API Access
SUPERVISOR=192.168.1.100:80 SUPERVISOR_TOKEN=abcdefghj1234 hass
Your local Home Assistant installation will now connect to a remote Home Assistant instance.
Frontend development
The instructions here is for development of the Supervisor panel, we're going to assume that you have aHome Assistant frontend development environment set up with the devcontainer, and that you haveSupervisor API Access set up.
- Run the "Develop Supervisor panel" task
- Run the task "Run HA Core for Supervisor in devcontainer"
- When asked for the IP, use the IP of the host that is runningSupervisor API Access
- When asked for the token, use the token you foundSupervisor API Access
Without frontend devcontainer
Update thehassio
integration configuration in yourconfiguration.yaml
file to point at the frontend repository:
# configuration.yaml
hassio:
# Example path. Change it to where you have checked out the frontend repository
development_repo: /home/paulus/dev/hass/frontend
To build a local version of the Supervisor panel, go to the frontend repository and run:
cd hassio
script/develop
Whilescript/develop
is running, the Supervisor panel will be rebuilt whenever you make changes to the source files.
Supervisor API access
To develop for thehassio
integration and the Supervisor panel, we're going to need API access to the supervisor. This API is protected by a token that we can extract using a special add-on. This can be done on a running system or with thedevcontainer.
- Add our developer Add-on repository:https://github.com/home-assistant/addons-development
- Install the Add-on "Remote API proxy"
- Click Start
- The token will be printed in the logs
The add-on needs to keep running to allow Home Assistant Core to connect.
The Remote API proxy token has slightly less privileges than Home Assistant Core has in production. To get the actual token with full privileges, you need to SSH into the host system and run:
docker inspect homeassistant | grep SUPERVISOR_TOKEN
Note that either token can change after a reboot or update of OS/container.