Browse Source

mqtt: display connection state, mqtt.info command

master
Max Prokhorov 5 years ago
parent
commit
5ca44c1c4c
1 changed files with 25 additions and 6 deletions
  1. +25
    -6
      code/espurna/mqtt.ino

+ 25
- 6
code/espurna/mqtt.ino View File

@ -267,6 +267,25 @@ void _mqttBackwards() {
}
}
void _mqttInfo() {
DEBUG_MSG_P(PSTR("[MQTT] Async %s, SSL %s, Autoconnect %s\n"),
MQTT_USE_ASYNC ? "ENABLED" : "DISABLED",
ASYNC_TCP_SSL_ENABLED ? "ENABLED" : "DISABLED",
MQTT_AUTOCONNECT ? "ENABLED" : "DISABLED"
);
DEBUG_MSG_P(PSTR("[MQTT] Client %s, %s\n"),
_mqtt_enabled ? "ENABLED" : "DISABLED",
_mqtt.connected() ? "CONNECTED" : "DISCONNECTED"
);
DEBUG_MSG_P(PSTR("[MQTT] Retry %s (Now %u, Last %u, Delay %u, Step %u)\n"),
_mqtt_connecting ? "CONNECTING" : "WAITING",
millis(),
_mqtt_last_connection,
_mqtt_reconnect_delay,
MQTT_RECONNECT_DELAY_STEP
);
}
// -----------------------------------------------------------------------------
// WEB
// -----------------------------------------------------------------------------
@ -314,6 +333,11 @@ void _mqttInitCommands() {
terminalOK();
});
terminalRegisterCommand(F("MQTT.INFO"), [](Embedis* e) {
_mqttInfo();
terminalOK();
});
}
#endif // TERMINAL_SUPPORT
@ -729,12 +753,7 @@ void mqttReset() {
void mqttSetup() {
_mqttBackwards();
DEBUG_MSG_P(PSTR("[MQTT] Async %s, SSL %s, Autoconnect %s\n"),
MQTT_USE_ASYNC ? "ENABLED" : "DISABLED",
ASYNC_TCP_SSL_ENABLED ? "ENABLED" : "DISABLED",
MQTT_AUTOCONNECT ? "ENABLED" : "DISABLED"
);
_mqttInfo();
#if MQTT_USE_ASYNC


Loading…
Cancel
Save