How to configure switch input?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
rajd
New user
Posts: 2
Joined: 30 Oct 2017, 22:53

How to configure switch input?

#1 Post by rajd » 30 Oct 2017, 23:03

Hello all,

I've been using ESPEasy for a fair while now to gather data from a number of sensors. All my boards are running the latest prerelease of 2.0 and work like a charm, so I am a happy camper. There's just one thing I can't seem to get going: I want to use a momentary switch with ESP Easy.

I figured the standard switch input would suffice. I've tried a zillion of different configurations, yet to (almost) no avail. With R120 I can't get any results at all, with R210 I don't get any results. With 2.0 dev12 I sometimes get results

What I'm doing:
- Connect a switch between a GPIO and GND or 3.3V
- Configure the switch input as follows:
* Device = Switch input
* Delay = 1 (no effect on R120, seems to be a requirement for 2.0 to get any data over the line)
* IDX / Var = 1 (or something else, doesn't seem to do anything?)
* 1st GPIO: the GPIO my switch is connected to, tried a number of them
* Pull UP: tried both on and off, to no avail
* Inversed: tried both on and off
* Switch type: switch
* Switch button type: tried all options, used the low setting when connecting to GND, high when connected to 3.3V
* Send boot state: off (when turning it on, my MQTT broker receives a one-time push of the button)
* Send data: on

Am I missing something obvious here. I've tried a number of boards. I've made sure my MQTT connection is working. There's nothing interesting in the logs. Any help is greatly appreciated :)

adval40
Normal user
Posts: 26
Joined: 04 Apr 2017, 23:14

Re: How to configure switch input?

#2 Post by adval40 » 30 Oct 2017, 23:42

Did you refresh your screen after changing the port ?

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: How to configure switch input?

#3 Post by vader » 30 Oct 2017, 23:43

Internal PullUp: yes (if button goes to GND)
Inversed: No
Delay: 0
Switch type: Switch for e.g. door opener, active low for e.g. light switch (on/off)
IDX is for domoticz
That should work so far...

The rules:

on Button#State do
if [Button#State]=1
gpio 12,1
else
gpio 12,0
endif
endon

More in the Wiki.... ;)

rajd
New user
Posts: 2
Joined: 30 Oct 2017, 22:53

Re: How to configure switch input?

#4 Post by rajd » 31 Oct 2017, 09:12

Thanks, seems I'm getting somewhere. The board I'm working with atm has an internal pull-up at GPIO2 / D4, so I configured my switch for GPIO2 as Push button active low, activated Pull-up (dunno if that's necessary given the GPIO2 specification?) and guess what... pushes of the button are communicated.

There's just one more thing I need to tackle: somehow the module keeps disconnecting from my MQTT server. That's behaviour I haven't seen before. My other modules don't seem to be affected by this. It's maybe the module.

Post Reply

Who is online

Users browsing this forum: No registered users and 142 guests