Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant Connect #18

Open
asifma opened this issue Sep 29, 2020 · 6 comments
Open

Cant Connect #18

asifma opened this issue Sep 29, 2020 · 6 comments

Comments

@asifma
Copy link

asifma commented Sep 29, 2020

Hi,
Probably not an issue in the script, but do you have any experience of this?

root@raspberrypi:/home/pi/pycalima# python3 cmdline.py -m 58:2b:db:02:37:64 -p 7926XXXX
Traceback (most recent call last):
  File "cmdline.py", line 134, in <module>
    main()
  File "cmdline.py", line 80, in main
    fan = Calima(mac_address, pincode)
  File "/home/pi/pycalima/pycalima/Calima.py", line 79, in __init__
    self.conn = ble.Peripheral(deviceAddr=addr)
  File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 391, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.7/dist-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 58:2b:db:02:37:64, addr type: public
Exception ignored in: <function Calima.__del__ at 0x7650fae0>
Traceback (most recent call last):
  File "/home/pi/pycalima/pycalima/Calima.py", line 83, in __del__
    self.conn.disconnect()
AttributeError: 'Calima' object has no attribute 'conn'
@PatrickE94
Copy link
Owner

This, sadly, don't say more than that the bluez stack failed to connect with the BLE device. If you retry a few times does it ever work? Does it work with the App in the phone?

@Nornode
Copy link

Nornode commented Mar 15, 2021

I had similar error messages when the device was too faar away from the fan.
Try moving it closer, it worked for me.

@pecuna
Copy link

pecuna commented Nov 16, 2021

I have the same problem on Armbian Bullseye.
The setup worked for some time on Armbian Buster.
But after switching to Bulsseye I cant connect to the fan.
Tried different bluepy versions from pip repo.
The fan is visible via scanning. The distance between the devices is the same as before.

python3 cmdline.py -m 58:2b:db:34:2c:e0 -p 9XXXXXXX

Traceback (most recent call last):
  File "/usr/share/hassio/homeassistant/custom_components/pycalima/pycalima/cmdline.py", line 134, in <module>
    main()
  File "/usr/share/hassio/homeassistant/custom_components/pycalima/pycalima/cmdline.py", line 80, in main
    fan = Calima(mac_address, pincode)
  File "/usr/local/lib/python3.9/dist-packages/Calima-2.0.0-py3.9.egg/pycalima/Calima.py", line 79, in __init__
    self.conn = ble.Peripheral(deviceAddr=addr)
  File "/usr/local/lib/python3.9/dist-packages/bluepy/btle.py", line 353, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.9/dist-packages/bluepy/btle.py", line 401, in _connect
    raise BTLEException(BTLEException.DISCONNECTED,
bluepy.btle.BTLEException: Failed to connect to peripheral 58:2b:db:34:2c:e0, addr type: public
Exception ignored in: <function Calima.__del__ at 0xb66326a0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/Calima-2.0.0-py3.9.egg/pycalima/Calima.py", line 83, in __del__
AttributeError: 'Calima' object has no attribute 'conn'

@philsson
Copy link

philsson commented Nov 22, 2021

I can confirm this as well. Tried on both raspberry os on a pi zero and ubuntu server on a rpi 4. After a few retries though it works so it might just be the distance as @Nornode pointed out

@larsgu
Copy link

larsgu commented Dec 12, 2022

I have the same exact issue as described, running on a pi zero with Raspbian Bullseye.
Moreover, the thoughts on closing the distance and making several attempts have no impact. (My Pi zero is within a few feet and has been moved in different directions in the same range. I have also made 20+ attempts to connect, without success.)

The cmdline.py -l command works fine and lists my one device, so logically it should be in range to connect. Connecting via the Android app also works fine.

@larsgu
Copy link

larsgu commented Dec 12, 2022

I have the same exact issue as described, running on a pi zero with Raspbian Bullseye. Moreover, the thoughts on closing the distance and making several attempts have no impact. (My Pi zero is within a few feet and has been moved in different directions in the same range. I have also made 20+ attempts to connect, without success.)

The cmdline.py -l command works fine and lists my one device, so logically it should be in range to connect. Connecting via the Android app also works fine.

I finally managed to resolve my connect issue, though I'm not sure what was the key step:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants