From 1a71872c7b41250f465ba88d6335d0d660889558 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Mon, 18 Mar 2019 19:54:06 +0100 Subject: [PATCH] Added flag to enable Homeassistant autodiscovery --- wled00/wled00.ino | 2 ++ wled00/wled17_mqtt.ino | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/wled00/wled00.ino b/wled00/wled00.ino index a552c415e..2b9b9ba47 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -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 diff --git a/wled00/wled17_mqtt.ino b/wled00/wled17_mqtt.ino index 0deca78c6..18fec47af 100644 --- a/wled00/wled17_mqtt.ino +++ b/wled00/wled17_mqtt.ino @@ -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() {