rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.71k stars 530 forks source link

Integration needs a reload on every HA restart #1727

Open npa-homeassistant opened 3 weeks ago

npa-homeassistant commented 3 weeks ago

This is only a minor problem and I could create an automation to work around it, but I thought it'd be helpful to post.

For some time now, I have seen that the Localtuya integration doesn't load correctly after restarting HA. If I allow HA to restart and then reload Localtuya manually, everything's fine.

aviadlevy commented 3 weeks ago

Same here. until it resolved, can you share the automation you created to work around it?

kellya commented 3 weeks ago

As a work-around, I just created an automation that is triggered on homeassistant start, then waits a minute to make sure everything comes up, and then does a localtuya.reload. I've only had it run a couple times, but it's working for me so far.

alias: Restart LocalTuya
description: After home assistant restarts, reload localtuya to work-around issue.
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: localtuya.reload
    metadata: {}
    data: {}
mode: single
aviadlevy commented 3 weeks ago

I also figured it out. I think we can even remove the delay since the event is triggered after everything is removed (however, 1 minute just to be sure is time I can allow myself spending 😉)