How to automatically reload integration on a schedule?

Is there a simple way to force an integration to reload on regular schedule, for example every night at 2 am?

Use an automation something like this (assuming it is an integration setup in the UI).

description: "Reload xxx integration @ 2am"
mode: single
trigger:
  - platform: time
    at: "02:00:00"
condition: []
action:
  - service: homeassistant.reload_config_entry
    data:
      entry_id: ad7f562e4ef537e1bf858335aae4002e

The config entry id is found in config/.storage/core.config_entries for the one you want to reload.

7 Likes

You can also get entry_id using the config_entry_id filter.

3 Likes

Thank y’all!

is this write in to automations.yaml ?

i was edit to every 3 hours instead of time

the code below correct ?

  • description: “Reload Tuya integration @ 3hours”
    mode: single
    trigger:
    • platform: time_pattern
      hours: “/3”
      condition:
      action:
    • service: homeassistant.reload_config_entry
      data:
      entry_id: 635ee76a799ddf6fb8e8a6efe0852786

i was edit to every 3 hours instead of time

the code below correct ?

- description: "Reload Tuya integration @ 3hours"
  mode: single
  trigger:
   - platform: time_pattern
     hours: "/1"
  condition: []
  action:
   - service: homeassistant.reload_config_entry
     data:
       entry_id: 635ee76a799ddf6fb8e8a6efe0852786
1 Like