Skip to content

Commit 700e2da

Browse files
committed
anavi-miracle-controller-sw: Config HA discovery
Do not send MQTT discovery message to Home Assistant if the length of of the LED strip is zero. This way you can display one of the LEDs. For example: if LED1 length is set to 10 and LED2 lenght is 0 than only LED1 will be discovered by Home Assistant. Signed-off-by: Leon Anavi <leon@anavi.org>
1 parent a5ec67e commit 700e2da

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

anavi-miracle-controller-sw/anavi-miracle-controller-sw.ino

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,8 +1275,15 @@ bool publishLightDiscovery(int ledId)
12751275

12761276
void publishDiscoveryState()
12771277
{
1278-
publishLightDiscovery(1);
1279-
publishLightDiscovery(2);
1278+
if (0 < numberLed1)
1279+
{
1280+
publishLightDiscovery(1);
1281+
}
1282+
1283+
if (0 < numberLed2)
1284+
{
1285+
publishLightDiscovery(2);
1286+
}
12801287

12811288
String homeAssistantTempScale = "°C";
12821289

0 commit comments

Comments
 (0)