lower case days, hours, minutes, seconds

This commit is contained in:
Proddy
2022-11-10 22:12:10 +01:00
parent 845681b6dc
commit 57775af24b
10 changed files with 61 additions and 63 deletions

View File

@@ -535,6 +535,40 @@ void System::loop() {
#endif
}
// send MQTT info topic appended with the version information as JSON, as a retained flag
void System::send_info_mqtt(const char * event_str) {
StaticJsonDocument<EMSESP_JSON_SIZE_MEDIUM> doc;
doc["event"] = event_str;
doc["version"] = EMSESP_APP_VERSION;
#ifndef EMSESP_STANDALONE
if (WiFi.status() == WL_CONNECTED) {
doc["connection"] = "wifi";
doc["hostname"] = WiFi.getHostname();
doc["SSID"] = WiFi.SSID();
doc["BSSID"] = WiFi.BSSIDstr();
doc["RSSI"] = WiFi.RSSI();
doc["MAC"] = WiFi.macAddress();
doc["IPv4 address"] = uuid::printable_to_string(WiFi.localIP()) + "/" + uuid::printable_to_string(WiFi.subnetMask());
doc["IPv4 gateway"] = uuid::printable_to_string(WiFi.gatewayIP());
doc["IPv4 nameserver"] = uuid::printable_to_string(WiFi.dnsIP());
if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
doc["IPv6 address"] = uuid::printable_to_string(WiFi.localIPv6());
}
} else if (EMSESP::system_.ethernet_connected()) {
doc["connection"] = "ethernet";
doc["hostname"] = ETH.getHostname();
doc["MAC"] = ETH.macAddress();
doc["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask());
doc["IPv4 gateway"] = uuid::printable_to_string(ETH.gatewayIP());
doc["IPv4 nameserver"] = uuid::printable_to_string(ETH.dnsIP());
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
doc["IPv6 address"] = uuid::printable_to_string(ETH.localIPv6());
}
}
#endif
Mqtt::publish_retain(F_(info), doc.as<JsonObject>(), true); // topic called "info" and it's Retained
}
// create the json for heartbeat
bool System::heartbeat_json(JsonObject & output) {
uint8_t bus_status = EMSESP::bus_status();