Builds and pull requests
Make a production build of the frontend, and try out a frontend pull request on a real Home Assistant without a development setup.
Most of the time, the development server is all you need. These are for the other times: when you work on how the frontend is packaged, or when you want to test a pull request on a real Home Assistant.
pnpm buildThis makes a full production build into hass_frontend/: both the modern and the legacy build, minified and compressed, with service workers. It takes a while.
When you only need the modern build, for example to compare bundle sizes or measure performance, skip the legacy one:
pnpm build --modernProduction builds accept the same --background, --status, --logs, and --stop flags as the development servers. A build and a development server can't run at the same time, because they write to the same folder.
To run Core with your build instead of the frontend it normally installs, install the frontend repository as a Python package into the environment of your development Core, and tell Home Assistant not to replace it:
pip3 install -e /path/to/frontend --config-settings editable_mode=compat
hass --skip-pip-packages home-assistant-frontendYou can run the build of any open frontend pull request on your own Home Assistant, without cloning or building anything. This works on every installation type, including Home Assistant OS. It is useful to check whether a fix works on your hardware, your browser, or your setup.
Home Assistant downloads the build from GitHub, which needs a token:
- In GitHub, go to Settings > Developer settings > Personal access tokens > Fine-grained tokens.
- Select Generate new token, and give it a name you recognize, like "Home Assistant frontend testing".
- Pick a short expiration, like 90 days.
- Under Repository access, select Public repositories. Leave the permissions empty.
- Select Generate token, and copy it. You won't see it again.
Add the number of the pull request and your token to the configuration.yaml of your Home Assistant, and restart it:
frontend:
development_pr: 12345
github_token: !secret github_tokenKeep the token itself in secrets.yaml, never in a file you share.
On startup, Home Assistant downloads the build of the pull request and uses it instead of the built-in frontend. It keeps a copy, and on later restarts it checks whether the pull request has new commits, and downloads the new build if it does. If the download fails, Home Assistant falls back to the built-in frontend and logs why.
If development_repo is also set, that wins, and the pull request is ignored.
To go back, remove both lines and restart. Home Assistant removes the downloaded build.