feat: add MQTT topic parsing and pipeline config

This commit is contained in:
魏风
2026-03-17 13:03:57 +08:00
parent 8aef0b6939
commit 624dcc3bff
11 changed files with 58 additions and 303 deletions

10
backend/app/mqtt/topic.py Normal file
View File

@@ -0,0 +1,10 @@
import re
TOPIC_PATTERN = re.compile(r"^terminal/(?P<device_id>[^/]+)/raw$")
def extract_device_id(topic: str) -> str:
match = TOPIC_PATTERN.match(topic)
if match is None:
raise ValueError("topic must match terminal/{device_id}/raw")
return match.group("device_id")