Very SLOW Automations - more than 10 minutes

Hello… my first post here, and a recent adopter of Home Assistant.

I am having a problem with one automation I have created, at first I didn’t think it was working at all but actually the automation triggered after 10 minutes…

I have a 3 gang tuya light switch, 2 gangs have a load, and the third gang does not. I wanted to use this third gang to trigger an automation to switch on two Sonoff Basic switches that control two LED strips. Sounds simple enough.

id: '1625396650616'
alias: Kitchen Cabinet Lights On
description: ''
trigger:
  - platform: state
    entity_id: switch.tuya_kitchen_led
    to: 'On'
condition: []
action:
  - service: switch.turn_on
    target:
      entity_id:
        - switch.sonoff_kitchen_led_1
        - switch.sonoff_kitchen_led_2
mode: single

I can operate both devices from their respective apps from my mobile device i.e. ewelink and tuya app, and there is no delay - pretty instantaneous.
I can also toggle the states of both devices with Home Assistant in a similar manner, no noticeable delay.
And I can trigger the automation manually and it works.

I have Tuya V2 intergation + Tuya Local integration and Sonoff Integration from AlexITT.

I am trying to pinpoint the reason for the delay. Where can I begin to look, and what troubleshooting advise does anyone have?

In my mind I have eliminated the devices. I have a IoT developer account for Tuya and can trigger the tuya switch instantly via their cloud platform, can’t say the same for Sonoff Basics, but they are working properly from the ewelink app. So the remaining culprit to me is something in Home Assistant.

I am running HA on a Raspberry Pi 4 4GB with 480Gb SSD

No, it would never have triggered.

Should be:

 to: 'on'

Upper/lower case is important.

I have updated the automation as you suggested, but get the same behavior.

Actually the automation does work if triggered manually, (which could have accounted for the typo) but has actually worked, but after 10mins of waiting. Good to know these states are case sensitive.

Great there is nothing wrong with your actions then. It’s just the trigger.

Go to Developer Tools / States and watch the state of switch.tuya_kitchen_led when you physically turn the switch on and off (using the mobile app to observe this would be easiest).

Open your Home Assistant instance and show your state developer tools.

Does the state update in a timely manner when you flip the switch?

When I physically press the switch nothing happens on this page. But if I change the state from off to on and press SET STATE the lights come on immediately. Where should I be watching for the state change? in the top part of this menu or somewhere else lower down?

I scrolled down a little and filtered the Current entities for the switch.tuya_kitchen_led, and cycled the physical switch on and off a few times. Nothing is changing.

Likely because it takes 10min for the physical switch trigger to be reported in HA, which is the cause of the “slow” automation, and the point of Tom’s question.
This would be the actual issue to be fixed.

1 Like

I agree… I checked for 10 mins earlier today and nothing was working even after 20-30mins… I could try this test again now to see if the state updates in the Developer Tools… if that’s the case then I feel we are getting closer to the root cause of the problem, or at least the place to begin the deep dive.

Well… after scrolling through the list of entities, I found one that was changing state when the switch was activated! I have replaced that entity in the automation and now its working… Thanks… I knew it was something simple… but didn’t know where to begin looking.
Any advice as how I can clean up my entities… Seems I may have duplicates by uninstalling integrations and adding new integrations… I know this is off topic, but would be nice to clean up now before I get more and more entities to manage.

1 Like

It depends how they were added.

If you used YAML, just delete the unwanted YAML configuration(s) and restart.

If the entities were discovered and added via the GIU go to Configuration / Integrations / Devices or Configuration / Entities and look for the duplicates / unwanted devices or entities there. You should be able to delete them from the user interface. Try deleting unwanted devices before deleting unwanted entities (this should delete all entities associated with the device).

Open your Home Assistant instance and show your configuration panel.

1 Like

Thank you for your advice and support… :grinning:

Just an idea, i had similar issue. Is because of the automation mode I had set it to.

1 Like

You might like to try this and see if it improves matters:

As with all Beta software, make a snapshot and copy it somewhere safe before trying it. That way if it makes things worse you can restore quickly.

1 Like