Configure hass-cli with Server and Token
devTo interact with your Home Assistant instance, you must provide a server URL and a Long-Lived Access Token.
- Generate a Token: Go to your Home Assistant profile page (e.g.,
http://homeassistant.local:8123/profile), scroll to "Long-Lived Access Tokens", and generate one. - Set Credentials: You can pass
--serverand--tokenas parameters to every command, but it is recommended to set them as environment variables:
$ export HASS_SERVER=http://homeassistant.local:8123
$ export HASS_TOKEN=<your_secret_token>$ export HASS_SERVER=http://homeassistant.local:8123
$ export HASS_TOKEN=<secret>