controller: fix MQTT topic для motion — frigate/<cam>/motion/state (не /motion)

Frigate publishes на /motion/state ("ON"/"OFF") — а bare /motion это SET-topic
для control. Subscribe pattern был неправильный → bridge не получал motion events
→ red border не загорался при motion.

Live verified после fix: real motion от parking/gate_lpr/back_yard cameras
триггерит upsert cell_<N>_border с motion theme (red #FF0000, 4px, opacity 1.0).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gx
2026-05-20 20:50:20 +01:00
parent 26e9f30990
commit e877a254ce
@@ -83,7 +83,9 @@ class FrigateBridge:
if not self.cfg.enabled:
return []
base = self.cfg.base_topic.rstrip("/")
return [f"{base}/+/motion", f"{base}/events"]
# Frigate publishes state на `frigate/<cam>/motion/state` ("ON"/"OFF"),
# а `frigate/<cam>/motion` — это SET-topic (control). Subscribe строго к /state.
return [f"{base}/+/motion/state", f"{base}/events"]
def _cell_border_id(self, cell: int) -> str:
return f"cell_{cell}_border"
@@ -136,9 +138,9 @@ class FrigateBridge:
base = self.cfg.base_topic.rstrip("/")
# frigate/<cam>/motion
if topic.startswith(f"{base}/") and topic.endswith("/motion"):
cam = topic[len(base) + 1 : -len("/motion")]
# frigate/<cam>/motion/state
if topic.startswith(f"{base}/") and topic.endswith("/motion/state"):
cam = topic[len(base) + 1 : -len("/motion/state")]
await self._handle_motion(cam, payload.strip().upper())
return