Feature Request: Make the "EMS-ESP" title text in the web interface configurable.

Fixes #3110
This commit is contained in:
proddy
2026-06-07 09:56:07 +02:00
parent c55b8c5e2e
commit cbfebabfa3
21 changed files with 84 additions and 24 deletions

View File

@@ -21,6 +21,10 @@
// GENERAL SETTINGS
#ifndef EMSESP_DEFAULT_SYSTEM_NAME
#define EMSESP_DEFAULT_SYSTEM_NAME ""
#endif
#ifndef EMSESP_DEFAULT_LOCALE
#define EMSESP_DEFAULT_LOCALE EMSESP_LOCALE_EN // English
#endif

View File

@@ -684,6 +684,7 @@ void System::store_settings(WebSettings & settings) {
enum_format_ = settings.enum_format;
readonly_mode_ = settings.readonly_mode;
locale_ = settings.locale;
system_name_ = settings.system_name;
developer_mode_ = settings.developer_mode;
}
@@ -836,8 +837,9 @@ void System::send_info_mqtt() {
}
_connection = connection;
JsonDocument doc;
// doc["event"] = "connected";
doc["version"] = EMSESP_APP_VERSION;
doc["system_name"] = system_name_.isEmpty() ? "EMS-ESP" : system_name_;
// if NTP is enabled send the boot_time in local time in ISO 8601 format (eg: 2022-11-15 20:46:38)
// https://github.com/emsesp/EMS-ESP32/issues/751
@@ -852,16 +854,6 @@ void System::send_info_mqtt() {
if (EMSESP::network_.ethernet_connected()) {
doc["network"] = "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" && ETH.localIPv6().toString() != "::") {
doc["IPv6 address"] = uuid::printable_to_string(ETH.localIPv6());
}
*/
} else if (EMSESP::network_.wifi_connected()) {
doc["network"] = "wifi";
doc["hostname"] = WiFi.getHostname();

View File

@@ -265,6 +265,10 @@ class System {
return std::string(locale_.c_str());
}
std::string system_name() {
return std::string(system_name_.c_str());
}
void healthcheck(uint8_t healthcheck) {
healthcheck_ = healthcheck;
}
@@ -410,6 +414,7 @@ class System {
// EMS-ESP settings
std::string hostname_;
String system_name_;
String locale_;
bool low_clock_;
String board_profile_;

View File

@@ -36,6 +36,7 @@ void WebSettings::read(WebSettings & settings, JsonObject root) {
root["version"] = settings.version;
root["board_profile"] = settings.board_profile;
root["platform"] = EMSESP_PLATFORM;
root["system_name"] = settings.system_name;
root["locale"] = settings.locale;
root["tx_mode"] = settings.tx_mode;
root["ems_bus_id"] = settings.ems_bus_id;
@@ -284,6 +285,8 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
//
// without checks or necessary restarts...
//
settings.system_name = root["system_name"] | EMSESP_DEFAULT_SYSTEM_NAME;
settings.trace_raw = root["trace_raw"] | EMSESP_DEFAULT_TRACELOG_RAW;
EMSESP::trace_raw(settings.trace_raw);

View File

@@ -58,6 +58,7 @@ namespace emsesp {
class WebSettings {
public:
String version = EMSESP_APP_VERSION;
String system_name;
String locale;
uint8_t tx_mode;
uint8_t ems_bus_id;