How to publish to get the value or state of the gpio?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

How to publish to get the value or state of the gpio?

#1 Post by kenkoknz » 07 Feb 2019, 21:14

Hi,
I want to poll a gpio to see what the pin status is, how do I use publish to get the value or state of the gpio?

device nset in gpio 0 as a switch
Name: switch, Value: swi


I tried on the rules command: publish,/wemos01/gpio/0,[switch#sw1] but only shows "[switch#sw1] not the value.
Not much info in the docs (says to be added).

Any advice?

Thanks

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

Re: How to publish to get the value or state of the gpio?

#2 Post by grovkillen » 08 Feb 2019, 08:15

Name: switch, Value: swi
is not what you have here:
publish,/wemos01/gpio/0,[switch#sw1]
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:

kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

Re: How to publish to get the value or state of the gpio?

#3 Post by kenkoknz » 08 Feb 2019, 08:55

Hi,
Was a typo above, I did set:
Name:switch Value:sw1
"
Idea was to "poll" the esp (via mqtt) at any time to return a status of the gpio pin in the esp . The esp will mqtt listen(sniff) for a "poll" and response with a publish of the gpio status.
I am just not sure with the syntax of the publish command.

Thanks,

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

Re: How to publish to get the value or state of the gpio?

#4 Post by grovkillen » 08 Feb 2019, 09:00

Then it looks correct. Please provide all settings so I can look and see what might be the problem.
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:

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 5 guests