SwitchBot integration: "Aborted Failed to connect"

Hi woowooslack,
Would you mind posting configuration example here? I have the same problem and documentation isn’t very clear about it.

1 Like

I’m having the same issue right now after just having set up Home Assistant for the first time!

1 Like

Just something as simple as that:

- platform: switchbot
  mac: 'xx:xx:xx:xx:xx:xx'
  name: "My Switchbot Button Press"
  password: !secret my_switchbot_password

Note that if you change the password for your switchbot, for some reason it won’t update properly, so better fully configure it before adding it to home assistant.

Also note that I found the integration to be not very stable, in finding my switchbot (quite often there’s an issue getting info, and my switchbot is not available for a while after that). Even though it’s related to my having put a high delay between getting information (because I’m using my switchbot to press only).

1 Like

thx for the solution… the integration is there… but i got this error:
Retrying setup: Unable to fetch switchbot services data
I have 4 curtains and i have 2 mac address must i fill in both?
i filled in one.

thx for the help

1 Like

same problem with my switchbot hub mini. Is it possible to connect the hub mini and use the commands for my created remote controls in Homeassistant? Documentation says: “no hub required” - but if you have one, can you add and use them?

I put the BTE MAC Address in the conf file. No success.

Error Logs:

Logger: switchbot
Source: /usr/local/lib/python3.9/site-packages/switchbot/init.py:155
First occurred: 09:26:00 (1 occurrences)
Last logged: 09:26:00

Scanning for Switchbot devices failed. Stop trying
NoneType: None

Logger: switchbot
Source: /usr/local/lib/python3.9/site-packages/switchbot/init.py:151
First occurred: 08:58:59 (13 occurrences)
Last logged: 09:00:55

Error scanning for switchbot devices
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/switchbot/__init__.py", line 147, in discover
    devices = bluepy.btle.Scanner(self._interface).scan(
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 854, in scan
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 803, in stop
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 312, in _mgmtCmd
    raise BTLEManagementError("Failed to execute management command '%s'" % (cmd), rsp)
bluepy.btle.BTLEManagementError: Failed to execute management command 'scanend' (code: 11, error: Rejected)

So I tried adding it manually and home assistant failed to load. By the way I am using home assistant portable version for windows.

When I normally try to add the SwitchBot integration I get a message: “Error. Config flow could not be loaded”

1 Like

Still no way to work with HA and Switchbot? :confused:

1 Like

it was working for me until the I upgraded to 2022.3.2 . I’m going to see if I can roll back , and then if that has fixed the issue.

Update: I had HA 2022.2.9 installed on a raspberry pi that was my HA server until I switched to using a VM a few days ago… Luckily, I still had it. I plugged it in and Switchbot works like a champ.

My new mission is to try to either clone the rpi boot SD card , or find a way to install 2022.2.9 in a VM. I’m still new to HA, so I don’t know their retention policy for older versions.


After trying different configurations, it looks like my issue is with my HA VM being on a bridged interface. At least , that is my best guess. Every other device - Wemo, ecobee, and more - works on my virtualized HA server, except Switchbot.

There is a post in reddit https://www.reddit.com/r/homeassistant/comments/q45fvf/using_switchbot_motion_with_home_assistant/ that includes using a Smartthings hub and there is also solution using a device called an ESP32 ( I have no idea what that is).

Anyway, it isn’t HA’s fault. So I’ll be looking at other solutions to the “Retrying setup: Unable to fetch switchbot services data” switchbot integration issue.

Tried adding the SwitchBot lock. I have confirmed that my RPi has bluetooth and it’s enabled. I was able to scan for devices and saw the MAC of the SwitchBot lock.

I am also having the Failed to Connect issue.

When I try adding to the yaml directly, I also get the Unable to fetch switchbot services data.

I even put the lock into setup mode, but it still couldn’t connect the device in the integrations page.

I am ordering a SwitchBot hub mini. Hopefully I can connect to that and use it to control the lock.

I may have to rely on IFTTT to integrate it with HA. Hopefully it won’t come to that.

1 Like

Did you ever get yours to work? Mine is still broken when using running HA inside of a virtual machine without bluetooth.

I have a mini hub so I don’t think my HA server needs to have BT. But maybe the integration is hard-coded to require it.

That might explain why it worked when HA was running on an rpi that has BT. I migrated my HA setup from the rpi to a virtual machine last December and
switchbot hasn’t worked since.

1 Like

Could we get the New devices supported in this integration?
For me the Contact Sensor and the Motion Sensor. I have 2x ESP32’s on order, but on a v. slow boat from China.
Or possibly I’m missing something? I get “Failed to connect” whilst trying to add. I have a Pi 4 which should support Bluetooth.

I have the same error on Home Assistant OS as a VM with a Bluetooth USB adapter forwarded from Proxmox.

Maybe the official integration is only for the Bluetooth module in a Raspberry Pi?

I am having a Raspberry Pi 3 and I am having the same error when trying to add the integration. I dont see any error in the logs. Did anyone made it work?

I have the new Switchbot Thermometer/Hygrometer but I cant even add the integration.

so it appears this integration is broken. shame too, just bought these guys on prime day. guess theyre going back

You could use the API (if you have a hub also) for the time being:

For what it’s worth, when asking about a native hub integration on twitter, one of their founders said they would soon have news.

why would i buy the hub?

I went the esp32 route.

Thats a personal thing and situation ofc. Aside from its actual ‘hub function’, it also is an IR blaster. So it actually has a actual use aside from ‘just being a hub’. But you do need to have a use case for that.

I got mine as part of the amazon deal recently, but it also simply solves the range issue for me personally. My HA is too far away from where the devices are. Even if the integration worked. I do believe the hun also creates a bluetooth mesh, but not looked into that.

ive got dozens of esp32s just lying around. Ive got 3 Harmony hubs, i need not IR my friend. hubs are only good for one thing, talking to the cloud, we try to stay away from that as much as possible here.

I had a similar issue with Rainpoint Smart Irrigation, and I installed the Tuya integration in Home Assistant to solve it. After that, I was able to do everything I wanted. The functionality was a bit limited, but all the important features were available in HA. Unfortunately, I haven’t had the time to test it with the SwitchBot Mini yet, but the app seems to be exactly like Tuya.