diff --git a/examples/EnigmaIOTGatewayMQTT/EnigmaIOTGatewayMQTT.ino b/examples/EnigmaIOTGatewayMQTT/EnigmaIOTGatewayMQTT.ino index 60eb773c..25e5e57b 100644 --- a/examples/EnigmaIOTGatewayMQTT/EnigmaIOTGatewayMQTT.ino +++ b/examples/EnigmaIOTGatewayMQTT/EnigmaIOTGatewayMQTT.ino @@ -260,6 +260,7 @@ void processRxData (uint8_t* mac, uint8_t* buffer, uint8_t length, uint16_t lost GwOutput.outputDataSend (nodeName ? nodeName : mac_str, payload, pld_size, GwOutput_data_type::lostmessages); DEBUG_INFO ("Published MQTT from %s: %s", nodeName ? nodeName : mac_str, payload); } +#if ENABLE_STATUS_MESSAGES pld_size = snprintf (payload, PAYLOAD_SIZE, "{\"per\":%e,\"lostmessages\":%u,\"totalmessages\":%u,\"packetshour\":%.2f}", EnigmaIOTGateway.getPER ((uint8_t*)mac), EnigmaIOTGateway.getErrorPackets ((uint8_t*)mac), @@ -267,6 +268,7 @@ void processRxData (uint8_t* mac, uint8_t* buffer, uint8_t length, uint16_t lost EnigmaIOTGateway.getPacketsHour ((uint8_t*)mac)); GwOutput.outputDataSend (nodeName ? nodeName : mac_str, payload, pld_size, GwOutput_data_type::status); DEBUG_INFO ("Published MQTT from %s: %s", nodeName ? nodeName : mac_str, payload); +#endif } void onDownlinkData (uint8_t* address, char* nodeName, control_message_type_t msgType, char* data, unsigned int len) { diff --git a/src/EnigmaIoTconfig.h b/src/EnigmaIoTconfig.h index 061408e2..26ddacdc 100644 --- a/src/EnigmaIoTconfig.h +++ b/src/EnigmaIoTconfig.h @@ -25,6 +25,7 @@ static const int RESET_PIN_DURATION = 5000; ///< @brief Number of milliseconds t static const unsigned int MAX_KEY_VALIDITY = 86400000U; ///< @brief After this time (in ms) a node is unregistered. Setting this to 0 means imfinite static const unsigned int MAX_NODE_INACTIVITY = 86400000U; ///< @brief After this time (in ms) a node is marked as gone. Setting this to 0 means imfinite static const size_t MAX_MQTT_QUEUE_SIZE = 3; ///< @brief Maximum number of MQTT messages to be sent +#define ENABLE_STATUS_MESSAGES 1 ///< @brief Enable sending status message after every data message static const int RATE_AVE_ORDER = 5; ///< @brief Message rate filter order static const int MAX_INPUT_QUEUE_SIZE = 3; ///< @brief Input queue size for EnigmaIOT messages. Acts as a buffer to be able to handle messages during high load #ifndef NUM_NODES