[HA discovery] Save the BLE settings and change switch to optimistic false (#1364)
The current way of saving settings is through the retain flag of the MQTT commands, unfortunately if several commands are issues they may overwrite each other. So as to prevent it, we now leverage the memory saving introduced earlier to store the BLE settings. Also leverage the config status publication to show the state through the button position (optimistic false)
This commit is contained in:
1 parent
5d3ea0d3ec
commit
25d921580d
2 files changed
+54
-34
No files matched your search
+1
-1
@@ -191,7 +191,7 @@ void BTConfig_fromJson(JsonObject& BTdata, bool startup = false) {
|
||||
Serial.println();
|
||||
return; // Do not try to erase/write/send config at startup
|
||||
}
|
||||
pub("/commands/BTtoMQTT/config", jo);
|
||||
pub(subjectBTtoMQTT, jo);
|
||||
|
||||
if (BTdata.containsKey("erase") && BTdata["erase"].as<bool>()) {
|
||||
// Erase config from NVS (non-volatile storage)
|
||||
|
||||
Reference in new issue
Block a user