From f06b4b1de61fcd216cc09d393b62aeab1a50537e Mon Sep 17 00:00:00 2001 From: pwsh <33337365+pwsh@users.noreply.github.com> Date: Mon, 12 Oct 2026 06:52:18 -0500 Subject: [PATCH] [DISC] Fix empty unique_id suffix for gateway entities (#2401) createDiscoveryFromList() used column [2] as the unique id suffix of gateway entities whenever it was non null. The gateway sensors (RF, RF2, IR, Pilight, SRFB, RFM69, LORA, 2G, hcsr501...) pass "" there, so they all got the unique_id "-": entities of a multi module gateway collide in Home Assistant, and the ids changed from the "-gatewayLORA" form used by v1.8.1, duplicating entities on upgrade. Treat an empty suffix like a null one and fall back to the name, as already done for column [11]. Co-authored-by: Claude Opus 5.5 --- main/mqttDiscovery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/mqttDiscovery.cpp b/main/mqttDiscovery.cpp index bfdebf2..c2117dd 100644 --- a/main/mqttDiscovery.cpp +++ b/main/mqttDiscovery.cpp @@ -186,7 +186,7 @@ void createDiscoveryFromList(const char* mac, for (int i = 0; i < sensorCount; i++) { String unique_id; if (gateway_entity) { - unique_id = getUniqueId(sensorList[i][2] ? sensorList[i][2] : sensorList[i][1], ""); + unique_id = getUniqueId(sensorList[i][2] && sensorList[i][2][0] ? sensorList[i][2] : sensorList[i][1], ""); } else if (mac) { unique_id = String(mac) + "-" + sensorList[i][1]; } else {