Status of GPIO pin always 0

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
caco3
New user
Posts: 4
Joined: 03 Jul 2018, 20:51

Status of GPIO pin always 0

#1 Post by caco3 » 14 Jul 2018, 00:20

Hi

I have set GPIO13 as an input.
The devices page shows the value correctly as 1 or 0.
Also when I read http://<IP>/json, I can see the correct state:

Code: Select all

"Sensors":[
{
"TaskValues": [
{"ValueNumber":1,
"Name":"Switch",
"NrDecimals":0,
"Value":1
}],
How ever when I try to read the status using

Code: Select all

http://<IP>/control?cmd=status,GPIO,13
the state is always 0:

Code: Select all

{ "log": "", "plugin": 1, "pin": 13, "mode": "input", "state": 0 } 
What am I missing?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Status of GPIO pin always 0

#2 Post by grovkillen » 14 Jul 2018, 08:23

Have you previously used PWM on that pin? Do a PWM zero command and see if the same is happening? But it sounds like it's the same thing as reported here: https://github.com/letscontrolit/ESPEasy/issues/1551
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

caco3
New user
Posts: 4
Joined: 03 Jul 2018, 20:51

Re: Status of GPIO pin always 0

#3 Post by caco3 » 14 Jul 2018, 22:54

Thanks for the reply!

I haven't used any PWM functionality, in fact its the first time I configure this device.
In fact it has exactly the same symptoms as in the mentioned bug report. I will further trace it down there.

As a workaround I did the following:
1. Configure a 2nd device, eg on GPIO2.
2. Add the following rule:

Code: Select all

on Switch#Switch do
    if [Switch#Switch]=0
        gpio,2,1
    else
        gpio,2,0
    endif
endon
Whenever GPIO13 changes, the rule gets executed which sets GPIO2.
GPIO2 now shows the correct state when it gets polled.

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests