Duplicated messages on RF433



I got everything working properly on the 0.9beta, on a nodemcu with bme280,bh1750, and srx882/stx.
The problem is that although the “debouncing” works sometimes (i.e. the OMG will only publish an RF code once and then ignore it for a few seconds), other times it sends the same code rapidly 2-4 times in less than a second. The result is my HASS turning the light rapidly on and off since the mqtt switch toggles my light.
In this mqtt gateway client screenshot you can see the code being sent once and then the HASS sending the light ON command, and then on the next time i press the RF button, the code is sent 4 times rapidly and then the HASS sends light ON/OFF commands rapidly 4 times (the last one is another time where the receiver picked it up wrongly)

Also, i see it was mentioned here a few months back, but didnt want to bump old threads:



Thanks for pointing that I will take a look before releasing v0.9


Ok, i got a chance to take a look at the code on the RF and MQTT publishing, and correct me if im wrong:

  1. You read the RF data
  2. You check if the MQTT data with the RF value is a duplicate by checking the ReceivedSignalArray
  3. You publish the MQTT message
  4. Only when the MQTT message is received back in the gateway you store it in the ReceivedSignalArray via the receivingMQTT method

If that is so, that means you could send many MQTT messages for a single RF value by the time the MQTT message is received back and logged for avoiding duplicates. Wouldnt storing it as soon as you publish it be a better method and solve the duplicates?


You are right, here is some more infos about the process.
Why do I did it like that, so as to avoid duplicates also for multi gateways installations.


As i see it, we have 2 issues here:

  1. In multiple gateway scenario, if the 433mhz data arrives to multiple gateways, more than 1 gateway may manage to send the same MQTT message before the MQTT broker “RFToMQTT” message arrives to the gateways. I dont know how to solve this, and i dont know how common this scenario is.
  2. In single gateway scenario like the one i have, the 433mhz data which is continuously sent by switches can be picked up multiple times in the gateway before it gets the message back from the broker and stores it in the ReceivedSignalArray. The solution im offering for this scenario is to store the RF data in the ReceivedSignalArray both when the MQTT message arrives (for the multiple gateway scenario like you said), and as soon as the MQTT message is sent from the gateway. If im not wrong, this will keep the multiple gateway unchanged, and prevent the multiple CQTT messages i’ve shown in the screenshot


In my setup this is not really an issue mainly due to the fact that the chain with the broker is quite fast. Maybe due to the fact that I’m using ethernet and not wifi.

Yes good idea it should work both case if we do it this way. I will open a PR


The modification has been integrated to the master don’t hesitate to test it. Thanks for pointing that


So far so good. Haven’t received a duplicate in a few hours now. :grinning:


2 weeks in, no duplicates.:v:
By the way, it seems to be closely related to the load on the program (without the change), not the network speed. for example if i run the code without the change on an esp8266 the duplicates happen a lot, whereas the esp32 which has the RF read on a separate core almost never has the issue unless i also run the BT gateway on it, and then the duplicates happen more, and also cases where the RF message is completely missed due to a large delay between RF read cycles caused by the BT read cycles.


My 5 cents: I saw plenty of duplicates when my Wemos D1 mini was pretty far from AP, but it works fine when placed next to the AP.