Node Red duplicated zha_events

Hi all,

I’m currently facing an issue where zha_events trigger twice in node red (but not in HA).

For example, when pressing a zigbee button I’m using for testing, I get 3 events showing in dev tools (counter starts from 0):

However given the very simple setup in node red:

[{"id":"4858bf146b4c5e89","type":"server-events","z":"dde7691.7f69f98","name":"ZHA Events","server":"c713aa1.19ba158","version":1,"event_type":"zha_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"}],"x":1010,"y":400,"wires":[["00e3729c776cdef6","33638e67e94a1d67"]]},{"id":"33638e67e94a1d67","type":"debug","z":"dde7691.7f69f98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":340,"wires":[]},{"id":"c713aa1.19ba158","type":"server","name":"Home Assistant","version":1,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

image

I see 6 events returned, and upon checking the output I can see all 3 original events have been duplicated:


(to note, timestamps between screenshots do not match as node red was offloaded when I triggered it the first time, so I had to press the button again. Rest assured that events are duplicated each time).

This results in my setup receiving twice the amounts of events and therefore triggering my flows more times than needed. For instance I get multiple notifications of the same thing or something else that toggle gets toggled back almost immediately.

I had a look on node-red-contrib-home-assistant-websocket github issue page but there was very little of relevance. Someone experienced something like this but it turned out they were not filtering the event properly and they were catching unrelated events, for instance. I will also be posting an issue on there soon, but I thought this would be the best starting point.

Temporary remedies I could think of include attaching a cycle node with 2 outputs, with only 1 of them being connected to the rest of the setup, however I’ve not tested everything, so I’m not 100% sure that ALL events are duplicated.
Another thought was to create an HA automation to read zha_event and re-publish it as a new type of event, which kinda worked but I wasn’t able to include the entire event_data section, probably because I don’t know how.

Has anyone ever encountered this issue before?
No matter what I try I cannot seem to resolve this problem, and I cannot figure out how this is happening.

Thank you for your time in helping me solve this problem!

It looks like your debug node only outputsthe payload.
Set it to the complete msg and see if there might be a difference.

it was originally set to output the complete mg object but that didn’t make any difference unfortunately.
the messages are a perfect duplicate.

Here’s a comparison of the complete message. The only difference being the _msgid, perhaps providing a clue?

also tested with this events: all node:

[{"id":"4c2a358d29e12720","type":"server-events","z":"dde7691.7f69f98","name":"ZHA Events","server":"c713aa1.19ba158","version":1,"event_type":"zha_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":1450,"y":400,"wires":[["9b2b107f90d3b8aa"]]},{"id":"9b2b107f90d3b8aa","type":"debug","z":"dde7691.7f69f98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1610,"y":400,"wires":[]},{"id":"c713aa1.19ba158","type":"server","name":"Home Assistant","version":1,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Oh wow!
After days of looking into this problem I think I have finally figured out the problem.
It turns out that I have and All Events node that was capturing all events from Home Assistant with a wildcard.
This node was only connected to a different debug node and nothing else.

[{"id":"5985a18892a19251","type":"server-events","z":"dde7691.7f69f98","name":"All Events","server":"c713aa1.19ba158","version":1,"event_type":"*","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":1020,"y":740,"wires":[["39dab2c1e45041c2"]]},{"id":"39dab2c1e45041c2","type":"debug","z":"dde7691.7f69f98","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1170,"y":740,"wires":[]},{"id":"c713aa1.19ba158","type":"server","name":"Home Assistant","version":1,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

image

This makes no sense to me, why would this node cause duplicate messages to be sent?
Can anyone make sense of this?

Because it catches all events and your debug node will post the captures to your debug output list.
Events can be caught asany tes as there are nodes with filters that match those events.

thank you but I don’t understand how a disabled debug node would duplicate events onto another events: all node?
Perhaps I’ve not explained properly, this was the setup:
image

That I do not know