Added flag to enable Homeassistant autodiscovery
This commit is contained in:
parent
62fe7135bd
commit
1a71872c7b
@ -24,6 +24,8 @@
|
|||||||
//#define WLED_DISABLE_INFRARED //there is no pin left for this on ESP8266-01
|
//#define WLED_DISABLE_INFRARED //there is no pin left for this on ESP8266-01
|
||||||
//#define WLED_DISABLE_MOBILE_UI
|
//#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_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_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
|
//#define WLED_ENABLE_FS_EDITOR //enable /edit page for editing SPIFFS content. Will also be disabled with OTA lock
|
||||||
|
@ -45,7 +45,9 @@ void onMqttConnect(bool sessionPresent)
|
|||||||
mqtt->subscribe(subuf, 0);
|
mqtt->subscribe(subuf, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
|
||||||
sendHADiscoveryMQTT();
|
sendHADiscoveryMQTT();
|
||||||
|
#endif
|
||||||
publishMqtt();
|
publishMqtt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,6 +99,7 @@ void publishMqtt()
|
|||||||
mqtt->publish(subuf, 0, true, apires);
|
mqtt->publish(subuf, 0, true, apires);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
|
||||||
void sendHADiscoveryMQTT(){
|
void sendHADiscoveryMQTT(){
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -336,6 +339,7 @@ Send out HA MQTT Discovery message on MQTT connect (~2.4kB):
|
|||||||
strcat(pubt, "/config");
|
strcat(pubt, "/config");
|
||||||
mqtt->publish(pubt, 0, true, buffer);
|
mqtt->publish(pubt, 0, true, buffer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool initMqtt()
|
bool initMqtt()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user