Is it possible to reload automations from the command line?

I do a lot of configuration work at the ssh based command line, especially for automations. Is there a way to reload automatons from the command line without restarting the core?

(in addition, I’m working on a remote instance which has a severe data cap, so I’d like to spare using the UI when not at that location)

Thanks!

Not sure what rebuild does

Doesn’t seem to be one that reloads the.config unless it’s undocumented. Looking in GitHub there doesn’t seem to be one. Maybe make a feature request?

Alternatively you can call a service to do it. Maybe you can find a way to send the command with a webhook or something so you don’t have to load the UI.

Have you tried the automation.reload service? You can call it using the Home Assistant API.

I do this via a curl command to the api. Basically this is the syntax, but you can learn more here: REST API | Home Assistant Developer Docs

curl -X POST \
-H "Authorization: Bearer ABBA12407235FFBEEFTOPSECRETNINJASHIT198427" \
-H "Content-Type: application/json" \
http://IP_ADDRESS:8123/api/services/automation/reload

You’ll need to generate your own Authorization Bearer string in the GUI. You need to generate a long-lived access token. From the docs:

All API calls have to be accompanied by the header Authorization: Bearer ABCDEFGH , where ABCDEFGH is replaced by your token. You can obtain a token (“Long-Lived Access Token”) by logging into the frontend using a web browser, and going to your profile http://IP_ADDRESS:8123/profile .

Thanks for this!

1 Like