diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index ab783ed08..792e485a3 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -11,7 +11,6 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/). - boiler auxheatersource [#2489](https://github.com/emsesp/EMS-ESP32/discussions/2489) - thermostat last error for RC100/300 [#2501](https://github.com/emsesp/EMS-ESP32/issues/2501) - boiler 0xC6 telegram [#1963](https://github.com/emsesp/EMS-ESP32/issues/1963) -- HA optimistic [#2551](https://github.com/emsesp/EMS-ESP32/issues/2551) - CS6800i changes [#2448](https://github.com/emsesp/EMS-ESP32/issues/2448), [#2449](https://github.com/emsesp/EMS-ESP32/issues/2449) - charging pump [#2544](https://github.com/emsesp/EMS-ESP32/issues/2544) diff --git a/interface/src/app/settings/MqttSettings.tsx b/interface/src/app/settings/MqttSettings.tsx index c8567e435..10921a96c 100644 --- a/interface/src/app/settings/MqttSettings.tsx +++ b/interface/src/app/settings/MqttSettings.tsx @@ -296,18 +296,6 @@ const MqttSettings = () => { } label={LL.MQTT_PUBLISH_TEXT_3()} /> - {data.ha_enabled && data.discovery_type === 0 && ( - - } - label="Optimistic" - /> - )} {data.ha_enabled && ( diff --git a/interface/src/types/mqtt.ts b/interface/src/types/mqtt.ts index f930a12bf..738dafa75 100644 --- a/interface/src/types/mqtt.ts +++ b/interface/src/types/mqtt.ts @@ -43,7 +43,6 @@ export interface MqttSettingsType { mqtt_qos: number; mqtt_retain: boolean; ha_enabled: boolean; - ha_optimistic: boolean; nested_format: number; send_response: boolean; publish_single: boolean; diff --git a/lib_standalone/ESP32React.h b/lib_standalone/ESP32React.h index 5b1d1a384..115a42aae 100644 --- a/lib_standalone/ESP32React.h +++ b/lib_standalone/ESP32React.h @@ -36,7 +36,6 @@ class DummySettings { String discovery_prefix = "homeassistant"; uint8_t discovery_type = 0; // HA bool ha_enabled = true; - bool ha_optimistic = false; String base = "ems-esp"; bool publish_single = false; bool publish_single2cmd = false; diff --git a/mock-api/restServer.ts b/mock-api/restServer.ts index 54d0ae13a..0e95bd836 100644 --- a/mock-api/restServer.ts +++ b/mock-api/restServer.ts @@ -567,7 +567,6 @@ let mqtt_settings = { rootCA: '', mqtt_retain: false, ha_enabled: true, - ha_optimistic: false, nested_format: 1, discovery_type: 0, discovery_prefix: 'homeassistant', diff --git a/src/ESP32React/MqttSettingsService.cpp b/src/ESP32React/MqttSettingsService.cpp index 55d5a5881..f6fb78872 100644 --- a/src/ESP32React/MqttSettingsService.cpp +++ b/src/ESP32React/MqttSettingsService.cpp @@ -244,7 +244,6 @@ void MqttSettings::read(MqttSettings & settings, JsonObject root) { root["mqtt_qos"] = settings.mqtt_qos; root["mqtt_retain"] = settings.mqtt_retain; root["ha_enabled"] = settings.ha_enabled; - root["ha_optimistic"] = settings.ha_optimistic; root["nested_format"] = settings.nested_format; root["discovery_prefix"] = settings.discovery_prefix; root["discovery_type"] = settings.discovery_type; @@ -285,7 +284,6 @@ StateUpdateResult MqttSettings::update(JsonObject root, MqttSettings & settings) newSettings.publish_time_heartbeat = static_cast(root["publish_time_heartbeat"] | EMSESP_DEFAULT_PUBLISH_HEARTBEAT); newSettings.ha_enabled = root["ha_enabled"] | EMSESP_DEFAULT_HA_ENABLED; - newSettings.ha_optimistic = root["ha_optimistic"] | EMSESP_DEFAULT_HA_OPTIMISTIC; newSettings.nested_format = static_cast(root["nested_format"] | EMSESP_DEFAULT_NESTED_FORMAT); newSettings.discovery_prefix = root["discovery_prefix"] | EMSESP_DEFAULT_DISCOVERY_PREFIX; newSettings.discovery_type = static_cast(root["discovery_type"] | EMSESP_DEFAULT_DISCOVERY_TYPE); @@ -347,14 +345,6 @@ StateUpdateResult MqttSettings::update(JsonObject root, MqttSettings & settings) changed = true; } - if (newSettings.discovery_type != 0) { - newSettings.ha_optimistic = false; - } - if (newSettings.ha_optimistic != settings.ha_optimistic) { - emsesp::EMSESP::mqtt_.ha_optimistic(newSettings.ha_optimistic); - changed = true; - } - if (newSettings.mqtt_retain != settings.mqtt_retain) { emsesp::EMSESP::mqtt_.set_retain(newSettings.mqtt_retain); changed = true; diff --git a/src/ESP32React/MqttSettingsService.h b/src/ESP32React/MqttSettingsService.h index 760507ef2..ef448af0d 100644 --- a/src/ESP32React/MqttSettingsService.h +++ b/src/ESP32React/MqttSettingsService.h @@ -76,7 +76,6 @@ class MqttSettings { uint8_t mqtt_qos; bool mqtt_retain; bool ha_enabled; - bool ha_optimistic; uint8_t nested_format; String discovery_prefix; uint8_t discovery_type; diff --git a/src/core/analogsensor.cpp b/src/core/analogsensor.cpp index 0ca1084fe..ff3d7baf8 100644 --- a/src/core/analogsensor.cpp +++ b/src/core/analogsensor.cpp @@ -682,9 +682,6 @@ void AnalogSensor::publish_values(const bool force) { Mqtt::add_ha_sections_to_doc("analog", stat_t, config, !is_ha_device_created, val_cond); - if (Mqtt::ha_optimistic() && config["cmd_t"].is()) { - config["optimistic"] = true; - } sensor.ha_registered = Mqtt::queue_ha(topic, config.as()); } } diff --git a/src/core/mqtt.cpp b/src/core/mqtt.cpp index 188fffd8e..199f2202c 100644 --- a/src/core/mqtt.cpp +++ b/src/core/mqtt.cpp @@ -40,7 +40,6 @@ uint32_t Mqtt::publish_time_heartbeat_; bool Mqtt::mqtt_enabled_; uint8_t Mqtt::entity_format_; bool Mqtt::ha_enabled_; -bool Mqtt::ha_optimistic_; uint8_t Mqtt::nested_format_; std::string Mqtt::discovery_prefix_; uint8_t Mqtt::discovery_type_; @@ -341,7 +340,6 @@ void Mqtt::load_settings() { mqtt_retain_ = mqttSettings.mqtt_retain; mqtt_enabled_ = mqttSettings.enabled; ha_enabled_ = mqttSettings.ha_enabled; - ha_optimistic_ = mqttSettings.ha_optimistic; nested_format_ = mqttSettings.nested_format; publish_single_ = mqttSettings.publish_single; publish_single2cmd_ = mqttSettings.publish_single2cmd; @@ -1127,9 +1125,6 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev doc["dev"] = dev_json; - if (ha_optimistic_ && has_cmd) { - doc["optimistic"] = true; - } return queue_ha(topic, doc.as()); } @@ -1359,9 +1354,6 @@ bool Mqtt::publish_ha_climate_config(const int8_t tag, const bool has_roomtemp, // device name must be different to the entity name, take the ids value we just created add_ha_sections_to_doc("thermostat", topic_t, doc, false, seltemp_cond, has_roomtemp ? currtemp_cond : nullptr, hc_mode_cond); - if (ha_optimistic_) { - doc["optimistic"] = true; - } return queue_ha(topic, doc.as()); // publish the config payload with retain flag } diff --git a/src/core/mqtt.h b/src/core/mqtt.h index f6565cbdb..fe0e2474b 100644 --- a/src/core/mqtt.h +++ b/src/core/mqtt.h @@ -210,14 +210,6 @@ class Mqtt { ha_enabled_ = ha_enabled; } - static bool ha_optimistic() { - return ha_optimistic_; - } - - static void ha_optimistic(bool ha_optimistic) { - ha_optimistic_ = ha_optimistic; - } - static bool ha_climate_reset() { return ha_climate_reset_; } @@ -321,7 +313,6 @@ class Mqtt { static uint32_t publish_time_heartbeat_; static bool mqtt_enabled_; static bool ha_enabled_; - static bool ha_optimistic_; static uint8_t nested_format_; static uint8_t entity_format_; static std::string discovery_prefix_; diff --git a/src/web/WebCustomEntityService.cpp b/src/web/WebCustomEntityService.cpp index a96755cb2..391190352 100644 --- a/src/web/WebCustomEntityService.cpp +++ b/src/web/WebCustomEntityService.cpp @@ -452,9 +452,6 @@ void WebCustomEntityService::publish(const bool force) { Mqtt::add_ha_sections_to_doc(F_(custom), stat_t, config, !ha_created, val_cond); - if (Mqtt::ha_optimistic() && (entityItem.writeable || entityItem.ram > 0)) { - config["optimistic"] = true; - } ha_created |= Mqtt::queue_ha(topic, config.as()); } } diff --git a/src/web/WebSchedulerService.cpp b/src/web/WebSchedulerService.cpp index e8fc309d8..3807b3503 100644 --- a/src/web/WebSchedulerService.cpp +++ b/src/web/WebSchedulerService.cpp @@ -290,9 +290,6 @@ void WebSchedulerService::publish(const bool force) { Mqtt::add_ha_bool(config); Mqtt::add_ha_sections_to_doc(F_(scheduler), stat_t, config, !ha_created, val_cond); - if (Mqtt::ha_optimistic()) { - config["optimistic"] = true; - } ha_created |= Mqtt::queue_ha(topic, config.as()); } }