Switchbot including HUB not reliable

Hi all,

Using the switchbot integration with Hub to control curtains (2 switchbot curtain bot U-rail 2)
Once in a while, I got following error:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/switchbot/cover.py:110
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 22:12:36 (2 occurrences)
Last logged: 22:12:38

[140653044020320] Bluetooth command failed (code: 2, error: Attribute can't be read)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 193, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1704, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1741, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 964, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 717, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/switchbot/cover.py", line 110, in async_close_cover
    await self.hass.async_add_executor_job(self._device.close)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/switchbot/__init__.py", line 648, in close
    result = self._sendcommand(CLOSE_KEY, self._retry_count)
  File "/usr/local/lib/python3.9/site-packages/switchbot/__init__.py", line 418, in _sendcommand
    notify_msg = self._readkey()
  File "/usr/local/lib/python3.9/site-packages/switchbot/__init__.py", line 386, in _readkey
    read_result: bytes = char.read()
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 197, in read
    return self.peripheral.readCharacteristic(self.valHandle)
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 530, in readCharacteristic
    resp = self._getResp('rd')
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 368, in _waitResp
    raise BTLEGattError("Bluetooth command failed", resp)
bluepy.btle.BTLEGattError: Bluetooth command failed (code: 2, error: Attribute can't be read)

Anyone seen this before ?

Thanks !

B.

Perhaps the hub is interfering?

HI @nickrout
Interfering with ? You mean that other devices or BLE channels might interfere with the Switchbot Hub mini ?

Kr,

Bart

Given ble devices generally only support one connection, does your switchbot connect to the hub or the ha bluetooth? Does it switch between them? Why do you use the hub when the ha docs say it is unneccesary?