Expand description
MQTT publisher: events, health and capabilities.
§Topic layout
dahua/{camera}/event/{kind} detections, retained=false
dahua/{camera}/health latest verdict, retained=true
dahua/{camera}/capability what the device confirmed, retained=true
dahua/{camera}/status online/offline, retained=true + LWT§Retain, and when not to
Health, capabilities and status are retained: a dashboard connecting ten minutes after the service started should immediately know the current state rather than waiting for the next change.
Events are not retained. A retained detection is a detection that stays true on the broker forever — a subscriber connecting tomorrow would be told about motion from yesterday as though it were happening now. That is the MQTT equivalent of the latched-alarm trap, and it is worse, because the broker keeps telling everyone.
§Last Will
The publisher registers a Last Will on status so that a subscriber can
tell “the service says nothing is happening” from “the service is gone”.
Without it those are indistinguishable, which — given the safety notice
below — is exactly the confusion to avoid.
§⚠ Safety
Detections published here are an operator aid and are not
safety-rated. Every event payload carries the notice inline. Absence of
a message means nothing: no detection, a dead link, and a stopped service
all look identical to a subscriber. Never drive machine motion from this
feed. See SAFETY.md.
Structs§
- Message
- A message ready to publish.
Enums§
- Qos
- Delivery guarantee for a message.
Constants§
- SAFETY_
NOTICE - The notice carried inline in every detection payload.
- TOPIC_
ROOT - Root of every topic this crate publishes.
Traits§
- Mqtt
Transport - The transport under the publisher.
Functions§
- capability_
message - A capability message. Retained: it changes essentially never.
- event_
message - A detection message.
- health_
message - A health message. Retained: current state matters more than its history.
- last_
will - The Last Will message for a camera.
- online
- The message announcing that a camera’s publisher is live.
- publish_
event - Publish an event through a transport.
- status_
topic - The
statustopic for a camera, used for both liveness and the Last Will.