Python Client¶
Any WebSocket library works with the Gateway API. The SDK ships a ready-made test client you can use to verify a connection without the mobile app.
Install¶
pip install websockets
test_client.py¶
The Gateway repository includes gateway/deploy/test_client.py. It connects, sends a harmless
mock move, and prints three status frames:
python3 test_client.py # connects to 192.168.10.101
python3 test_client.py 10.0.0.42 # or pass a custom IP
Expected output:
Verbinde mit ws://192.168.10.101:8765/ws ...
Verbunden. Sende Test-Move (vx=0.1) ...
Status: {'type': 'status', 'battery': 95, 'mode': 'damp', 'warning': None}
...
OK - Gateway antwortet.
Writing your own client¶
import asyncio, json, websockets
class UmeClient:
def __init__(self, host="192.168.10.101", port=8765):
self.uri = f"ws://{host}:{port}/ws"
async def run(self):
async with websockets.connect(self.uri) as ws:
await ws.send(json.dumps({"type": "mode", "mode": "prep"}))
await ws.send(json.dumps({"type": "mode", "mode": "walk"}))
await ws.send(json.dumps({"type": "move", "vx": 0.3, "vy": 0, "wz": 0}))
async for raw in ws:
print(json.loads(raw))
asyncio.run(UmeClient().run())
Test safely
Run the Gateway with --mock while developing. In mock mode every command is validated and
logged, status is streamed, but no motion is executed — see
Gateway Deployment.