Message queue problem

Hi, I'm having issues with a payload so basically I have an rbe node and I have two statments in a function node. My statments are "OPEN" and "Close" so basically is for a valve with the MQTT out node to full open and full close on the valve it takes 9 seconds so my problem is that is related to a sensor and this sensor is not really stable so when my statements are reciving this big variations (not always it just happened once) my conditions create a queue "OPEN" THEN "CLOSE" the many as I could count were 22 so it makes crazy my ESP8266 and it stop working, I have to turn off and turn on again to respond. some advice to fix this?

If you feed your open/close message into a Trigger node configured something like shown below then it delays the first message received by the time configured (5 seconds in the example) and if another message is received within that time then it starts the timer again, and keeps doing that until no further messages are received, and then sends the last one.

Another alternative is to use some hysteresis on the sensor reading before deciding whether to open/close. You can do that using node-red-contrib-ramp-thermostat. Ignore the ramp part and just use it as a thermostat with hysteresis so that that random noise on the sensor will not cause the output to keep changing state.

1 Like

Thanks I will triy it.

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