aboutsummaryrefslogtreecommitdiff
path: root/FereFit_switchFindBand_BLE.py
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-03-29 15:54:32 +1300
committerArslaan Pathan <[email protected]>2026-03-29 15:54:32 +1300
commit823b8e33b7f7f23515ff6ff6d1dd3179ffa47644 (patch)
tree8adf552d60b1d8b264608766e4e0a9198dad6918 /FereFit_switchFindBand_BLE.py
parent2a1ab7b446f35d9a07d72f7ce737fa63a14e4eb4 (diff)
downloadzwzn-freefit-re-823b8e33b7f7f23515ff6ff6d1dd3179ffa47644.tar.xz
zwzn-freefit-re-823b8e33b7f7f23515ff6ff6d1dd3179ffa47644.zip
feat: switchFindBand
Diffstat (limited to 'FereFit_switchFindBand_BLE.py')
-rw-r--r--FereFit_switchFindBand_BLE.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/FereFit_switchFindBand_BLE.py b/FereFit_switchFindBand_BLE.py
new file mode 100644
index 0000000..065cbb6
--- /dev/null
+++ b/FereFit_switchFindBand_BLE.py
@@ -0,0 +1,35 @@
+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)
+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:
+ packet = bytes([0x51, 0x01])
+ await client.write_gatt_char("6E40FC20-B5A3-F393-E0A9-E50E24DCCA9E", packet)
+ print("Vibrating, waiting 5 seconds then stopping vibration")
+ await asyncio.sleep(5)
+ packet = bytes([0x51, 0x00])
+ await client.write_gatt_char("6E40FC20-B5A3-F393-E0A9-E50E24DCCA9E", packet)
+ print("Stopped vibrating")
+ 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))