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);
|
memcpy(message, payload, length);
|
||||||
*(message + length) = 0;
|
*(message + length) = 0;
|
||||||
Log.printf("MQTT received: topic=\"%s\", message=\"%s\"\n", topic, message);
|
Log.printf("MQTT received: topic=\"%s\", message=\"%s\"\n", topic, message);
|
||||||
if (strcmp(message, "reboot") == 0) {
|
if (strcmp(message, "help") == 0) {
|
||||||
Log.printf("rebooting...\n");
|
Log.printf("HELP\n");
|
||||||
delay(500);
|
Log.printf(" %s\n", "help");
|
||||||
mqtt.disconnect();
|
Log.printf(" %s\n", "info");
|
||||||
delay(500);
|
Log.printf(" %s\n", "reboot");
|
||||||
EspClass::restart();
|
|
||||||
} else if (strcmp(message, "info") == 0) {
|
} else if (strcmp(message, "info") == 0) {
|
||||||
Log.printf("INFO\n");
|
Log.printf("INFO\n");
|
||||||
Log.printf(" %-10s %s\n", "SSID:", WiFi.SSID().c_str());
|
Log.printf(" %-10s %s\n", "SSID:", WiFi.SSID().c_str());
|
||||||
Log.printf(" %-10s %s\n", "IP:", WiFi.localIP().toString().c_str());
|
Log.printf(" %-10s %s\n", "IP:", WiFi.localIP().toString().c_str());
|
||||||
Log.printf(" %-10s %d\n", "RSSI:", WiFi.RSSI());
|
Log.printf(" %-10s %d\n", "RSSI:", WiFi.RSSI());
|
||||||
Log.printf(" %-10s %s\n", "uptime:", uptimeString().c_str());
|
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