Analyze simple project

These are my first projects with node red.
I try to use node red to control sonoff devices (zigbee).
In this simple project if I make a single press on button I see the same row of event repeated more then once. I would ask if this is correct.
Tks in advance.
Lucio

Welcome to the forum @Gioacchino1969

Given the limited information you have shared, it seems unlikely.

If you need advice on fixing it please tell us about your system, the hardware involved, any non-standard nodes you have installed and at least a screen capture of your flow.

I have install nodered on IHost Docker. In Node red I have installed in addition to the standar objects, node-red-contrib-alexa-remote2-v2, node-red-contrib-ewelink-cube and node-red-contrib-time-of-day

And this is the flow :

Thanks.

I don't use docker or either of those contrib nodes.

Hopefully someone who does will see this and advise you.

Maybe use a filter node to remove duplicates ?

Your switch seems to bounce, meaning you get multiple messages on a single press of the button. Many switches have this issue.
How do you control your zigbee devices, is it via "node-red-contrib-ewelink-cube"? Does this node provide functionality for debouncing a switch? I control my zigbee switches via zigbee2mqtt, which offers detailed configuration options for debouncing.

If you cannot deal with this issue on zigbee level, I suggest using a delay-node configured for a rate limit of maybe 1 msg/second.

What type is the switch bathroom node?

I see the same behavior in zigbee2mqtt. Can't recall exactly when this started but I think after updating z2m from the 1.x to the 2.x version.
For now I added a filter node the blocks if there are more then 1 messages in 1 sec.


Hi,
these are informations of my device.
Please, wath kind of node you can suggest for bloking duplicate messages ?

First add a json node to parse the output as json. Next check if the messages are really duplicate or that it emits different types of messages (that can be filtered/blocked)

Are you using the node node-red-contrib-zigbee2mqtt? If so then I recommend just using standard MQTT nodes to interface to zigbee2mqtt.

If you don't want to do that then just add a standard Filter node in the output wire and that will absorb the extra messages.

Your node does not seem to provide options to debounce a switch, in zigbee2mqtt properties of a switch look like this:


You can set a threshold there to what is considered as bouncing.

Anyway, if it does not work on zigbee level, you can still deal with it in node-red.
Just add a delay-node to the output of your switch node, configured like this

You can try and optimize the rate to your needs. Usually, 0.5 s should be a reasonable starting point.

I do not think a filter node can handle that properly. A switch sends identical payload every time when pressed, which will never pass the filter.