[DISC] Fix via device discovery when using secondary module(#2077)

Co-authored-by: Florian <1technophile@users.noreply.github.com>
This commit is contained in:
FlorianandFlorian authored and GitHub committed 2024-10-01 20:02:18 -05:00
1 parent e390aca43b
commit fcc09df02c
1 file changed
+6
+6
View File
@@ -205,6 +205,12 @@ void SERIALtoX() {
} else {
// send as json
if (SERIALdata.containsKey("origin") || SERIALdata.containsKey("topic")) {
# ifdef ZmqttDiscovery
// We need to assign the discovery message to the primary module instead of the secondary module
if (SERIALdata.containsKey("device") && SERIALdata["device"].containsKey("via_device")) {
SERIALdata["device"]["via_device"] = gateway_name;
}
# endif
enqueueJsonObject(SERIALdata);
} else {
SERIALdata["origin"] = subjectSERIALtoMQTT;