Looking for something else?
EOS – AN4: MQTT connection to Cervello Stem
Table of Contents
The first thing we have to do is create a device on the Cervello Stem platform and then be able to connect it.
From the inventory menu, we will click on NEW DEVICE:
A new menu “add Device” will open. Here we will select Create Single Device:
And we will fill in the required fields:
We see how a new device has been created for us.
Next, we will click on Credentials to be able to obtain the access credentials that will be necessary to configure the router.
Now we go to the router menu “Serial and SMS” and click on MQTT.
Here we will enable the mqtt client and fill in the fields as below:
In the client ID we will use the client created previously.
In the User Name, we will use the Access key created earlier
In the password, we will use the Access Token created previously.
The router’s DNS frame must be sent to the topic / device / [ClientID] / attribute
All the information of interest will be published here. DNS field publish topic.
We also have to configure the Heartbeat Interval fields, which will be the time interval in seconds that the device must pass without being connected to the broker to restart the connection.
Update Interval will be the frequency in seconds with which the device will send the DNS frame to Cervello
For the management of the device by mqtt, the router must subscribe to the Commands topic and must publish the response in the Command Response topic.
We can see all the predefined topics in Cervello Stem by clicking on the Topics tab:
We can see all the predefined topics in Cervello stem by clicking on the Topics tab:
Once all this is configured in the MTX-Router-EOS, we will apply the changes and save:
We can see how the device appears as connected below:
From the Administration menu, we can see in the syslog how it connects to the mqtt broker:
In Cervello it will also appear as connected and we can see in the device attributes that data is already being received: