Fixed HA autodiscovery and MQTT ON

pull/152/head
cschwinne 2019-03-27 21:31:59 +01:00
rodzic 1a3b4ac2ac
commit 3ffb40fafa
2 zmienionych plików z 3 dodań i 5 usunięć

Wyświetl plik

@ -98,7 +98,7 @@
//version code in format yymmddb (b = daily build) //version code in format yymmddb (b = daily build)
#define VERSION 1903271 #define VERSION 1903272
char versionString[] = "0.8.4"; char versionString[] = "0.8.4";

Wyświetl plik

@ -6,8 +6,8 @@
void parseMQTTBriPayload(char* payload) void parseMQTTBriPayload(char* payload)
{ {
if (strcmp(payload, "ON") == 0 || strcmp(payload, "on") == 0) {bri = briLast; colorUpdated(1);} if (strstr(payload, "ON") || strstr(payload, "on")) {bri = briLast; colorUpdated(1);}
else if (strcmp(payload, "T" ) == 0 || strcmp(payload, "t" ) == 0) {toggleOnOff(); colorUpdated(1);} else if (strstr(payload, "T" ) || strstr(payload, "t" )) {toggleOnOff(); colorUpdated(1);}
else { else {
uint8_t in = strtoul(payload, NULL, 10); uint8_t in = strtoul(payload, NULL, 10);
if (in == 0 && bri > 0) briLast = bri; if (in == 0 && bri > 0) briLast = bri;
@ -45,9 +45,7 @@ void onMqttConnect(bool sessionPresent)
mqtt->subscribe(subuf, 0); mqtt->subscribe(subuf, 0);
} }
#ifdef WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
sendHADiscoveryMQTT(); sendHADiscoveryMQTT();
#endif
publishMqtt(); publishMqtt();
} }