Xiaomi/Aqara Switches How To Ignore Repeat Clicks

I have some of the small switches which present as binary sensors. I’m trying to ignore duplicate clicks within a short period (i.e. I only want the first click to register an automation), however last changed/updated aren’t changed for a single click. Is there a way to do this?

Not to my knowledge, but maybe you can share your use case to help you?

I had an issue with the xiaomi switches that caused a single click to happen twice in a row. This was due to my network setup which caused the message to be revived twice. My work around should work for what you are trying to do.

Make an automation,
trigger single click,
Action turn on script

Make a script
Toggle light
Delay 5 second

This means if the button is pressed again within 5 seconds it won’t trigger.

I hope this helps.

That works but it still fires if the button is pressed multiple times as the wait needs to be after the toggle

I would setup a mqtt sensor and set the initial value to on. If your script triggers add a condition for value on of that mqtt sensor. On the action part on your script set the mqtt value of the sensor to off.

Add an additional automation, that the mqtt sensor is that to on every X seconds/minutes depending on the timeframe you want to avoid additional click events.

I don’t know how fast this would react but using an input_boolean should work:
trigger : click
condition : input_boolean is false
actions : set input_boolean to true
< anything else you wanna do>

then another automation to restore the boolean and then take the next click :
trigger : input_boolean to “true” for XX seconds/minutes/hours…
action : set input_boolean to false