[18:58:34][D][binary_sensor:036]: ‘Shutter’: Sending state ON
[18:58:34][D][binary_sensor:036]: ‘Shutter’: Sending state OFF
[18:58:35][D][binary_sensor:036]: ‘Shutter’: Sending state ON
[18:58:35][D][binary_sensor:036]: ‘Shutter’: Sending state OFF
How I can configure the sensor to remain ON for some seconds (e.g. 5s) only if the contact “counts” 3 ON/OFF cycles (aka 3 “clicks”)
I have no idea what that contact sensor actually is nor do you have a wiring diagram/schematic, but I’d guess that you likely need a pullup (or down) resistor.
Also, you don’t have your YAML quite formatted correctly, so it’s hard to read (and tell if you’re doing anything wrong). Start and end it with ```
For a tracking the number of pulses from a NC micro-switch?
Wouldnt pulse counter be better here? This is basically the type of scenario it was added for and it easily distinguishes between directions of movement. How would you track motion in 2 directions (clockwise/counterclockwise) with binary_sensor?
It explains this exact use case in the copy from the data sheet OP shared. Idk why no one reads those things and instead run away like data sheets are scary.
The pulse counter accumulates the total number of pulses, the OP was asking about detecting a sequence of 3 pulses, presumably within a given time window. You could probably do that with pulse_counter and some filters, but it’s not the intended use case.
As far as direction goes, there is no way you can determine direction from a single microswitch, you would need a rotary encoder for that.