core: SwitchBot integration doesn't work anymore in 24.01

The problem

It seems like I’m the only one running into this problem because I don’t see or hear anyone else complaining. But when upgrading to release 2024.1.0 (or 2024.1.2), the SwitchBot integration no longer works. For all devices, “Setup failed” applies. I don’t see what I can do myself to adjust it especially since on my other Home Assistant application running on a virtual machine it does work just fine. There, the SwitchBot integration works as before on 2024.

What version of Home Assistant Core has the issue?

core-2024.1.2

What was the last working version of Home Assistant Core?

core-2023.12.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SwitchBot Bluetooth

Link to integration documentation on our website

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

Diagnostics information

Logger: homeassistant.config_entries Source: config_entries.py:406 First occurred: 11:15:48 (14 occurrences) Last logged: 11:15:48

Error setting up entry Curtain Left for switchbot Error setting up entry Curtain Right for switchbot Error setting up entry Blind Back for switchbot Error setting up entry Blind 3 for switchbot Error setting up entry Blind 1 for switchbot Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 406, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/components/switchbot/init.py”, line 102, in async_setup_entry await switchbot.close_stale_connections_by_address(address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module ‘switchbot’ has no attribute ‘close_stale_connections_by_address’

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Python-version: 	  3.11.6
Operating system:  	  Linux (Debian GNU/Linux 11 (bullseye))
Operating system version: 5.10.0-22-amd64 
CPU-architecture: 	  x86_64

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

@Kouwe-sudo Follow these steps to remove the old outdated pySwitchbot dependency.

  • Navigate to the Add-on “Custom deps deployment”. Go to the “Configuration” tab, and delete/remove any options that are related to pyswitchbot, then click Save.
  • Now go back to the “Info” tab and “Start” the Add-on. In the “Logs” tab you’ll see that old dependencies were removed.
  • Restart Home Assistant.

If the above does not work, try deleting the Add-on, restart HA, install Add-on, make sure configuration is blank, and start Add-on again, reboot HA.

I just went through these steps and was able to get my curtains and switches working again. Hope that helps.