- Please use yarn instead of npm for the frontend
- When One Time Service was created, "actions" were called "service calls". Most of the source code still refers to "Service Calls", so make yourself ready for some mixed methodology!
The One Time Service backend needs a working Home Assistant instance in all cases. This means that you need a valid long-lived token and the API base URL of a working instance. The token is specified via the SUPERVISOR_TOKEN
environmental variable while the API base URL is specified via the -hass-api-url
parameter.
For bypassing the strict-by-default CORS rules of the backend, you can set the -cors-allow-all
flag.
One Time Service also relies on the options.json
file, which is generated by the Home Assistant add-on configuration dashboard. You can use mocked values for this by setting the -mock-options-json
flag.
A full development environment can thus be started with (from within the backend/
directory):
export SUPERVISOR_TOKEN=v3rysecr3t.base64longlivedtoken
go run . -hass-api-url https://hass.example.org/api -cors-allow-all -mock-options-json
The internal frontend has a "proxy"
directive within package.json
which automatically redirect backend request from the dev frontend server to the go application. This means you can use the hot reloading feature of React, while still using the dev backend.
The public frontend should also work out of the box.