Skip to content

Commit

Permalink
Added flag to enable Homeassistant autodiscovery
Browse files Browse the repository at this point in the history
  • Loading branch information
Aircoookie committed Mar 18, 2019
1 parent 62fe713 commit 1a71872
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wled00/wled00.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions wled00/wled17_mqtt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ void onMqttConnect(bool sessionPresent)
mqtt->subscribe(subuf, 0);
}

#ifdef WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
sendHADiscoveryMQTT();
#endif
publishMqtt();
}

Expand Down Expand Up @@ -97,6 +99,7 @@ void publishMqtt()
mqtt->publish(subuf, 0, true, apires);
}

#ifdef WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
void sendHADiscoveryMQTT(){
/*
Expand Down Expand Up @@ -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()
{
Expand Down

0 comments on commit 1a71872

Please sign in to comment.