From 9365d8c4c9a5f0a45e9eb647f082df2804eadd18 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 6 Apr 2026 07:19:29 -0700 Subject: [PATCH] fix: send proper hello response with version and audio_params ESP32 expects full xiaozhi hello format including version and audio_params, otherwise it disconnects and retries. Co-Authored-By: Claude Opus 4.6 (1M context) --- relay.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/relay.py b/relay.py index 9c8e201..cb8009e 100644 --- a/relay.py +++ b/relay.py @@ -184,11 +184,18 @@ class Relay: msg_type = msg.get("type") if msg_type == "hello": - # Respond with hello ack + # Respond with proper hello — must match xiaozhi protocol resp = { "type": "hello", - "session_id": "relay-session", + "version": 1, "transport": "websocket", + "session_id": "relay-session", + "audio_params": { + "format": "opus", + "sample_rate": ESP_SAMPLE_RATE, + "channels": 1, + "frame_duration": ESP_FRAME_MS, + }, } await self.ws.send(json.dumps(resp)) log.info(f"ESP32 hello: {msg.get('audio_params')}")