<< Click to display Table of Contents >> Navigation: Interfaces > MQTT > Connection to bestinformed > Connection to Cordaware bestinformed |
After successfully connection between broker and client and the authentication of the external MQTT client, the procedure of the connection to Cordaware bestinformed displays like the following:
MQTT transport event to Cordaware bestinformed interface:
As soon as an event happens, the external MQTT client receives the according information e. g. of an alarm system (or its broker) and sends this event via a defined Topic (e. g. to /bestinformed/mqtt/m2i) to the Cordaware bestinformed interface/broker. This will process the event and hand over the transmitted details or actions to the Cordaware bestinformed server. Corresponding tasks will be processed from Cordaware bestinformed and automatically executed (e. g. the call up and distribution of a template).
For the correct process, the data need to be present via MQTT in a JSON file format for the Cordaware bestinformed broker.
Sending out messages via the MQTT interface
In order to send out an info via the MQTT interface you first need to create a password for the user in the Password app.
Click on the button and enter an alias for your MQTT username "mqtt_<user>".
Optionally a description can be entered.
Afterwards you need to enter and confirm the password.
For example the admin with the password Cordaware bestinformed would be entered like this:
Transmission examples:
This examples will show, which syntax is used, in order to distribute a template automatically via the interfaces of Cordaware bestinformed.
To demonstrate, the file format for the MQTT transmission (JSON) in comparison to syntax for a MailToInfo transfer will be displayed.
MQTT (JSON) |
MailToInfo |
||
Host |
bestinformed.cordaware.local |
SMTP-Server |
bestinformed.cordaware.local |
Port |
1883 |
Port |
8025 |
User |
mqtt_admin |
Sender |
can be chosen |
Password |
bestinformed |
Recipient |
can be chosen |
Topic |
bestinformed/mqtt/m2i |
Subject |
newinfo |
Message |
{ "action": "newinfo", "templatename": "Chemicals" } |
Message |
username=admin password=bestinformed templatename=Chemicals |
To simplify the gerneration of the correct syntax, the required syntax can be viewed via the web interface of Cordaware bestinformed.
For this, create the desired settings in the Info or Template and convert your text via the according buttons in the interface of the Infoeditor.
MQTT (JSON) |
MailToInfo |
The following syntax shows the conversion of an Info into the JSON format: (without Template):
|
The conversion in MailtToInfo systax:
|
Message distribution:
Next to the values of a Template, additional criteria are relevant properties to define an Info via the Cordaware bestinformed interfaces.
In principle, the parameter "action" defines the action of an outgoing Info in Cordaware bestinformed. Here you have the following possibilities:
newinfo - Creates a new Info.
editinfo - Edits an existing info
cancelinfo - Cancel an Info.
copycancel - Cancels and existing info and sends out an all clear
To cancel Infos which were created via MailToInfo or MQTT interfaces, it is necessary to define a unique ID vid the keyvalue myid= while creating your Info.
This step is not necessary, regardless we recommend to always create Infos via MQTT and MailToInfo with an unique ID, which can later be canceled via the same interface. Without an ID, this can only done via the web interface.
Please note:
For the myid, you can use any letters, numbers as well as hyphens. |
Example with an ID
In the following example a new info will be created which will use the "chemicals" template as well as the ID "bi-info_mqtt_0123456789abcdef".
{ "action": "newinfo", "myid": "bi-info_mqtt_0123456789abcdef", "templatename": "chemicals" } |
Example for the editing of an existing info
In this example the already existing info will now be edited.
{ "action": "editinfo", "myid": "bi-info_mqtt_0123456789abcdef", "info": "Toxic chemicals have been leaked. Please close all doors and windows!" } |
Example for the cancellation of an info
Now the Info will be canceled via the MQTT interface.
{ "action": "cancelinfo", "myid": "bi-info_mqtt_0123456789abcdef" } |
Cancellation and all clear of infos
In order to send out an all clear for infos via the MQTT interface ("copycancel") an all clear needs to be added to the info beforehand.
If no template is used, the key "info_10000" needs to be added to the all clear.
{ "action": "newinfo", "myid": "bi-info_mqtt_0123456789abcdef_2", "info": "The text of an info.", "info_10000": "The all clear text of an info." } |
This info can then be canceled and cleared via "copycancel" by using the "myID". This way the all clear will be sent out immediately.
{ "action": "copycanel", "myid": "bi-info_mqtt_0123456789abcdef_2" } |
The all clear info can be edited and canceled via the MQTT interface as well.
The "myID" needs to be added with the suffix "allclear" in order to do so.
For example the ID "bi-info_mqtt_0123456789abcdef_2" turns into the all clear ID "bi-info_mqtt_0123456789abcdef_2_allclear".
Example for the edition of an all clear info
In this example the all clear will be editited.
{ "action": "editinfo", "myid": "bi-info_mqtt_0123456789abcdef_2_allclear", "info": "Edited infotext." } |
Example for the cancellation of an all clear
In this example the all clear of the previous info will be canceled.
{ "action": "cancelinfo", "myid": "bi-info_mqtt_0123456789abcdef_2_allclear" } |
General functionality
Both options/tasks will be transferred in the occurance of a new event from external MQTT client to the pre defined Topic and thus the MQTT broker. This initiates together with the likewise included details of the event the next steps, such as the message distribution in Cordaware bestinformed.