Set commands before subscribing to messages (#7550)

This commit is contained in:
Nicolas Mowen 2023-09-01 06:06:59 -06:00 committed by GitHub
parent 7069ef93bb
commit bd0d16a75b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,9 +52,6 @@ class Dispatcher:
self.ptz_metrics = ptz_metrics
self.comms = communicators
for comm in self.comms:
comm.subscribe(self._receive)
self._camera_settings_handlers: dict[str, Callable] = {
"audio": self._on_audio_command,
"detect": self._on_detect_command,
@ -67,6 +64,9 @@ class Dispatcher:
"snapshots": self._on_snapshots_command,
}
for comm in self.comms:
comm.subscribe(self._receive)
def _receive(self, topic: str, payload: str) -> None:
"""Handle receiving of payload from communicators."""
if topic.endswith("set"):