[HA Discovery] Fix discovery switch (#1509)

extend scope of boards
This commit is contained in:
Florian authored and GitHub committed 2023-03-07 14:24:51 -06:00
1 parent f91e82df41
commit a9f8f803e5
2 files changed
+21 -17

No files matched your search

+4
View File
@@ -1708,6 +1708,9 @@ void stateMeasures() {
JsonObject SYSdata = jsonBuffer.to<JsonObject>();
SYSdata["uptime"] = uptime();
SYSdata["version"] = OMG_VERSION;
# ifdef ZmqttDiscovery
SYSdata["discovery"] = disc;
# endif
# if defined(ESP8266) || defined(ESP32)
SYSdata["env"] = ENV_NAME;
uint32_t freeMem;
@@ -2322,6 +2325,7 @@ void MQTTtoSYS(char* topicOri, JsonObject& SYSdata) { // json object decoding
if (SYSdata.containsKey("discovery")) {
if (SYSdata["discovery"].is<bool>()) {
disc = SYSdata["discovery"];
stateMeasures();
if (disc)
pubMqttDiscovery();
} else {