Page 1 of 1

Push button behaviour

Posted: 06 Apr 2021, 14:29
by fredfit
Hi all,

I'm still struggling with my little project (see topic viewtopic.php?f=5&t=8450) and found out that the "switch" device, when set to "Push Button Active Low" has a strange behaviour, which is most probably the root cause of my issues.
I performed some tests on GPIO-14 (D5) (pin whithout exclamation point to avoid any unexpected behaviour) of an ESP8266 board.
I ticked "Internal pullup" and set the GPIO boot state to "Input pullup" and placed a push button from D5 to the GND.
When I press the push button, I see the state of the switch ("Devices" tab) going from 1 to 0. But when I stop pressing the push button, it doesn't come back to 1 unless I press the it again.
It looks like what is called a "push button" acts like a "bistable switch" instead.

Same behaviour by desabling the software pullup and replacing it by a hardware one (10K resistor connected to 3V pin).

Any idea how to get a real push button functionality instead of a bistable one ?
Thanks!

Re: Push button behaviour

Posted: 06 Apr 2021, 14:45
by TD-er
Just set it to "normal" switch to have the task state follow the button state (or invert if you tick to invert the logic).

Re: Push button behaviour

Posted: 06 Apr 2021, 15:32
by fredfit
Thank you TD-er, tested successfully.
It looks weird that the behaviour in ESPeasy is the opposite of what are called "switch" or "push button" devices in electronics ... I've probably lost a lot of time because of that :roll:

Re: Push button behaviour

Posted: 06 Apr 2021, 20:34
by TD-er
Yep, I guess it may need a bit more descriptive text. The word "toggle" is already a good hint.