Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switchbot Curtains delay. i now have a delay between each one and not always firing after upgrading to HAOS 10+ (reverting to 9.5 fixes) #92839

Closed
ins4neuk opened this issue May 9, 2023 · 36 comments

Comments

@ins4neuk
Copy link

ins4neuk commented May 9, 2023

The problem

I have a number of switchbot curtains around the house and there now seems to be a delay between each one when firing via an automation or button press on the frontend. but is instant from the switchbot app or buttons. for example i have schedule to close all the curtains at sundown. this used to fire and all the curtains would shut at the same time. now it seems to close one. then wait then fire another etc etc i have around 7 pairs of curtains and 2 singles on door. and this means that it can take around 10 mins for them all to close or some times it just stops and all of them dont close. is there something i am missing as nothing has changed on my hardware and all core and everything is up to date.

i'm running HA on a dell wyse PC using core etc for intel.

What version of Home Assistant Core has the issue?

core-2023.5.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

switchbot

Link to integration documentation on our website

https://www.home-assistant.io/integrations/switchbot

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented May 9, 2023

Hey there @bdraco, @Danielhiversen, @RenierM26, @murtas, @Eloston, @dsypniewski, mind taking a look at this issue as it has been labeled with an integration (switchbot) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of switchbot can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign switchbot Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


switchbot documentation
switchbot source
(message by IssueLinks)

@ins4neuk ins4neuk changed the title Switchbit Curtains delaynow have a delay between each one and not always firing. Switchbot Curtains delay. i now have a delay between each one and not always firing. May 9, 2023
@joostlek
Copy link
Member

joostlek commented May 9, 2023

I also notice a delay between 2 curtains in one group. I was just assuming it was HA connecting with the switchbots (since I don't think they have an always active connection) and since I only have 1 double curtain and they are too heavy, it's never directly closed so it didn't really bother me, as long as they are closed at the end.

But it could be an issue with HA, not sure.

@ins4neuk
Copy link
Author

ins4neuk commented May 9, 2023

I also notice a delay between 2 curtains in one group. I was just assuming it was HA connecting with the switchbots (since I don't think they have an always active connection) and since I only have 1 double curtain and they are too heavy, it's never directly closed so it didn't really bother me, as long as they are closed at the end.

But it could be an issue with HA, not sure.

Mine close most of the time. its just before when i pressed the scene button for example all the curtains would close at the same time and at sundown everything would go. now it does everything non switchbot so lights and ikea blinds etc all simultaneously and then after a few moments the 1st switchbot closes and then after that there is a pause for a while then another etc etc. originally they would all close at the same time. i've looked at the scene and the schedule and it's not closing them in the order of that so it does seem random. completely agree with the slight delay i used to notice that and put that down to the having to talk etc.

@joostlek
Copy link
Member

joostlek commented May 9, 2023

2023-05-09 17:01:16.011 DEBUG (MainThread) [homeassistant.components.bluetooth] Rediscovered adapters: {'hci0': {'address': 'E4:5F:01:1D:87:C1', 'sw_version': 'homeassistant', 'hw_version': 'usb:v1D6Bp0246d0542', 'passive_scan': True, 'manufacturer': 'Raspberry Pi Trading Ltd', 'product': None, 'vendor_id': None, 'product_id': None}}
2023-05-09 17:01:18.345 DEBUG (MainThread) [bleak_retry_connector] WoCurtain (F4:B0:06:CC:41:3B) - F4:B0:06:CC:41:3B: Connection attempt: 1
2023-05-09 17:01:18.346 DEBUG (MainThread) [homeassistant.components.bluetooth.wrappers] F4:B0:06:CC:41:3B - WoCurtain -> /org/bluez/hci0: Connecting (last rssi: -57)
2023-05-09 17:01:18.352 DEBUG (MainThread) [bleak_retry_connector] WoCurtain (FC:E8:4B:B8:B0:4F) - FC:E8:4B:B8:B0:4F: Connection attempt: 1
2023-05-09 17:01:18.352 DEBUG (MainThread) [homeassistant.components.bluetooth.wrappers] FC:E8:4B:B8:B0:4F - WoCurtain -> /org/bluez/hci0: Connecting (last rssi: -56)
2023-05-09 17:01:19.266 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (E4:5F:01:1D:87:C1) [connectable]: EC:1B:BD:62:EB:0F AdvertisementData(local_name='ubq000002009', service_uuids=['d4986c33-033b-df8b-d143-79353af022d2'], tx_power=1, rssi=-87) match: set()
2023-05-09 17:01:23.347 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (E4:5F:01:1D:87:C1) [connectable]: 45:69:9F:C4:01:A6 AdvertisementData(manufacturer_data={76: b'\x10\x06C\x1d\xa8\xb0\xbc\x02'}, tx_power=4, rssi=-93) match: set()
2023-05-09 17:01:24.911 DEBUG (MainThread) [homeassistant.components.bluetooth.wrappers] F4:B0:06:CC:41:3B - WoCurtain -> /org/bluez/hci0: Connected (last rssi: -57)
2023-05-09 17:01:38.358 DEBUG (MainThread) [bleak_retry_connector] WoCurtain (FC:E8:4B:B8:B0:4F) - FC:E8:4B:B8:B0:4F: Timed out trying to connect (attempt: 1, last rssi: None)
2023-05-09 17:01:38.359 DEBUG (MainThread) [bleak_retry_connector.bluez] WoCurtain - FC:E8:4B:B8:B0:4F: Waited 0.000423051998950541 seconds to disconnect
2023-05-09 17:01:38.611 DEBUG (MainThread) [bleak_retry_connector] WoCurtain (FC:E8:4B:B8:B0:4F) - FC:E8:4B:B8:B0:4F: Connection attempt: 2
2023-05-09 17:01:38.613 DEBUG (MainThread) [homeassistant.components.bluetooth.wrappers] FC:E8:4B:B8:B0:4F - WoCurtain -> /org/bluez/hci0: Connecting (last rssi: -56)
2023-05-09 17:01:42.765 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (E4:5F:01:1D:87:C1): Scanner watchdog time_since_last_detection: 1.2959882549475878
2023-05-09 17:01:47.030 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (E4:5F:01:1D:87:C1) [connectable]: F4:B0:06:CC:41:3B AdvertisementData(local_name='WoCurtain', manufacturer_data={2409: b'\xf4\xb0\x06\xccA;}\r\xb9\x11"'}, service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': b'c@]\xb9\x11"'}, service_uuids=['00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', 'cba20d00-224d-11e6-9fb8-0002a5d5c51b'], rssi=-56) match: set()
2023-05-09 17:01:47.425 DEBUG (MainThread) [homeassistant.components.bluetooth.wrappers] FC:E8:4B:B8:B0:4F - WoCurtain -> /org/bluez/hci0: Connected (last rssi: -56)
2023-05-09 17:01:51.364 DEBUG (MainThread) [bleak_retry_connector] WoCurtain (F4:B0:06:CC:41:3B) - F4:B0:06:CC:41:3B: Connection attempt: 1
2023-05-09 17:01:51.365 DEBUG (MainThread) [homeassistant.components.bluetooth.wrappers] F4:B0:06:CC:41:3B - WoCurtain -> /org/bluez/hci0: Connecting (last rssi: -56)
2023-05-09 17:02:07.019 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (E4:5F:01:1D:87:C1) [connectable]: FC:E8:4B:B8:B0:4F AdvertisementData(local_name='WoCurtain', manufacturer_data={2409: b"\xfc\xe8K\xb8\xb0O'\x0f\x00\x12\x04"}, service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': b'c\xc0\\\x00\x12\x04'}, service_uuids=['00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', 'cba20d00-224d-11e6-9fb8-0002a5d5c51b'], rssi=-77) match: set()
2023-05-09 17:02:07.030 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (E4:5F:01:1D:87:C1) [connectable]: F4:B0:06:CC:41:3B AdvertisementData(local_name='WoCurtain', manufacturer_data={2409: b'\xf4\xb0\x06\xccA;\x91\r\x9a\x11"'}, service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': b'c@]\xb9\x11"'}, service_uuids=['00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', 'cba20d00-224d-11e6-9fb8-0002a5d5c51b'], rssi=-66) match: set()
2023-05-09 17:02:11.370 DEBUG (MainThread) [bleak_retry_connector] WoCurtain (F4:B0:06:CC:41:3B) - F4:B0:06:CC:41:3B: Timed out trying to connect (attempt: 1, last rssi: None)
2023-05-09 17:02:11.370 DEBUG (MainThread) [bleak_retry_connector.bluez] WoCurtain - F4:B0:06:CC:41:3B: Waited 0.000359497033059597 seconds to disconnect
2023-05-09 17:02:11.622 DEBUG (MainThread) [bleak_retry_connector] WoCurtain (F4:B0:06:CC:41:3B) - F4:B0:06:CC:41:3B: Connection attempt: 2
2023-05-09 17:02:11.624 DEBUG (MainThread) [homeassistant.components.bluetooth.wrappers] F4:B0:06:CC:41:3B - WoCurtain -> /org/bluez/hci0: Connecting (last rssi: -66)
2023-05-09 17:02:12.770 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (E4:5F:01:1D:87:C1): Scanner watchdog time_since_last_detection: 5.323951747035608
2023-05-09 17:02:13.085 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (E4:5F:01:1D:87:C1) [connectable]: F4:B0:06:CC:41:3B AdvertisementData(local_name='WoCurtain', manufacturer_data={2409: b'\xf4\xb0\x06\xccA;\x98\r\x8b\x11"'}, service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': b'c@]\x8b\x11"'}, service_uuids=['00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', 'cba20d00-224d-11e6-9fb8-0002a5d5c51b'], rssi=-56) match: set()
2023-05-09 17:02:13.494 DEBUG (MainThread) [homeassistant.components.bluetooth.wrappers] F4:B0:06:CC:41:3B - WoCurtain -> /org/bluez/hci0: Connected (last rssi: -66)

Just made some debug logs, It took a fair moment for the other curtain to start closing. When opening them while they are closing, it works instantly (hence why I think the delay is caused by connecting to the curtains.

@bdraco
Copy link
Member

bdraco commented May 9, 2023

If you don't have an adapter from the high performance list, connecting will be slow

https://www.home-assistant.io/integrations/bluetooth/#known-working-high-performance-adapters

@ins4neuk
Copy link
Author

ins4neuk commented May 9, 2023

I've got a zexmte unit. It's not high speed but it used to be able to close them all at the same time not in succession. So if I need to get something else not a problem but don't want to spend money on other adapters if its something with my configuration etc.

@bdraco
Copy link
Member

bdraco commented May 10, 2023

realtek has promised a firmware update for 2 years to fix the reliability issues with the RTL8761Bs (likely the chip in your adapter).. but we are still waiting ..

@ins4neuk
Copy link
Author

@ins4neuk
Copy link
Author

I've purchased this usb adaptor from amazon after bdraco's advice

https://www.amazon.co.uk/Plugable-USB-BT4LE-Bluetooth-Energy-Adapter/dp/B009ZIILLI

and installed it and everything still works but I'm still getting the delay. once its connected its instant if i press stop or the other direction.
I've also watched the dashboard as set the curtains up in a single screen and clicked them all and you can see it's doing it's paring to a curtain which takes a few seconds and then closes that. then once its closed a few seconds later the icons change to show the open button. then after this the other one will then open etc.
so it looks like its negotiating with the device, doing the action, waiting to get told it's done then start the negotiation on the next device then rinse repeat etc. bit i'm 99% sure they would all close before and not on a round robbing style attack.

@bdraco
Copy link
Member

bdraco commented May 10, 2023

At least with mine, if they are paired only one of them actually operates both of them. If you don't pick the one the app set up as the parent device it will only operate the child device.

@ins4neuk
Copy link
Author

I've probably worded that wrong. it does both curtains as in left and right when i close. it just wont do multiple different curtains at the same time. for example in my lounge i have some patio curtains (pair) and some some side curtains again a pair. when use to click on patio then side at the same time it would close all 4 curtains at the same time. not when i do it, it will close the pair of curtains i clicked first. then once they have closed it then does the other pair.

also I've just rebooted as i realised HA was still saying that it was using the Realtek device even though i had swapped the units. so its now found the new usb adaptor i got tonight and it's still happening and the delay from button to close is also greater now for some reason so the old adaptor seems to negotiate quicker!

@ins4neuk
Copy link
Author

i've just roughly timed it and it seems to be the following
press button for closing curatin 1 and then 2 pretty much at the same time.
10 sec wait
first curtains start to close
curtains closed
5 seconds later HA update dashboard
10 second wait
2nd curtain closes
curtains close
5 seconds later ha updates
10 second next ones start etc.

it probably doesn't sound a lot but when the curtains take 20 seconds say to close then add this with the extra 15 seconds to each one and then 9 odd curtains its like 3 or 4 mins to close them all and then it starts failing.

@bdraco
Copy link
Member

bdraco commented May 10, 2023

I would have picked one of the csr based adapters as they generally have the best performance.

I haven’t had much luck with the Broadcom ones establishing connections at the same time

If you need to establish connections simultaneously the best bet is one adapter per device. This is best accomplished with esphome proxies

@ins4neuk
Copy link
Author

https://www.amazon.co.uk/Sabrent-Bluetooth-Adapter-Technology-BT-UB40/dp/B06XHY5VXF/ref=sr_1_1?crid=36ZHXNDGLHVJ4&keywords=SABRENT+BT-UB40&qid=1683760269&sprefix=sabrent+bt-ub40%2Caps%2C106&sr=8-1

I've just ordered that one to see if there is a difference at all

@ins4neuk
Copy link
Author

SABRENT USB Bluetooth 4.0 Adapter Dongle for PC Laptop Desktop Computer Mouse Keyboard Headphone Controller, Support Windows, Mac, Plug and Play (BT-UB40) https://amzn.eu/d/ipvW2s8

This arrived today. I've set it up rebooted host but still getting big delays when I click on a curtain some times seems to take longer and will still only close one pair at a time.

@ins4neuk
Copy link
Author

any suggestions or anything else i can supply to assist?

can you confirm that if you did 2 or 3 different pairs of curtains they would all clost at the same time in different rooms is i just mine that's not working?

@rhpijnacker
Copy link
Contributor

@ins4neuk I am suffering from exactly the same problem.
I have an automation that used to simulaneously close my living room curtains (2 sets of 2 paired curtains). Since a few weeks, it first does one and only then does it do the other.
One other set of curtains both open to the same side, so I am running those curtainbots with a small delay for one (so it looks nicer). That also does not work anymore :(.

@ins4neuk
Copy link
Author

@ins4neuk I am suffering from exactly the same problem. I have an automation that used to simulaneously close my living room curtains (2 sets of 2 paired curtains). Since a few weeks, it first does one and only then does it do the other. One other set of curtains both open to the same side, so I am running those curtainbots with a small delay for one (so it looks nicer). That also does not work anymore :(.

Its weird. it's almost like it can only speak to one unit and needs to wait for the response before doing anything else by which time the requests have timed out. since then i've added the curtains into smartthing and then use the smartthings integration which is cloud api based i'm guessing and they work fine can close multiple curtains and only a 3 or 4 second delay. i've tired like i said 3 different chipset variations of bluetooth adaptors to no avail.

@rhpijnacker-philips
Copy link

Since this was working just fine before, why are we blaming the bluetooth adaptors?
Seems to me that some code change is probably to blame.

@ins4neuk
Copy link
Author

Since this was working just fine before, why are we blaming the bluetooth adaptors? Seems to me that some code change is probably to blame.

i was thinking it was something with HA like that, they had altered timeouts or something so stuff doesn't time out on items which has then impacted the switchbot thing. or maybe a switchbot update even. but i have tried 1 of each chipset on the list and it's the same with all of them and different each time. happy you have noticed the same which means it's not possibly an issues with my instance and something more wide spread.

@Akeogh92
Copy link

Akeogh92 commented Jun 1, 2023

I’ve been having this exact issue. I believe it is being caused by the HA OS version. Anything 10.+ is presenting delayed or non-responsive switchbot hardware for my automations (curtains and blinds).

I confirmed this just yesterday. When updating to 10.2 OS and the same problems are present as described in this thread. These issues first started appearing for me in OS 10.1 so I’ve been hanging back in 9.5 until this is resolved.

@ins4neuk
Copy link
Author

ins4neuk commented Jun 2, 2023

I’ve been having this exact issue. I believe it is being caused by the HA OS version. Anything 10.+ is presenting delayed or non-responsive switchbot hardware for my automations (curtains and blinds).

I confirmed this just yesterday. When updating to 10.2 OS and the same problems are present as described in this thread. These issues first started appearing for me in OS 10.1 so I’ve been hanging back in 9.5 until this is resolved.

interesting. i might stick HA one of my USB's on my synology and see what happens.

@Toxblh
Copy link
Contributor

Toxblh commented Jul 28, 2023

Can confirm. 10.3 - I have the same issue. I have Intel internal Bluetooth and 10.2 looks like works synchronously step by step. Starts to close first, waits till finish, and reconnects to the new one and that to all bots in the order. I downgraded to 9.5 and all works fine, lag between starts is ~1-2 seconds without waiting to finish which is fully fine. Maybe it is similar to the kernel version home-assistant/operating-system#2535 here as well.

UPD: In final I migrated to ESP32-Bluetooth proxy, works ideal

@ins4neuk
Copy link
Author

I'm not sure on exact versions but mine is very similar. Fine on older version

@bdraco bdraco changed the title Switchbot Curtains delay. i now have a delay between each one and not always firing. Switchbot Curtains delay. i now have a delay between each one and not always firing after upgrading to HAOS 10+ (reverting to 9.5 fixes) Jul 28, 2023
@bdraco bdraco removed their assignment Sep 12, 2023
@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@gunnaraas
Copy link

I am having a similar issue with a SwitchBot Blind Tilt group. I'm interested in solutions others have found.

This previously worked great before updating to HAOS 10, it would be nice if the functionality could be restored with a future update.

@syntaxmc
Copy link

syntaxmc commented Nov 8, 2023

This is still an issue for me. Running on RPi4 with SkyConnect. Upgraded to 11.1, but had to revert back to 9.5 as at least one of my SwitchBot Blind group fails each day.

@rhpijnacker
Copy link
Contributor

Same here. Ever since upgrading to 10.2+ this is "broken".

@github-actions github-actions bot removed the stale label Nov 8, 2023
@gunnaraas
Copy link

UPD: In final I migrated to ESP32-Bluetooth proxy, works ideal

@Toxblh Could you please clarify if "works ideal" means that a group moves simultaneously? Could you advise which board you used to accomplish that?

@Toxblh
Copy link
Contributor

Toxblh commented Nov 10, 2023

UPD: In final I migrated to ESP32-Bluetooth proxy, works ideal

@Toxblh Could you please clarify if "works ideal" means that a group moves simultaneously? Could you advise which board you used to accomplish that?

Yes, not at the same second. But when it starts to move one after ~0.7 start next and in 3-4 seconds start closing all my curtains. Works as expected to me right now.

In Groups I mean in the switch bot app you can pair 2 bots for a single window to a paired group. Only the main unit needs to send a command it will immediately repeat by second device in the pair

I bought that https://amzn.eu/d/52SZnNl

@rhpijnacker
Copy link
Contributor

rhpijnacker commented Nov 21, 2023

I am doing some experiments to see if I can figure out where exactly this started failing.
So far, I have installed (on a Proxmox server) fresh copies of HA OS, versions 9.5 and 10.0. HomeAssistant is up to date, and I'm using the SwitchBot integration to test connectivity with bluetooth.

Initial results clearly show that with HAOS 9.5 everything works perfect. The SwitchBox Curtains respond quickly, and I can open multiple at the same time. With HAOS 10.0 things are not so smooth. There is a big delay, and even sometimes timeouts.

As a next step I'm going to zoom in to see in more detail what is going on. (Any help where to look is appreciated.)

Update: right from HAOS 10.0.rc1 the problems with bluetooth seem to have started.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@gunnaraas
Copy link

This issue is still present on latest version.

@iverlaek
Copy link

Same to me, every curtain group waits for the other to finish. But my group of 2 curtains closes together in contrast to another comment here.

PS.
Also the sleep time of the curtain bots are annoying. I have a curtain in front of the entrance door (to save energy in the winter). A motion detector should open the curtain. 20 seconds waiting for the motor to wake up from it's power saving sleep mode and start receiving signals isn't fun when your'e standing outside in the rain and cold.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests