mqtt cmd 'help'
This commit is contained in:
parent
a63fb21f38
commit
0660bb1726
17
src/mqtt.cpp
17
src/mqtt.cpp
@ -27,18 +27,23 @@ void mqttCallback(char *topic, const uint8_t *payload, unsigned int length) {
|
||||
memcpy(message, payload, length);
|
||||
*(message + length) = 0;
|
||||
Log.printf("MQTT received: topic=\"%s\", message=\"%s\"\n", topic, message);
|
||||
if (strcmp(message, "reboot") == 0) {
|
||||
Log.printf("rebooting...\n");
|
||||
delay(500);
|
||||
mqtt.disconnect();
|
||||
delay(500);
|
||||
EspClass::restart();
|
||||
if (strcmp(message, "help") == 0) {
|
||||
Log.printf("HELP\n");
|
||||
Log.printf(" %s\n", "help");
|
||||
Log.printf(" %s\n", "info");
|
||||
Log.printf(" %s\n", "reboot");
|
||||
} else if (strcmp(message, "info") == 0) {
|
||||
Log.printf("INFO\n");
|
||||
Log.printf(" %-10s %s\n", "SSID:", WiFi.SSID().c_str());
|
||||
Log.printf(" %-10s %s\n", "IP:", WiFi.localIP().toString().c_str());
|
||||
Log.printf(" %-10s %d\n", "RSSI:", WiFi.RSSI());
|
||||
Log.printf(" %-10s %s\n", "uptime:", uptimeString().c_str());
|
||||
} else if (strcmp(message, "reboot") == 0) {
|
||||
Log.printf("rebooting...\n");
|
||||
delay(500);
|
||||
mqtt.disconnect();
|
||||
delay(500);
|
||||
EspClass::restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user