Bouncing switch

Hi All,

i have a switch that receive is_state from a sensor.file

now when i turn on or turn off the switch it bounce and after a few seconds it return to the right state

i tried to do the following:

when you change the switch to turn on write on to a the sensor.file then turn on the device everything worked great but the button is still bouncing from on to off wait a few seconds then understand that the state should be on then it change state this is really annoying and i don’t know how to fix it

is there a way that i can tell him not to change the state before he check the last line of the file ?
can i increase the sensor.file interval speed so it will work the second i change the file

is there a better solution to this issue then the one that i am trying ?

Thanks for your help :slight_smile:

I don’t know how to clean up your data, but de-bouncing an automation should be very easy with the for: option of the numeric state trigger. Just set that to some time long enough for your sensor to stop bouncing, and your automation won’t trigger until the bouncing has ended.