Getting double UDP messages

Hello,

I'm trying to integrate a Xiaomi Gateway into my NodeRed, but I'm having a weird issue, and it is that I'm getting all the messages twice. So if I want to toggle a light on motion detected, it will turn on and off at the same second.

Each message should have a unique token, and I receive that token twice in NodeRed. I'm listening to the same Gateway in a node.js script using the "dgram" module, and there I get the messages only once, as it should be, with a unique token per message. Please see the following screenshot for more details:

I'm new to NodeRed, so I don't know if I'm doing something wrong. I want to move my home automation from node.js to NodeRed for its simplicity.

Thanks.

Quick question:

Does the problem persist if you restart Node-RED?

Yes, I have restarted it several times. I have NodeRed working on a docker container on a Synology NAS. I have restarted the container, changed the port settings, restarted the whole NAS and lastly updated the NodeRed container to the last version, I had NodeRed 1.1.3 and now I'm using 3.0.2; the problem is the same on both.

I'm thinking about resolving it by just using a variable, everytime a UDP message is sent I will change the variable from 0 to 1 and vice-versa, and I will only let the message continue if the variable is 1. Example:

UDP message received: Var null or 0 -> stop message -> Set to 1
UDP message received: Var 1 -> continue message -> Set to 0
UDP message received: Var 0 -> stop message -> Set to 1
UDP message received: Var 1 -> continue message -> Set to 0

It is not the best or fancy solution but I'm a software developer so for me this is much easier than solving a problem related to the network. Anyways I will appreciate if anybody knows how to solve it.

Thanks.

Follow up questions (now we know it's running in Docker)

  • What port forwarding rules do you have enabled for the container
  • Where was the standalone nodejs application running? (Inside the same container, on the NAS or on your laptop)
  • Do you see the same thing if you run Node-RED not as a container on your NAS?

will a filter (rbe) node work ? It should filter out duplicates as long as they really are the same.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.