diff options
| author | Arslaan Pathan <[email protected]> | 2026-03-29 14:53:48 +1300 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-03-29 14:53:48 +1300 |
| commit | 6f1e4aa35cb206c066e8395489c3d514b8079375 (patch) | |
| tree | 56e3412b0378df698e9a6050980baa2c485ed3b5 /FereFit_BLE_test.py | |
| download | zwzn-freefit-re-6f1e4aa35cb206c066e8395489c3d514b8079375.tar.xz zwzn-freefit-re-6f1e4aa35cb206c066e8395489c3d514b8079375.zip | |
Initial commit
Diffstat (limited to 'FereFit_BLE_test.py')
| -rw-r--r-- | FereFit_BLE_test.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/FereFit_BLE_test.py b/FereFit_BLE_test.py new file mode 100644 index 0000000..59efac0 --- /dev/null +++ b/FereFit_BLE_test.py @@ -0,0 +1,26 @@ +import asyncio +from bleak import BleakScanner, BleakClient +import time, calendar + +async def sync(device_name: str): + 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}") + try: + async with BleakClient(device) as client: + ts = int(time.time()) + offset = calendar.timegm(time.localtime()) - calendar.timegm(time.gmtime()) + packet = bytes([0x01]) + ts.to_bytes(4,'big') + offset.to_bytes(4,'big') + bytes([0,0,0]) + await client.write_gatt_char("6E40FC20-B5A3-F393-E0A9-E50E24DCCA9E", packet) + print(f"Time synced! ts={ts} offset={offset}") + except Exception as e: + print(f"Failed: {e}") + +if __name__ == "__main__": + watch_name = input("Enter watch name shown in BLE discovery (default: Watch ULTRA): ") + if watch_name == "": + watch_name = "Watch ULTRA" + asyncio.run(sync(watch_name)) |
