Added flag to enable Homeassistant autodiscovery

This commit is contained in:
cschwinne 2019-03-18 19:54:06 +01:00
parent 62fe7135bd
commit 1a71872c7b
2 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,8 @@
//#define WLED_DISABLE_INFRARED //there is no pin left for this on ESP8266-01
//#define WLED_DISABLE_MOBILE_UI
//#define WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
#define WLED_DISABLE_FILESYSTEM //SPIFFS is not used by any WLED feature yet
//#define WLED_ENABLE_FS_SERVING //Enable sending html file from SPIFFS before serving progmem version
//#define WLED_ENABLE_FS_EDITOR //enable /edit page for editing SPIFFS content. Will also be disabled with OTA lock

View File

@ -45,7 +45,9 @@ void onMqttConnect(bool sessionPresent)
mqtt->subscribe(subuf, 0);
}
#ifdef WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
sendHADiscoveryMQTT();
#endif
publishMqtt();
}
@ -97,6 +99,7 @@ void publishMqtt()
mqtt->publish(subuf, 0, true, apires);
}
#ifdef WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
void sendHADiscoveryMQTT(){
/*
@ -336,6 +339,7 @@ Send out HA MQTT Discovery message on MQTT connect (~2.4kB):
strcat(pubt, "/config");
mqtt->publish(pubt, 0, true, buffer);
}
#endif
bool initMqtt()
{