Since Homeassistant OS 16.0, my Switchbot set-up in HA seems to be reacting strangely within even the easiest of automations.
For example:
- When sun goes under,
- Close 4 curtains.
The 4 curtains (version Switchbot Curtain 3) (let’s call them A, B, C and D) are all on the same floor at a relative similar distance to the SwitchBot hub and from the dashboard or entity I can control them all with ease.
However, inside the automation, under the trace-view, I get the error:
Fout: WoCtn3 () - : Failed to connect after 4 attempt(s): device ‘dev_’ not found: The device disappeared; Try restarting the scanner or moving the device closer
However, this can be the MAC address of A, B, C or D and it seems almost ‘random’ which curtain is to be opened. Again, even seconds after the automation ran, I can perfectly close them manually.
Although a tad bit funny: “Which one is going to close this time”, I do not know how to solve this… Restarting HA or reloading the Switchbot Bluetooth integration did not solve anything.
Does anyone have a possible solution I can look into?
Have you tried staggering the action calls?
Instead of:
actions:
- action: cover.close
target:
entity_id:
- cover.one
- cover.two
- cover.three
Use a Repeat for Each and a short delay:
actions:
- repeat:
for_each:
- cover.one
- cover.two
- cover.three
sequence:
- action: cover.close_cover
target:
entity_id: "{{ repeat.item }}"
- delay: 1
1 Like
@Didgeridrew thanks for your solution, I adjusted it a little, but it seems to work! Still have to note strange behaviour as so far, it didn’t.
actions:
- repeat:
for_each:
- curtain.one
- curtain.two
- curtain.three
sequence:
- action: cover.close_cover
target:
entity_id: "{{ repeat.item }}"
data: {}
- delay: "00:00:01"
mode: single
So, basically this just keeps redoing the automation untill everything is opened? I still find it strange that the automation has trouble finding the curtains while changing the curtains through a dashboard button works instantly…
Not really. What it does is just spaces out the the signals being sent out to the blinds. The same thing could be done like:
....
sequence:
- action: cover.close_cover
target:
entity_id: cover.one
- delay: 1
- action: cover.close_cover
target:
entity_id: cover.two
- delay: 1
- action: cover.close_cover
target:
entity_id: cover.three
The repeat action just makes it more compact and easier to edit.
The automation isn’t having “trouble finding the curtains”.
Someone with more knowledge than me may be able to give a more technically correct answer, but when you do it all in one call like…
- action: cover.close_cover
target:
entity_id:
- cover.one
- cover.two
- cover.three
What is actually happening is those commands are being sent one after the other in a very quick sequence. And, the problem seems to be that the actual Bluetooth signal generation is suffering from clashes or there is some kind of signal interference being created.
When you are actuating them individually from the dashboard, you are sending one command signal at a time.
Thanks @Didgeridrew for the explanation, sounds very logical! A few days later the automation still seems to work fine, so thanks for helping me out!