How to schedule a reload of some integration?

Some integrations (Tuya and Govee for me) stop working and need to be reloaded.
In my case it happens every time I reboot (for whatever reason) my router.
I haven’t found a way to schedule this.
Is there a way to schedule the reload of an integration to run every x hours/minutes/days?

Thank you
Air

Yes, you can select Time and Location -> Time Pattern as Trigger in an Automation and then Call Service in the Action and select:

Home Assistant Core Integration: Reload config entry

And select the Integration to reload.

I do something like that, however I just check if a state is Unknown or Unavailable instead of using a Time Pattern.

I too have reloaded misbehaving integrations when they are unavailable but this is just a temporary solution. The root cause of the problem should be found and addressed.

Debugging misbehaving integrations should be done by following this guide:

1 Like

Let me know if you need help implementing it.

Yes it is a solution.
I set up this automation:

alias: Reload Tuya + Govee Integrations
description: ""
trigger:
  - platform: time
    at: "07:00:00"
condition: []
action:
  - service: homeassistant.reload_config_entry
    data:
      entry_id: 85a2f0874a1fd8d1a14345d054aa7a58
  - service: homeassistant.reload_config_entry
    metadata: {}
    data:
      entry_id: 6e40279b48e76b80b17f473147c9ecb7
mode: single

But it has been executed Just one time.
Not every day.
I don’t understand why…

I set up this automation:

alias: Reload Tuya + Govee Integrations
description: ""
trigger:
  - platform: time
    at: "07:00:00"
condition: []
action:
  - service: homeassistant.reload_config_entry
    data:
      entry_id: 85a2f0874a1fd8d1a14345d054aa7a58
  - service: homeassistant.reload_config_entry
    metadata: {}
    data:
      entry_id: 6e40279b48e76b80b17f473147c9ecb7
mode: single

When I try to modify it to be triggered by the Integration state, I don’t find the what to check: Entity or Device (Integration state is not present)?

Please check out this guide. Posting your code properly helps folks expedite a resolution.

I check the state of one of the entities the integration provides. It becoming unavailable usually means the integration needs reloading.

Check the automation’s trace.

The automation doesn’t start, so no trace is present.
When i start it manually, all tasks are completed correctly

Your automation is using a Time Trigger set for 07:00. It’s one of the simplest and most reliable triggers because all it needs to do is wait for the system clock to
advance to the specified time. There’s something fundamentally wrong if a simple Time Trigger fails to work on your system.

Enter the following template in the Template Editor and confirm it reports the correct date, time, and timezone offset for your location.

{{ now() }}

When you run it manually, it doesn’t exercise the automation’s trigger and simply executes its actions.

@123

I’m new to HA.
Could you please explain me how to do that, step by step?

Thing I think is better to know:

  1. Home Assistant is powered off and restarted every day at1 am
  2. If I change the time for automation to be triggered after a few minutes l, it works.
    But it isn’t triggered no more.
    It seems the automation is triggered only one time.
  3. I have set up also another automation triggered by sunset.
    It works some days and other no.

Thank you

If a Time Trigger only triggers once but never again and a Sun Trigger works only sometimes but not every day, then there’s a fundamental problem with your system.

I don’t know what that problem might be but it makes discussing automations pointless until the problem is resolved.

What version of Home Assistant do you have and which installation method did you use?

  1. Home Assistant OS
  2. Home Assistant Container
  3. Home Assistant Supervised
  4. Home Assistant Core

Installation Methods

Most importantly, check the Logs for any warning or error messages.