diff --git a/interface/src/framework/mqtt/MqttSettingsForm.tsx b/interface/src/framework/mqtt/MqttSettingsForm.tsx
index fda328a59..5e41ddfe0 100644
--- a/interface/src/framework/mqtt/MqttSettingsForm.tsx
+++ b/interface/src/framework/mqtt/MqttSettingsForm.tsx
@@ -183,45 +183,49 @@ const MqttSettingsForm: FC = () => {
control={}
label="Publish command output to a 'response' topic"
/>
-
-
- }
- label="Publish single value topics on change"
- />
-
- {data.publish_single && (
+ {!data.ha_enabled && (
+
- }
- label="Publish to command topics (ioBroker)"
+ control={}
+ label="Publish single value topics on change"
/>
- )}
-
-
-
- }
- label="Enable MQTT Discovery (Home Assistant, Domoticz)"
- />
+ {data.publish_single && (
+
+
+ }
+ label="Publish to command topics (ioBroker)"
+ />
+
+ )}
- {data.ha_enabled && (
-
-
+
+ }
+ label="Enable MQTT Discovery (Home Assistant, Domoticz)"
/>
- )}
-
+ {data.ha_enabled && (
+
+
+
+ )}
+
+ )}
Publish Intervals (in seconds, 0=automatic)
diff --git a/lib/framework/MqttSettingsService.cpp b/lib/framework/MqttSettingsService.cpp
index 561d7926d..6b4fef288 100644
--- a/lib/framework/MqttSettingsService.cpp
+++ b/lib/framework/MqttSettingsService.cpp
@@ -228,7 +228,15 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
changed = true;
}
+ // if both settings are stored from older version, HA has priority
+ if (newSettings.ha_enabled && newSettings.publish_single) {
+ newSettings.publish_single = false;
+ }
+
if (newSettings.publish_single != settings.publish_single) {
+ if (newSettings.publish_single) {
+ newSettings.ha_enabled = false;
+ }
changed = true;
}
@@ -242,6 +250,9 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
if (newSettings.ha_enabled != settings.ha_enabled) {
emsesp::EMSESP::mqtt_.ha_enabled(newSettings.ha_enabled);
+ if (newSettings.ha_enabled) {
+ newSettings.publish_single = false;
+ }
changed = true;
}
diff --git a/src/system.cpp b/src/system.cpp
index 74503cd3a..edb65a7f2 100644
--- a/src/system.cpp
+++ b/src/system.cpp
@@ -961,6 +961,7 @@ bool System::command_settings(const char * value, const int8_t id, JsonObject &
node["publish_time_other"] = settings.publish_time_other;
node["publish_time_sensor"] = settings.publish_time_sensor;
node["publish_single"] = settings.publish_single;
+ node["publish_2_command"] = settings.publish_single2cmd;
node["send_response"] = settings.send_response;
});