mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
nested mqtt mode - (ESP32) Bring back MQTT single topics for Thermostat (and possible others) #738
This commit is contained in:
@@ -181,6 +181,7 @@ void MqttSettings::read(MqttSettings & settings, JsonObject & root) {
|
||||
root["bool_format"] = settings.bool_format;
|
||||
root["ha_climate_format"] = settings.ha_climate_format;
|
||||
root["ha_enabled"] = settings.ha_enabled;
|
||||
root["nested_format"] = settings.nested_format;
|
||||
}
|
||||
|
||||
StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & settings) {
|
||||
@@ -211,6 +212,7 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
|
||||
newSettings.bool_format = root["bool_format"] | EMSESP_DEFAULT_BOOL_FORMAT;
|
||||
newSettings.ha_climate_format = root["ha_climate_format"] | EMSESP_DEFAULT_HA_CLIMATE_FORMAT;
|
||||
newSettings.ha_enabled = root["ha_enabled"] | EMSESP_DEFAULT_HA_ENABLED;
|
||||
newSettings.nested_format = root["nested_format"] | EMSESP_DEFAULT_NESTED_FORMAT;
|
||||
|
||||
if (newSettings.mqtt_qos != settings.mqtt_qos) {
|
||||
emsesp::EMSESP::mqtt_.set_qos(newSettings.mqtt_qos);
|
||||
@@ -222,6 +224,10 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (newSettings.nested_format != settings.nested_format) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (newSettings.ha_climate_format != settings.ha_climate_format) {
|
||||
emsesp::EMSESP::mqtt_.ha_climate_format(newSettings.ha_climate_format);
|
||||
changed = true;
|
||||
|
||||
Reference in New Issue
Block a user