drndos / mikettle

Xiaomi Mi Kettle Bluetooth Library
MIT License
54 stars 23 forks source link

connection loss when getting data #7

Closed thymjan closed 4 years ago

thymjan commented 4 years ago

Tried to hack my new MiKettle with your python script, thank you for fiddling this out!

It seems to connect for a short period of time. The little bell sound from the kettle appears, the connection is lost.

Debug information:

pi@raspberry:~/mikettle $ python3 demo.py connect XX:XX:XX:XX:XX:XX 275
DEBUG:mikettle.mikettle:Init Mikettle with mac XX:XX:XX:XX:XX:XX and pid 275
Authenticating
Getting data from mi Kettle
FW: 7.5.10
Traceback (most recent call last):
  File "demo.py", line 78, in <module>
    main()
  File "demo.py", line 74, in main
    args.func(args)
  File "demo.py", line 47, in connect
    print("Name: {}".format(kettle.name()))
  File "/home/pi/mikettle/mikettle/mikettle.py", line 87, in name
    self.connect()
  File "/home/pi/mikettle/mikettle/mikettle.py", line 82, in connect
    self._p = Peripheral(deviceAddr=self._mac, iface=self._iface)
  File "/home/pi/.local/lib/python3.7/site-packages/bluepy/btle.py", line 391, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/home/pi/.local/lib/python3.7/site-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 XX:XX:XX:XX:XX:XX, addr type: public

Can you give me a hint, how to get in this further?

thymjan commented 4 years ago

The issue was already discussed here: https://github.com/drndos/mikettle/issues/4#issue-546937298