MQTT

The mqtt
integration allows Viseron to connect to an MQTT broker and publish and subscribe to topics.
It is also used to integrate with Home Assistant.
Configuration
Configuration example
Topics
Viseron internally manages entities, which in turn are published to MQTT topics. Available entity domains are:
binary_sensor
: Binary sensors show on/off statesimage
: Images are published as JPEGssensor
: Sensors show any valuestoggle
: Toggles are used to switch things on or off
You can observe the logs to find the entity ids.
Binary sensor topics
{client_id}/binary_sensor/{camera_identifier}_connected/state
Shows if Viseron is connected to a camera.
Payloads
{client_id}/binary_sensor/{camera_identifier}_recorder/state
Shows whether the recorder is recording or not.
Payloads
{client_id}/binary_sensor/{camera_identifier}_object_detected/state
A JSON formatted payload is published to this topic when any configured label is in the field of view.
Payloads
{client_id}/binary_sensor/{camera_identifier}_object_detected_{label}/state
A JSON formatted payload is published to this topic when a specific configured label is in the field of view.
Payloads
{client_id}/binary_sensor/{camera_identifier}_zone_{zone}_object_detected/state
A JSON formatted payload is published to this topic when any configured label is in the specific zone.
Payloads
{client_id}/binary_sensor/{camera_identifier}_zone_{zone}_object_detected_{label}/state
A JSON formatted payload is published to this topic when a specific configured label is in the specific zone.
Payloads
{client_id}/binary_sensor/{camera_identifier}_motion_detected/state
A JSON formatted payload is published to this topic when motion is detected.
Payloads
{client_id}/binary_sensor/{camera_identifier}_face_detected_{person name}/state
A JSON formatted payload is published to this topic when a tracked face is detected.
Payloads
{client_id}/binary_sensor/{camera_identifier}_still_image_available/state
A JSON formatted payload is published to this topic when still image becomes available/unavailable.
Payloads
Toggle topics
{client_id}/toggle/{camera_identifier}_connection/command
Used for turning on/off a camera. Payload should be ON
or OFF
.
Payloads
{client_id}/toggle/{camera_identifier}_connection/state
Camera connection state.
Payloads
Image topics
{client_id}/image/{camera_identifier}_latest_thumbnail/image
A JPEG encoded image is published to this topic when a new recording starts. The object that triggered the recorder will have its bounding box drawn.
{client_id}/image/{camera_identifier}_latest_thumbnail/attributes
A JSON formatted payload with attributes (currently empty)
Sensor topics
{client_id}/sensor/{camera_identifier}_object_detector_fps/state
A JSON formatted payload is periodically published to with an estimate of the current object detectors processing FPS.
Payloads
{client_id}/sensor/{camera_identifier}_operation_state/state
A JSON formatted payload is published to this topic to indicate the current status of the camera
Payloads
{client_id}/sensor/{camera_identifier}_image_classification/state
Viseron state topic
{client_id}/state
A JSON formatted payload is published to this topic to indicate the current status of Viseron.
Payloads
Last Will Topic
{client_id}/lwt
MQTT Last will and Testament
Payloads
Home Assistant MQTT Discovery
Viseron integrates into Home Assistant using MQTT discovery.
Home Assistant integration is disabled by default. You enable it by adding home_assistant
to your mqtt
config.
Viseron will create a number of entities depending on your configuration.
The paragraphs below show a few of the most notable ones.
Cameras
- A camera entity named
camera.{camera_identifier}_latest_thumbnail
is created.
Sensors
- A status sensor named
sensor.{camera_identifier}_operation_state
is created. The state is set toidle
,recording
,scanning_for_motion
,scanning_for_objects
orerror_scanning_frame
depending on the situation. - A sensor that shows current the object detector FPS.
Binary Sensors
A variable amount of binary sensors will be created based on your configuration.
- An entity showing if any tracked object is in view.
- An entity for each tracked object showing if the label is in view.
- An entity for each zone showing if any tracked object is in the zone.
- An entity for each tracked object in a zone showing if the label is in the zone.
- An entity showing if motion is detected.
- An entity showing if a face is detected.
- An entity showing camera connection.
Switch
- A switch used to arm/disarm a camera. When disarmed, no system resources are used for the camera.
Troubleshooting
mqtt
, add the following to your config.yaml
logger:
logs:
viseron.components.mqtt: debug