satcar77 / miband4

Access Xiaomi MiBand 4 from Linux using Bluetooth LE
MIT License
483 stars 110 forks source link

Mi band 6 support #52

Open NeptunePy opened 3 years ago

NeptunePy commented 3 years ago

I have problems with the mi band 6, can you add support for the mi band 6 please?

Thanks.

janvda commented 3 years ago

@Flodr can you provide more details about the issue you are having with mi band 6 ?

NeptunePy commented 2 years ago

Hello, with the mi band 6, none of the available options work, for example the first option shows this:

Exception in thread Thread-1: Traceback (most recent call last): File "/home/flo/.pyenv/versions/3.9.7/lib/python3.9/threading.py", line 973, in _bootstrap_inner self.run() File "/home/flo/.pyenv/versions/3.9.7/lib/python3.9/threading.py", line 910, in run self._target(*self._args, **self._kwargs) File "/home/flo/.pyenv/versions/3.9.7/lib/python3.9/site-packages/cursesmenu/curses_menu.py", line 133, in _wrap_start curses.wrapper(self._main_loop) File "/home/flo/.pyenv/versions/3.9.7/lib/python3.9/curses/__init__.py", line 94, in wrapper return func(stdscr, *args, **kwds) File "/home/flo/.pyenv/versions/3.9.7/lib/python3.9/site-packages/cursesmenu/curses_menu.py", line 193, in _main_loop self.process_user_input() File "/home/flo/.pyenv/versions/3.9.7/lib/python3.9/site-packages/cursesmenu/curses_menu.py", line 289, in process_user_input self.select() File "/home/flo/.pyenv/versions/3.9.7/lib/python3.9/site-packages/cursesmenu/curses_menu.py", line 329, in select self.selected_item.action() File "/home/flo/.pyenv/versions/3.9.7/lib/python3.9/site-packages/cursesmenu/items/function_item.py", line 35, in action self.return_value = self.function(*self.args, **self.kwargs) File "/home/flo/Documents/miband4/miband4_console.py", line 93, in general_info print ('Serial:',band.get_serial()) File "/home/flo/Documents/miband4/miband.py", line 421, in get_serial return serial.decode('utf-8') AttributeError: 'NoneType' object has no attribute 'decode'

sorry for the late response.

os : Linux Mint

niceboygithub commented 2 years ago

Testing on Mi Band 6 NFC with raspberry pi 3.

the command:

python3 miband4_console.py -m 11:50:33:4D:66:997 -k C11D22D8F33449DDC55686FE3F8C9EAB

the logs:

Exception in thread Thread-1:o be displayed: test
Traceback (most recent call last): characters per line, and up to 6 lines. To add a new line use new line character
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run() message to be displayed: message test
  File "/usr/lib/python3.7/threading.py", line 865, in runl: 2
    self._target(*self._args, **self._kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/curses_menu.py", line 133, in _wrap_start
    curses.wrapper(self._main_loop)
  File "/usr/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/curses_menu.py", line 193, in _main_loop
    self.process_user_input()
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/curses_menu.py", line 289, in process_user_input
    self.select()
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/curses_menu.py", line 329, in select
    self.selected_item.action()
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/items/function_item.py", line 35, in action
    self.return_value = self.function(*self.args, **self.kwargs)
  File "miband4_console.py", line 109, in send_notif
    band.send_custom_alert(a[ty-1],title,msg)
  File "/home/pi/miband4/miband.py", line 305, in send_custom_alert
    svc = self.getServiceByUUID(UUIDS.SERVICE_ALERT_NOTIFICATION)
  File "/home/pi/.local/lib/python3.7/site-packages/bluepy/btle.py", line 488, in getServiceByUUID
    rsp = self._getResp('find')
  File "/home/pi/.local/lib/python3.7/site-packages/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/home/pi/.local/lib/python3.7/site-packages/bluepy/btle.py", line 362, in _waitResp
    raise BTLEDisconnectError("Device disconnected", resp)
bluepy.btle.BTLEDisconnectError: Device disconnected
radu022003 commented 2 years ago

Testing on Mi Band 6 NFC with raspberry pi 3.

the command:

python3 miband4_console.py -m 11:50:33:4D:66:997 -k C11D22D8F33449DDC55686FE3F8C9EAB

the logs:

Exception in thread Thread-1:o be displayed: test
Traceback (most recent call last): characters per line, and up to 6 lines. To add a new line use new line character
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run() message to be displayed: message test
  File "/usr/lib/python3.7/threading.py", line 865, in runl: 2
    self._target(*self._args, **self._kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/curses_menu.py", line 133, in _wrap_start
    curses.wrapper(self._main_loop)
  File "/usr/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/curses_menu.py", line 193, in _main_loop
    self.process_user_input()
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/curses_menu.py", line 289, in process_user_input
    self.select()
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/curses_menu.py", line 329, in select
    self.selected_item.action()
  File "/home/pi/.local/lib/python3.7/site-packages/cursesmenu/items/function_item.py", line 35, in action
    self.return_value = self.function(*self.args, **self.kwargs)
  File "miband4_console.py", line 109, in send_notif
    band.send_custom_alert(a[ty-1],title,msg)
  File "/home/pi/miband4/miband.py", line 305, in send_custom_alert
    svc = self.getServiceByUUID(UUIDS.SERVICE_ALERT_NOTIFICATION)
  File "/home/pi/.local/lib/python3.7/site-packages/bluepy/btle.py", line 488, in getServiceByUUID
    rsp = self._getResp('find')
  File "/home/pi/.local/lib/python3.7/site-packages/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/home/pi/.local/lib/python3.7/site-packages/bluepy/btle.py", line 362, in _waitResp
    raise BTLEDisconnectError("Device disconnected", resp)
bluepy.btle.BTLEDisconnectError: Device disconnected

I am experiencing the same. I would gladly help to solve the problem if needed.