satcar77 / miband4

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

I am getting this TypeError when I am trying to run the main.py file #15

Closed Jhilam2014 closed 4 years ago

Jhilam2014 commented 4 years ago

self._writeCmd("%s %X %s\n" % (cmd, handle, binascii.b2a_hex(val).decode('utf-8'))) TypeError: a bytes-like object is required, not 'str

Jhilam2014 commented 4 years ago

File "main.py", line 70, in main() File "main.py", line 47, in main band.send_alert(ALERT_TYPES.PHONE) File "/home/pi/Documents/miband/Mi_Band_Raspberry_Pi/auth.py", line 301, in send_alert char.write(_type) File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 200, in write return self.peripheral.writeCharacteristic(self.valHandle, val, withResponse) File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 542, in writeCharacteristic self._writeCmd("%s %X %s\n" % (cmd, handle, binascii.b2a_hex(val).decode('utf-8'))) TypeError: a bytes-like object is required, not 'str'