Skip to content

NVR with realtime local object detection for IP cameras

MQTT: Publish "stopped" to available topic on app stop (#22527)

lecceleccec6991db432df
diff --git a/docs/docs/integrations/mqtt.md b/docs/docs/integrations/mqtt.md
index 0a04e7be63..49d1a20e82 100644
--- a/docs/docs/integrations/mqtt.md
+++ b/docs/docs/integrations/mqtt.md
@@ -11,7 +11,8 @@ These are the MQTT messages generated by Frigate. The default topic_prefix is `f
Designed to be used as an availability topic with Home Assistant. Possible message are:
"online": published when Frigate is running (on startup)
-"offline": published after Frigate has stopped
+"stopped": published when Frigate is stopped normally
+"offline": published automatically by the MQTT broker if Frigate disconnects unexpectedly (via MQTT Will Message)
### `frigate/restart`
diff --git a/frigate/comms/mqtt.py b/frigate/comms/mqtt.py
index dfb81fb972..89a986e08c 100644
--- a/frigate/comms/mqtt.py
+++ b/frigate/comms/mqtt.py
@@ -38,6 +38,7 @@ class MqttClient(Communicator):
)
def stop(self) -> None:
+ self.publish("available", "stopped", retain=True)
self.client.disconnect()
def _set_initial_topics(self) -> None: