What is MQTT and how does it work (Bosch ONVIF Profile M)?
“MQTT is a Client Server publish/subscribe messaging transport protocol. It is light weight, open, simple, and designed so as to be easy to implement. These characteristics make it ideal for use in many situations, including constrained environments such as for communication in Machine to Machine (M2M) and Internet of Things (IoT) contexts where a small code footprint is required and/or network bandwidth is at a premium.” (Citation from Official MQTT 3.1.1 specification)
MQTT Key Features
The Client and the Broker
E.g:
This is a Topic: “BoschCamera1/onvif-ej/RuleEngine/CountAggregation/Counter/&1/Counter 4”
Data contains in this topic are: UtcTime, Source, Data
Subscribing to Topics
‒BoschCamer1/onvif-ej/RuleEngine/CountAggregation/Counter/&1/Counter_1
‒BoschCamer1/onvif-ej/RuleEngine/CountAggregation/Counter/&1/#
‒This means all topics that starts with
“BoschCamer1/onvif-ej/RuleEngine/CountAggregation/Counter/&1/” will be subscribed, e.g:
BoschCamer1/onvif-ej/RuleEngine/CountAggregation/Counter/&1/Counter_1
BoschCamer1/onvif-ej/RuleEngine/CountAggregation/Counter/&1/Counter_2
BoschCamer1/onvif-ej/RuleEngine/CountAggregation/Counter/&1/Counter_3
“BoschCamer1/onvif-ej/RuleEngine/CountAggregation/Counter/+/Counter_1”
‒This means all topics that starts with:
“BoschCamer1/onvif-ej/RuleEngine/CountAggregation/Counter/”
and ends with “/Counter_1” will be subscribed. It is not too useful in our usage, cause the Topics created in the camera does not utilize this wildcard much.
‒Here is an example, not use in ONVIF Profile M MQTT but to allows you to understand how to use the plus wildcard.
‒For example, you have in an home automation, the following topics
house/room1/main-light
house/room2/main-light
house/room3/main-light
‒By subscribing to “house/+/main-light” you will be subscribed to all the 3 topics.
NOTE:
The followings are links to website and video that gives you a better understanding of what MQTT does.
Supported hardware & Software
Supported Cameras :
-CPP 6, 7 and 7.3
- Firmware 7.81.0060 and above.
-CPP 13 & 14
- Firmware 8.71.0066 and above.
Supported software:
-MQTT broker 3.1 & 3.11 (5.0 still unknown if we can support)
-Configuration Manager 7.50 and above is required to configure MQTT in the cameras
-Support MQTT configuration in Configuration Manager when camera is added as ONVIF camera or Bosch native camera.
MQTT Topics defines what are the data you can receive from the camera. For Bosch cameras, there are 5 main Topics :
1.RuleEngine Topic
2.IVA Topic
3.VideoSource Topic
4.Device Topic
5.RecordingConfig Topic
Note: recall what is a topic looks like :
“BoschCamera1/onvif-ej/RuleEngine/CountAggregation/Counter/&1/Counter 4”
1. RuleEngine Topics:
RuleEngine Topics has 3 sub-topics:
1.CounterAggregation: Provides the IVA counter/occupancy value
2.FieldDetector: Provides the event status of Loitering, Object in Field, Idle object & remove object.
3.LineDetector: Is triggered when object crosses an IVA line, Enter a field or Existed a field
Note : currently ONVIF Profile M do not have any defined VCA rule for Follow Route and Crowd Detection. These 2 rules event is currently temporary place under SignalLoss Topics.
Note: recall what is a topic looks like :
“BoschCamera1/onvif-ej/RuleEngine/CountAggregation/Counter/&1/Counter 4”
2. IVA Topics:
IVA Topics are customized Topics only Bosch camera has and it has 9 sub-topics:
1.ObjectInField
2.Loitering
3.CrowdDetection
4.EnteringField
5.LeavingField
6.IdleObject
7.RemovedObject
8.FollowingRoute
9.Counter
These are events status, only when the event is been triggered will the camera publish these status. Do note for Counter and CrowdDetection, it will only triggers if you have configured the IVA rule to trigger an alarm when counter or crowd reaches a threshold.
3. VideoSource Topics
VideoSource Topics are related to “tamper” alarms and it has 5 sub-topics:
1.MotionAlarm
2.SignalLoss
3.GlobalSceneChange
4.ImageTooBright
5.ImageTooDark
The events are self explanatory.
MotionAlarm will trigger whenever there is any IVA or motionplus alarm, it does not tell you what causes the alarm.
4. Device Topics:
Device Topics has 2 sub-topics:
1.Relay
2.DigitalInput
These are status events for the cameras inputs and outputs.
5. RecordingConfig Topics:
RecordingConfig Topics has 1 sub-topic, it publish a message when the camera start recording.
Follow this article and find out: