Automation inquiry

Hi,

Some newbie comments\questions. Chat GPT code fails more often than not so I am not going to include any. I know its frowned upon anyways. Couple things. With automations does a single automations.yaml file need to be created and all go into that file or can you have multiple automation files. Also, does anyone have one to reload an integration every x number of minutes? I started with one and it seems to get auto populated when creating new ones, unless I am wrong here. Many thanks

You can have multiple automation files. Here’s one way:

# configuration.yaml

automation manual: !include_dir_merge_list automations # a whole directory of yaml files at config/automations
automation ui: !include automations.yaml # one file for the UI editor automations, can also be edited in yaml

See:

Another popular option is packages. These allow you to bundle many integrations (e.g. automations, switches, binary sensors) all in the one file. So you could have a file for each room of your house that contains all the entities, automations and scripts used for that room.

Hi and thanks,

I wrestle with how yaml needs to be properly formatted anyways so my preference would be to keep automations (not that I have many) separate. As to the 2nd part of my query I am just looking for something to reload an integration. Any ideas or links? I assume this would be fairly straight forward.

https://community.home-assistant.io/search?q=Reload%20integration%20automation

Under Settings->Automations I see that ones saved in the automations.yaml file can be run. How do you run the individual ones saved in the automations folder, to test?

Developer Tools → Services, select the automation.trigger service then fill out the details.

script:
  reload_integration:
    sequence:
      - service: config_entries.reload
        data:
          domain: Whirlpool Appliances
      - delay: "00:15:00"
      - service: script.reload_integration

I am trying to run this script via an automation, but it never seems to load. However, if I manually click on and reload things get reset. Here is the automation.

automation:
  - alias: Reload Whirlpool Integration
    trigger:
      platform: time_pattern
      minutes: "/15"  # Triggers every 15 minutes
    action:
      service: script.reload_Maytag

Any ideas on how to fix?

That’s not the name of your script. It is script.reload_integration.

However once you fix that every fifteen minutes your automation starts a script that calls itself every fifteen minutes. That is redundant.

Remove the delay and self reference from the script.