mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-26 00:53:54 +08:00
Iot (#126)
* 2025-2-17-iot配置消息处理, 以及控制iot命令发送 (#40) * update:优化 --------- Co-authored-by: Jiao Haoyang <108573524+XuSenfeng@users.noreply.github.com> Co-authored-by: hrz <1710360675@qq.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import json
|
||||
from core.handle.abortHandle import handleAbortMessage
|
||||
from core.handle.helloHandle import handleHelloMessage
|
||||
from core.handle.audioHandle import startToChat
|
||||
from core.handle.iotHandle import handleIotDescriptors
|
||||
|
||||
TAG = __name__
|
||||
logger = setup_logging()
|
||||
@@ -36,5 +37,8 @@ async def handleTextMessage(conn, message):
|
||||
conn.asr_audio.clear()
|
||||
if "text" in msg_json:
|
||||
await startToChat(conn, msg_json["text"])
|
||||
elif msg_json["type"] == "iot":
|
||||
if "descriptors" in msg_json:
|
||||
await handleIotDescriptors(conn, msg_json["descriptors"])
|
||||
except json.JSONDecodeError:
|
||||
await conn.websocket.send(message)
|
||||
|
||||
Reference in New Issue
Block a user