diff --git a/lib/framework/NetworkSettingsService.cpp b/lib/framework/NetworkSettingsService.cpp index 7a4ca513c..99314f3f0 100644 --- a/lib/framework/NetworkSettingsService.cpp +++ b/lib/framework/NetworkSettingsService.cpp @@ -183,9 +183,6 @@ void NetworkSettingsService::setWiFiPowerOnRSSI() { #ifdef EMSESP_DEBUG uint8_t set_power = min_tx_pwr / 10; // this is the recommended power setting to use emsesp::EMSESP::logger().debug("Recommended set WiFi Tx Power (set_power %d, new power %d, rssi %d, threshold %d)", set_power, p, rssi, threshold); -#else - char result[10]; - emsesp::EMSESP::logger().info("Setting WiFi Tx Power to %s dBm", emsesp::Helpers::render_value(result, ((double)(p) / 4), 1)); #endif if (!WiFi.setTxPower(p)) { diff --git a/lib/uuid-console/src/shell.cpp b/lib/uuid-console/src/shell.cpp index 9571821a9..8005913c1 100644 --- a/lib/uuid-console/src/shell.cpp +++ b/lib/uuid-console/src/shell.cpp @@ -60,6 +60,7 @@ bool Shell::running() const { } void Shell::start() { + // added for EMS-ESP #if defined(EMSESP_DEBUG) uuid::log::Logger::register_handler(this, uuid::log::Level::DEBUG); // added for EMS-ESP #else diff --git a/src/mqtt.cpp b/src/mqtt.cpp index c161b3e49..22b980b96 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -855,7 +855,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev // base name + shortname snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", mqtt_basename_.c_str(), device_name, entity_with_tag); } else if (Mqtt::entity_format() == entityFormat::SINGLE_SHORT) { - // shortname (default) + // shortname only (=default) snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, entity_with_tag); } else if (Mqtt::entity_format() == entityFormat::SINGLE_OLD) { // shortname, remap to 3.6 diff --git a/src/mqtt.h b/src/mqtt.h index c4acca9de..020c89172 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -35,8 +35,12 @@ using mqtt_sub_function_p = std::function; class Mqtt { public: - enum discoveryType : uint8_t { HOMEASSISTANT, DOMOTICZ, DOMOTICZ_LATEST }; - enum entityFormat : uint8_t { SINGLE_LONG, SINGLE_SHORT, MULTI_SHORT, SINGLE_OLD, MULTI_OLD }; + enum discoveryType : uint8_t { HOMEASSISTANT = 0, DOMOTICZ, DOMOTICZ_LATEST }; + + // SINGLE_SHORT (1) and MULTI_SHORT (2) are the latest. Default is SINGLE_SHORT. + // SINGLE_LONG (0) is v3.4 only + // SINGLE_OLD (3) and MULTI_OLD (4) are for backwards compatibility with the older v3.6 style. https://github.com/emsesp/EMS-ESP32/issues/1714 + enum entityFormat : uint8_t { SINGLE_LONG = 0, SINGLE_SHORT, MULTI_SHORT, SINGLE_OLD, MULTI_OLD }; void loop(); void start(); diff --git a/src/system.cpp b/src/system.cpp index 24acc2daf..62a681421 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -1200,19 +1200,19 @@ bool System::check_upgrade(bool factory_settings) { // if we're coming from 3.4.4 or 3.5.0b14 which had no version stored then we need to apply new settings if (missing_version) { - LOG_INFO("Upgrade: Setting MQTT Entity ID format to v3.4 format"); + LOG_INFO("Upgrade: Setting MQTT Entity ID format to older v3.4 format"); EMSESP::esp8266React.getMqttSettingsService()->update([&](MqttSettings & mqttSettings) { - mqttSettings.entity_format = 0; // use old Entity ID format from v3.4 + mqttSettings.entity_format = Mqtt::entityFormat::SINGLE_LONG; // use old Entity ID format from v3.4 return StateUpdateResult::CHANGED; }); } else if (settings_version.major() == 3 && settings_version.minor() <= 6) { LOG_INFO("Upgrade: Setting MQTT Entity ID format to v3.6 format"); EMSESP::esp8266React.getMqttSettingsService()->update([&](MqttSettings & mqttSettings) { if (mqttSettings.entity_format == 1) { - mqttSettings.entity_format = 3; // use old Entity ID format from v3.6 + mqttSettings.entity_format = Mqtt::entityFormat::SINGLE_OLD; // use old Entity ID format from v3.6 return StateUpdateResult::CHANGED; } else if (mqttSettings.entity_format == 2) { - mqttSettings.entity_format = 4; // use old Entity ID format from v3.6 + mqttSettings.entity_format = Mqtt::entityFormat::MULTI_OLD; // use old Entity ID format from v3.6 return StateUpdateResult::CHANGED; } return StateUpdateResult::UNCHANGED; @@ -1243,6 +1243,7 @@ bool System::check_upgrade(bool factory_settings) { settings.version = EMSESP_APP_VERSION; return StateUpdateResult::CHANGED; }); + LOG_INFO("Upgrade: Setting version to %s", EMSESP_APP_VERSION); return true; // need reboot } @@ -1764,9 +1765,12 @@ String System::getBBQKeesGatewayDetails() { if (!EMSESP::nvs_.isKey("mfg")) { return ""; } + + // TODO add to header as a define if (EMSESP::nvs_.getString("mfg") != "BBQKees") { return ""; } + return "BBQKees Gateway Model " + EMSESP::nvs_.getString("model") + " v" + EMSESP::nvs_.getString("hwrevision") + "/" + EMSESP::nvs_.getString("batch"); #else return "";