#!/usr/bin/env python # -*- mode: python; coding: utf-8 -*- # # Read data from Xiaomi M365 Scooter from gattlib import GATTRequester, GATTResponse from struct import * from time import sleep from binascii import hexlify MASTER_TO_M365 = 0x20 M365_TO_MASTER = 0x23 BATTERY_TO_MASTER = 0x25 DISTANCE_INFO = 0x25 TRIP_INFO = 0xb0 BATTERY_INFO = 0x31 class Requester(GATTRequester): def on_notification(self, handle, data): payload = data[3:] # print hexlify(payload) if len(payload) > 8: data_type, address = unpack('