Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 1.49 KB

DEVELOPMENT.md

File metadata and controls

29 lines (17 loc) · 1.49 KB

Development docs

Initial notes

  • 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!

Backend

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

Internal frontend

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.

Public frontend

The public frontend should also work out of the box.