mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
remove optimistic option #2551
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -296,18 +296,6 @@ const MqttSettings = () => {
|
||||
}
|
||||
label={LL.MQTT_PUBLISH_TEXT_3()}
|
||||
/>
|
||||
{data.ha_enabled && data.discovery_type === 0 && (
|
||||
<BlockFormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
name="ha_optimistic"
|
||||
checked={data.ha_optimistic}
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
}
|
||||
label="Optimistic"
|
||||
/>
|
||||
)}
|
||||
</Grid>
|
||||
{data.ha_enabled && (
|
||||
<Grid container spacing={2} rowSpacing={0}>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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<uint16_t>(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<uint8_t>(root["nested_format"] | EMSESP_DEFAULT_NESTED_FORMAT);
|
||||
newSettings.discovery_prefix = root["discovery_prefix"] | EMSESP_DEFAULT_DISCOVERY_PREFIX;
|
||||
newSettings.discovery_type = static_cast<uint8_t>(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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<const char*>()) {
|
||||
config["optimistic"] = true;
|
||||
}
|
||||
sensor.ha_registered = Mqtt::queue_ha(topic, config.as<JsonObject>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<JsonObject>());
|
||||
}
|
||||
|
||||
@@ -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<JsonObject>()); // publish the config payload with retain flag
|
||||
}
|
||||
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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<JsonObject>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<JsonObject>());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user