Multiple messages to same node, seems to miss one.
-
I have a small 2 relay module node in my bedroom for the lights on both sides of my bed.
At night my openhab system sends the mqtt messages to turn off the lights. I have been monitoring the nodes for a few nights and as you can see the messages from openhab to the mqtt are showing up and they are very close together at the time of arrival on mqtt.
However, it seems one of the lights doesn't always turn off. I have to then manually do it. Just wondering if this is something anyone else has run in to. I even have the ack turned on and doesn't seem to have changed the behavior.
-
@crankycoder You didn't describe your hardware, but if it's based on nRF24 the issue could be that this radio has a 3 level deep queue for incoming messages. If more than 3 messages come in faster than the node can handle, the last message(s) will get lost.
You can counter this by either sending the messages with more time inbetween or turn on message buffering by defining MY_RX_MESSAGE_BUFFER_FEATURE (make sure the nRF24 IRQ pin is connected!)
There's some discussion on the topic here: https://www.mysensors.org/build/serial_gateway
-
Is this feature MY_RX_MESSAGE_BUFFER_FEATURE somehow available on the ESP8266 gateway too? Or an alternative?
-
@yveaux apologies. I have a raspberry pi mqtt gateway. there is a repeater in between the gateway and the module under the bed. I will look into that buffer feature or see if i can get openhab to slow down the group commands.
-
@electrik
yes it is available
Edit: Sorry, seems like it is not available on esp8266.
-
@mfalkvidd That is good to hear. What should I do to have that enabled?
-
@yveaux is this something that could be a problem at the repeater and the node itself? I don't think it's the gateway as the messages aren't coming in, it's being delivered to the node.
-
@electrik It should have been sufficient to follow the documentation, but it seems like MY_RX_MESSAGE_BUFFER_FEATURE is only available for atmega328 (or perhaps also for SAMD and Linux/Raspberry Pi but definitely not for esp8266).
I have created an issue to clarify the documentation.
Thanks to @Yveaux for notifying me.
-
@mfalkvidd all right thanks. Is there an alternative to avoid losing messages on an ESP8266 MQTT gateway?
-
@electrik decrease the message rate or the number of messages sent in bursts
-
@yveaux What is a rate that is still expected to be possible? Or, how often is the buffer from the NRF emptied?
-
@electrik that's a tough one... Every time loop() executes, or if you call eg wait() the queue is emptied.
So it all depends on what you do in your sketch.
-
@yveaux so by calling wait () a couple of times in the loop, it will be processed more often. I will try that, thanks
-
@Yveaux do you know if there are plans to support this buffering on the ESP8266 or the ESP32? Is it all related to SoftSPI?
-
@electrik the problem is the arduino port, not the mySensors stack. Last time I checked the issue on GitHub was still unresolved...
-
@yveaux This seems to be the original issue, which is closed: https://github.com/esp8266/Arduino/issues/1943
That sounds hopeful, but no time to check it right now...
-
@yveaux Did you find some time already to have a look at this?