import asyncio import sys try: from bleak import BleakScanner, BleakClient except ModuleNotFoundError: print("Error importing bleak, are you sure you installed it?") print("Try running the following command: \"pip3 install bleak\"") print("If that fails, try this: \"pip3 install bleak --break-system-packages\"") sys.exit(1) WRITE_UUID = "6E40FC20-B5A3-F393-E0A9-E50E24DCCA9E" async def send_message(device_name: str, message: str, msg_type: int = 1): print(f"Scanning for {device_name}...") device = await BleakScanner.find_device_by_name(device_name, timeout=10) if not device: print("Watch not found!") return print(f"Found at {device.address}") encoded = message.encode('utf-8') chunks = [encoded[i:i+17] for i in range(0, len(encoded), 17)] async with BleakClient(device) as client: print("Enabling all message notification settings...") settings = bytes([0x02, 0x02, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 3]) await client.write_gatt_char(WRITE_UUID, settings) await asyncio.sleep(1) for i, chunk in enumerate(chunks): packet = bytes([0x23, i, msg_type]) + chunk if i == len(chunks) - 1: packet = packet + bytes([0xFF]) print(f"Sending chunk {i}: {packet.hex()}") try: await client.write_gatt_char(WRITE_UUID, packet) print(f"Sent chunk {i}") except Exception as e: print(f"Failed to send chunk {i}: {e}") await asyncio.sleep(5) if __name__ == "__main__": watch_name = input("Enter watch name (default: Watch ULTRA): ") or "Watch ULTRA" message = input("Enter message to send: ") asyncio.run(send_message(watch_name, message))