• Try using the Espruino code from https://www.espruino.com/BLE+Advertising#python

    And then use:

    #!python3
    # Scans for and outputs BLE advertising containing manufacturer data 0x0590
    # needs: `pip install bleak`
    import asyncio
    import array
    from bleak import BleakScanner
    from bleak import BleakClient
    
    async def main():
        stop_event = asyncio.Event()
        
        def callback(device, advertising_data):
            # print(advertising_data)  # debug
            if advertising_data.manufacturer_data and (0x0590 in advertising_data.manufacturer_data):  
              d = advertising_data.manufacturer_data[0x0590]          
              print("Found Espruino Manufacturer data", device)
              if advertising_data.local_name:
                print("  Name: ", advertising_data.local_name);
              print("  Data: ", ", ".join(hex(b) for b in d))
              # You could call stop_event.set() here if you found the device you want
              # and scanning will be stopped
            pass
    
        async with BleakScanner(callback) as scanner:
            await stop_event.wait()
           
    # Start scanning       
    asyncio.run(main())
    

    (I'll update the above link with the Bleak example - previously it only included code for Python Bluepy).

    It should be pretty straightforward to modify it to output accelerometer data, but let me know if you have any issues

About

Avatar for Gordon @Gordon started