How to programatically trigger configuration reloading for Automation after settings automation.yaml file automatically?

Hi all,

I would like to programatically trigger configuration reloading for Automation right after settings automation.yaml file automatically.

Instead of manually clicking Reload Automation button, as per screenshot below:
25%20PM

How could I achieve this?

Thanks.

There is a service called automation.reload. Maybe it can be used somehow.

1 Like

Have a look at this https://www.home-assistant.io/components/folder_watcher/ use it as a trigger for the automation.reload service in an automation.

1 Like

I’m curious to learn how well this ‘auto-reload’ system will work in real-world conditions.

For example, while composing a new automation it’s good practice to occasionally save the file during the course of the editing session. That means a partially-constructed automation is saved to the file. Each time the file is saved, all automations will be reloaded. Any partial automations will fail config-check and log one or more error messages.

Other than this messy side-effect, it should work reasonably well because, even if there are errors, Home Assistant will load and use the error-free automations within the file.

In contrast, this ‘auto-reload’ scheme would be undesirable if applied to configuration.yaml. Depending on the nature of the error, it can prevent Home Assistant from starting.

I doubt it will be good/stable, since config issues will be loaded, and it will break automations/Home Assistant.

Will give this a try, and see if this is working.