[SOLVED] Read state of a GPIO

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

[SOLVED] Read state of a GPIO

#1 Post by leel1967l » 01 Feb 2018, 22:18

Hi,
I need to read the state of a GPIO (where I attached a relay) in order to print its status in the oled display.
I tried everything, but couldn't find a solution.
The only way I managed to get the value was defining the relay GPIO as an input switch but the unit crashes after a few on/off cycles.
And probably it's correct as the relay is not an input switch.

I tried assigning a dummy device with a rule coming from OPENHAB. But of course it could go out of sync if the relay is activated outside from openhab.

I am stuck.

So, basically, I need to be able to display the relay status on the display reading the GPIO status, but cannot do it.

Any ideas?
Last edited by leel1967l on 04 Feb 2018, 00:34, edited 1 time in total.

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

Re: Read state of a GPIO

#2 Post by grovkillen » 01 Feb 2018, 22:33

I use the switch device to monitor the relay state, have been for a year. No problem what so ever. Why wouldn't it work, it's only a high/low signal.

Please give us all your settings and rules. You can (if you're on Windows) use my webdumper app to do that.
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:

leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

Re: Read state of a GPIO

#3 Post by leel1967l » 01 Feb 2018, 22:42

Which version of the firmware are you using?
I am on MEGA dev13
Last edited by leel1967l on 01 Feb 2018, 22:43, edited 1 time in total.

leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

Re: Read state of a GPIO

#4 Post by leel1967l » 01 Feb 2018, 22:43

grovkillen wrote: 01 Feb 2018, 22:33 I use the switch device to monitor the relay state, have been for a year. No problem what so ever. Why wouldn't it work, it's only a high/low signal.

Please give us all your settings and rules. You can (if you're on Windows) use my webdumper app to do that.
Which version of the firmware are you using?
I am on MEGA dev13

TD-er
Core team member
Posts: 8754
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Read state of a GPIO

#5 Post by TD-er » 01 Feb 2018, 22:43

There are lots of issues fixed since then, please test on a newer version.

leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

Re: Read state of a GPIO

#6 Post by leel1967l » 01 Feb 2018, 22:56

TD-er wrote: 01 Feb 2018, 22:43 There are lots of issues fixed since then, please test on a newer version.
ok.
You mean "mega-20180130" or "V2-20180130"?

But for my curiosity, which version are you using?

With R147 I was able to define an input switch connected to a relay and it was working. Moving to V2 it started crashing.

leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

Re: Read state of a GPIO

#7 Post by leel1967l » 02 Feb 2018, 00:51

grovkillen wrote: 01 Feb 2018, 22:33 I use the switch device to monitor the relay state, have been for a year. No problem what so ever. Why wouldn't it work, it's only a high/low signal.

Please give us all your settings and rules. You can (if you're on Windows) use my webdumper app to do that.
Hi,
which version of ESP Easy are you using with relay and switch input?
(Nice app webdumper by the way!)

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

Re: Read state of a GPIO

#8 Post by grovkillen » 02 Feb 2018, 05:58

I use the latest v2.0 found on Github.

But you said that r147 was working ok, and that it started to cause problem when you updated to v2.0? Could you please make sure that the switch device for the relay is set to "switch" and not "dimmer". The update can cause problem with switch devices because of the added functionality.

Thanks for the feedback on my webdumper app :D
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:

leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

Re: Read state of a GPIO

#9 Post by leel1967l » 02 Feb 2018, 10:43

grovkillen wrote: 02 Feb 2018, 05:58 I use the latest v2.0 found on Github.

But you said that r147 was working ok, and that it started to cause problem when you updated to v2.0? Could you please make sure that the switch device for the relay is set to "switch" and not "dimmer". The update can cause problem with switch devices because of the added functionality.

Thanks for the feedback on my webdumper app :D
Hi,
I tested latest version on Github and there seem to be no more crashes.
Will test for few more days, but I believe that the issue is solved.
thanks

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

Re: Read state of a GPIO

#10 Post by grovkillen » 02 Feb 2018, 10:47

Great
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:

Jejski
New user
Posts: 2
Joined: 03 Feb 2018, 12:19
Location: Poland

Re: Read state of a GPIO

#11 Post by Jejski » 03 Feb 2018, 17:28

Try to write a rule like this [name # value] in the display setting.
I am sorry I am a language invalid and I use a translator ;)

pmalvino
Normal user
Posts: 15
Joined: 03 Aug 2016, 22:34

Re: Read state of a GPIO

#12 Post by pmalvino » 08 Mar 2018, 12:42

Jejski wrote: 03 Feb 2018, 17:28 Try to write a rule like this [name # value] in the display setting.
Hello. My issue is very similar to yours. , Do you tried to write a rule like that in the display setting? Did it work?

My post:
viewtopic.php?f=6&t=4957&start=10

Post Reply

Who is online

Users browsing this forum: No registered users and 127 guests