Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
sdk:mqtt_advanced_status [2018/08/07 15:46]
preisig created
sdk:mqtt_advanced_status [2018/08/08 14:05]
preisig [Script Summary]
Line 1: Line 1:
 ====== Send Router Status Informations to an MQTT Broker - Advanced Version ====== ====== Send Router Status Informations to an MQTT Broker - Advanced Version ======
 +
 +===== Script Summary ​ =====
 +
 +This script is an advanced version of the [[sdk:​mqtt_simple_status|simple mqtt status script]]. It offers a lot more flexibilities because of the template changing topics, publishing messages and setting up mqtt connections as well as router status queries can be easily done through already provided functions. This can be applied to different use cases.
 +
 +If you are interessted in other status values, please refer to the API manual and read about the nb_status() function. You can use dump() to get all the fields (ex: GNSS1_LATITUDE) of the struct returned by nb_status.
 +
 +With default settings the script publishes 10 mqtt messages to a given topic and waits 60 secs between every new status query and message publish. After that the topic gets changed and a final status message gets published. ​
 +
 +
 <code c mqtt_advanced_status.are>​ <code c mqtt_advanced_status.are>​
 /* DESC: Advanced version of mqtt_simple_status.are using a template /* DESC: Advanced version of mqtt_simple_status.are using a template
Line 47: Line 57:
  }  }
  }  }
 + /* The publish function to publish a message */
  int publish(string msg){  int publish(string msg){
  this.MESSAGE = msg;  this.MESSAGE = msg;