Switchbot stopped working. Logs included

Hi,
HA is not connecting to my Switchbot. It’s been working for well over a year.
Config:
rPi 4
HA version info:
core-2021.3.4
supervisor-2021.03.6
Home Assistant OS 5.12
Configuration.yaml hasn’t changed.

Any help much appreciated.

Logs: (MAC address masked)

2021-03-26 15:31:55 WARNING (SyncWorker_5) [switchbot] Cannot connect to Switchbot. Retrying (remaining: 1)...
2021-03-26 15:31:57 WARNING (SyncWorker_5) [switchbot] Error talking to Switchbot.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/switchbot/__init__.py", line 92, in _sendcommand
    self._connect()
  File "/usr/local/lib/python3.8/site-packages/switchbot/__init__.py", line 45, in _connect
    self._device = bluepy.btle.Peripheral(self._mac,
  File "/usr/local/lib/python3.8/site-packages/bluepy/btle.py", line 391, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.8/site-packages/bluepy/btle.py", line 439, in _connect
    raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral E3:xx:xx:xx:xx:xx, addr type: random

Battery on the device is not dead? You have not moved the bot to another location that is further away from HA?

Battery is fine. The Switchbot app on my iPhone works great and says the battery is full. The Pi and the switchbot have not moved in a year.

Nobody?

I’m guessing that bluetooth drivers somehow got messed up in the latest OS release. Is there somewhere we can file a proper bug report so someone can investigate?

I checked… Bluetooth seems to be working on this Pi4. I now think the problem is in the Switchbot support in Home Assistant.

Yea sorry. I don’t use the Switchbot Integraton as my devices are just shy out of range. There is other option to try if you have an ESP32 Microprocessor.

I am sure there are others who use the integration and if they have issue, it should be posted.

I’d really rather not go the ESP32 route… The integration has been working for well over a year… probably more like 2 or 3 years.

I’m also seeing this issue. Switchbot was working flawless with no timeouts.

All of the sudden, this started happening and I receive the timeout error constantly.

I have full battery and close proximity to home assistant.

Same here.

Same Problem here

Same, new install and switchbot is fine via phone app. rpi3b just does nothing

1 Like

same here, new install on rpi4.

I’ve started noticing issues recently. I have 2 SwitchBot Curtains and using HACS’s SwitchBot Curtain. HA is throwing errors like this one:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 350, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 558, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/switchbot-curtain/cover.py", line 164, in update
    self._device.update()
  File "/usr/local/lib/python3.8/site-packages/switchbot/__init__.py", line 189, in update
    devices = bluepy.btle.Scanner().scan(scan_timeout)
  File "/usr/local/lib/python3.8/site-packages/bluepy/btle.py", line 854, in scan
    self.stop()
  File "/usr/local/lib/python3.8/site-packages/bluepy/btle.py", line 803, in stop
    self._mgmtCmd(self._cmd()+"end")
  File "/usr/local/lib/python3.8/site-packages/bluepy/btle.py", line 309, in _mgmtCmd
    rsp = self._waitResp('mgmt')
  File "/usr/local/lib/python3.8/site-packages/bluepy/btle.py", line 362, in _waitResp
    raise BTLEDisconnectError("Device disconnected", resp)
bluepy.btle.BTLEDisconnectError: Device disconnected

Is your mac address lowercase in your configuration.yaml? Was having the same “Failed to connect” problem with a brand new switchbot, changed my mac address from uppercase to lowercase and it’s working now.

I have 2 Switchbot curtain pairs that ran flawlessly for a couple of months. Since updating to 2021.12 they are dropping out, getting unavailable a couple of hours after reboot.

I don’t see related errors in the log after they go unavailable. Also, sometimes one of the two in a pair goes unavailable, while the other is still there. Does someone have ideas on how to troubleshoot these kind of issues?

I just installed HA OS and using the official integration, it finds my SwitchBot curtain and gets the state and other details of the device but I just can’t control it. Still need to dig into logs but yea I cannot control it at all.

same for me! Can see everything of status of 2 curtains & 2 buttons, but can’t control them…
Can control them in the switchbot app or via Homey, but not via Home Assistant…