mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-26 19:06:11 +01:00
Pre clear retained messagse (#5117)
This commit is contained in:
parent
30f520f6f0
commit
81b3fdb423
@ -139,33 +139,28 @@ class MqttClient(Communicator): # type: ignore[misc]
|
|||||||
)
|
)
|
||||||
|
|
||||||
# register callbacks
|
# register callbacks
|
||||||
|
callback_types = [
|
||||||
|
"recordings",
|
||||||
|
"snapshots",
|
||||||
|
"detect",
|
||||||
|
"motion",
|
||||||
|
"improve_contrast",
|
||||||
|
"motion_threshold",
|
||||||
|
"motion_contour_area",
|
||||||
|
]
|
||||||
|
|
||||||
for name in self.config.cameras.keys():
|
for name in self.config.cameras.keys():
|
||||||
self.client.message_callback_add(
|
for callback in callback_types:
|
||||||
f"{self.mqtt_config.topic_prefix}/{name}/recordings/set",
|
# We need to pre-clear existing set topics because in previous
|
||||||
self.on_mqtt_command,
|
# versions the webUI retained on the /set topic but this is
|
||||||
|
# no longer the case.
|
||||||
|
self.client.publish(
|
||||||
|
f"{self.mqtt_config.topic_prefix}/{name}/{callback}/set",
|
||||||
|
None,
|
||||||
|
retain=True,
|
||||||
)
|
)
|
||||||
self.client.message_callback_add(
|
self.client.message_callback_add(
|
||||||
f"{self.mqtt_config.topic_prefix}/{name}/snapshots/set",
|
f"{self.mqtt_config.topic_prefix}/{name}/{callback}/set",
|
||||||
self.on_mqtt_command,
|
|
||||||
)
|
|
||||||
self.client.message_callback_add(
|
|
||||||
f"{self.mqtt_config.topic_prefix}/{name}/detect/set",
|
|
||||||
self.on_mqtt_command,
|
|
||||||
)
|
|
||||||
self.client.message_callback_add(
|
|
||||||
f"{self.mqtt_config.topic_prefix}/{name}/motion/set",
|
|
||||||
self.on_mqtt_command,
|
|
||||||
)
|
|
||||||
self.client.message_callback_add(
|
|
||||||
f"{self.mqtt_config.topic_prefix}/{name}/improve_contrast/set",
|
|
||||||
self.on_mqtt_command,
|
|
||||||
)
|
|
||||||
self.client.message_callback_add(
|
|
||||||
f"{self.mqtt_config.topic_prefix}/{name}/motion_threshold/set",
|
|
||||||
self.on_mqtt_command,
|
|
||||||
)
|
|
||||||
self.client.message_callback_add(
|
|
||||||
f"{self.mqtt_config.topic_prefix}/{name}/motion_contour_area/set",
|
|
||||||
self.on_mqtt_command,
|
self.on_mqtt_command,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user