From 960f2811020144732c8c8ff82204dab5878185dd Mon Sep 17 00:00:00 2001 From: Tester23 Date: Wed, 29 Nov 2023 13:04:13 +0100 Subject: [PATCH] tuyamcu hass discoery edge case fix --- src/httpserver/http_fns.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index 169fa0250..45db2d3bb 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -1759,6 +1759,10 @@ void doHomeAssistantDiscovery(const char* topic, http_request_t* request) { #endif //if (relayCount > 0) { for (i = 0; i < CHANNEL_MAX; i++) { + // if already included by light, skip + if (BIT_CHECK(flagsChannelPublished, i)) { + continue; + } bool bToggleInv = g_cfg.pins.channelTypes[i] == ChType_Toggle_Inv; if (h_isChannelRelay(i) || g_cfg.pins.channelTypes[i] == ChType_Toggle || bToggleInv) { // TODO: flags are 32 bit and there are 64 max channels