Danielhiversen/pySwitchbot

Improve handling of case where connection is closed but we have not yet received a callback yet

Closed this issue · 0 comments

2022-08-19 13:42:30.774 DEBUG (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): communication failed with:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 110, in _sendcommand
    return await self._send_command_locked(key, command)
  File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 237, in _send_command_locked
    await client.start_notify(self._read_char, _notification_handler)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 825, in start_notify
    assert_reply(reply)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.NotConnected] Not Connected
2022-08-19 13:42:30.775 DEBUG (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): Connection already in progress, waiting for it to complete; RSSI: -88
2022-08-19 13:42:30.775 DEBUG (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): Subscribe to notifications; RSSI: -88
2022-08-19 13:42:30.785 DEBUG (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): communication failed with:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 110, in _sendcommand
    return await self._send_command_locked(key, command)
  File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 237, in _send_command_locked
    await client.start_notify(self._read_char, _notification_handler)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 825, in start_notify
    assert_reply(reply)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.NotConnected] Not Connected
2022-08-19 13:42:30.786 DEBUG (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): Connection already in progress, waiting for it to complete; RSSI: -88
2022-08-19 13:42:30.787 DEBUG (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): Subscribe to notifications; RSSI: -88
2022-08-19 13:42:30.797 DEBUG (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): communication failed with:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 110, in _sendcommand
    return await self._send_command_locked(key, command)
  File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 237, in _send_command_locked
    await client.start_notify(self._read_char, _notification_handler)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 825, in start_notify
    assert_reply(reply)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.NotConnected] Not Connected
2022-08-19 13:42:30.798 DEBUG (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): Connection already in progress, waiting for it to complete; RSSI: -88
2022-08-19 13:42:30.798 DEBUG (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): Subscribe to notifications; RSSI: -88
2022-08-19 13:42:30.802 ERROR (MainThread) [switchbot.devices.device] D8-2E-AD-CD-0D-85 (D8:2E:AD:CD:0D:85): communication failed; Stopping trying; RSSI: -88
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 110, in _sendcommand
    return await self._send_command_locked(key, command)
  File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 237, in _send_command_locked
    await client.start_notify(self._read_char, _notification_handler)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 825, in start_notify
    assert_reply(reply)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.NotConnected] Not Connected