Pre-installed application - preparation for dispatching values to ThingsBoard
The values obtained from the sensor and the count can also be sent to a ThingsBoard IoT platform via MQTT. Three MQTT messages for the dispatch of the temperature, humidity and counter values are configured for this. In order to send the values to your ThingsBoard IoT platform, you only need to configure the MQTT broker of your ThingsBoard IoT platform before (see here). An event that is regularly triggered by an interval timer will dispatch the messages. Another event sends the temperature value with each change of the temperature.
Configuration of the messages
Menu Messages → MQTT → edit mqttMsg4 - Push_Temperature_Thingsboard ()
This message transmits the flag flag1, which contains the temperature value (refer to Converting the sensor values), under the topic v1/devices/me/telemetry to the ThingsBoard MQTT broker.
Menu Messages → MQTT → edit mqttMsg5 - Push_Humidity_Thingsboard ()
This message transmits the flag flag2, which contains the humidity value (refer to Converting the sensor values), under the topic v1/devices/me/telemetry to the ThingsBoard MQTT broker.
Menu Messages → MQTT → edit mqttMsg6 - Push_Counter_Thingsboard ()
This message transmits the flag flag3, which contains the count, under the topic v1/devices/me/telemetry to the ThingsBoard MQTT broker.
The flags flag1, flag2 and flag3 are entered in the JSON format required by ThingsBoard. |
Configuration of the message dispatch
The following events are disabled in the default configuration and must first be activated manually to be able to trigger a message dispatch. To do this, activate in the menu Events the checkbox active in front of the respective event. |
Menu Data points → Timer → edit Send_Interval ()
A timer of the type Interval is added here, which expires (triggers) every five minutes.
Menu Events → edit Push_Temperature_Event_Thingsboard ()
An event is added here, which triggers an action with each expiry of the timer timer1 - Send_Interval, which sends the message mqttMsg4 - Push_Temperature_Thingsboard.
Menu Events → edit Push_Humidity_Event_Thingsboard ()
An event is added here, which triggers an action with each expiry of the timer timer1 - Send_Interval, which sends the message mqttMsg5 - Push_Humidity_Thingsboard.
Menu Events → edit Push_Counter_Event_Thingsboard ()
An event is added here, which triggers an action with each expiry of the timer timer1 - Send_Interval, which sends the message mqttMsg6 - Push_Counter_Thingsboard.
Menu Events → edit Push_Temperature_Change_Event_Thingsboard ()
An event is added here, which triggers an action with each change of the analogue data point flag1 - Temperature, which sends the message mqttMsg4 - Push_Temperature_Thingsboard.