OpenWonderLabs / python-host

The python code running on Raspberry Pi or other Linux based boards to control SwitchBot.
Apache License 2.0
376 stars 84 forks source link

Connection Refused (111) #29

Closed negmos closed 2 years ago

negmos commented 2 years ago

I followed the same steps for python3 deployment with a freshly installed ubuntu, but the scanning ending up with:

Scanning for bluetooth low-energy devices Discovering Switchbot services Traceback (most recent call last): File "switchbot_py3.py", line 178, in main() File "switchbot_py3.py", line 153, in main devices = scanner.scan() File "switchbot_py3.py", line 92, in scan return [dev for dev in devices File "switchbot_py3.py", line 93, in if self.is_switchbot(dev, self.bt_interface, self.connect_timeout)] File "switchbot_py3.py", line 74, in is_switchbot with connect(device, bt_interface, timeout) as req: File "/usr/lib/python3.6/contextlib.py", line 81, in enter return next(self.gen) File "switchbot_py3.py", line 45, in connect req.connect(False, 'random') gattlib.BTIOException: connect: Connection refused (111)

While, i try with pybluez, i can see the bot in the list of discovered devices. Any guidance here?

OS: Ubuntu 18.04 Python: 3.6.9 Dongle: CSL - USB Nano V4.0 Bluetooth Adapter Bot: Curtain

negmos commented 2 years ago

I was missing the "sudo apt install bluez" part.. now it works :)...