creotiv / MiBand2

Library to work with Xiaomi MiBand 2
Creative Commons Zero v1.0 Universal
544 stars 173 forks source link

Device is not connecting error #8

Open skysnigdha opened 6 years ago

skysnigdha commented 6 years ago

Hi, After connecting the device through bluetooth, I have run the example.py. I am getting error at line number 410 saying Failed to connect to the peripheral. The error remains even if the addrType is changed from random to public.

creotiv commented 6 years ago

this basically saying that you have problems with your hardware or drivers for it. Which OS are you running?

skysnigdha commented 6 years ago

linux 16.04

On 3 June 2018 at 22:49, Andrey Nikishaev notifications@github.com wrote:

this basically saying that you have problems with your hardware or drivers for it. Which OS are you running?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/creotiv/MiBand2/issues/8#issuecomment-394177074, or mute the thread https://github.com/notifications/unsubscribe-auth/ATuU50c5d4Iod9o7LPGdaD_SZ3sM1qzRks5t5Bq_gaJpZM4UIWC1 .

-- Thanks and Regards, Snigdha

theidexisted commented 6 years ago

I have faced the same problem, my firmware version is 1.0.1.81,

the error message:

-> sudo python example.py XXXXXXXXXX init
2018-06-20 20:52:56,366 MiBand2 (INFO) > Connecting to XXXXXXXXXX
Running  /usr/local/lib/python2.7/dist-packages/bluepy/bluepy-helper
Sent:  conn XXXXXXXXXX random

Got: "rsp=$stat state=$tryconn dst='XXXXXXXXXX mtu=h0 sec='low\n"
Got: "rsp=$stat state=$disc mtu=h0 sec='low\n"
Stopping  /usr/local/lib/python2.7/dist-packages/bluepy/bluepy-helper
Traceback (most recent call last):
  File "example.py", line 8, in <module>
    band = MiBand2(MAC, debug=True)
  File "/home/chaos/dev/open-source/monitor/MiBand2/base.py", line 76, in __init__
    Peripheral.__init__(self, mac_address, addrType=ADDR_TYPE_RANDOM)
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 353, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 402, in _connect
    "Failed to connect to peripheral %s, addr type: %s" % (addr, addrType))
bluepy.btle.BTLEException: Failed to connect to peripheral XXXXXXXXXX, addr type: random
creotiv commented 6 years ago

Guys sorry, but i can't debug hardware problems without hardware.

theidexisted commented 6 years ago

This issues is very similar with my, i will try their method, https://github.com/IanHarvey/bluepy/issues/105

theidexisted commented 6 years ago

After switching to another laptop, the problem is gone, so it's indeed a hardware problem, I will try to find the root cause.