Page 1 of 1

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

Posted: 07 Feb 2019, 21:14
by kenkoknz
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

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

Posted: 08 Feb 2019, 08:15
by grovkillen
Name: switch, Value: swi
is not what you have here:
publish,/wemos01/gpio/0,[switch#sw1]

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

Posted: 08 Feb 2019, 08:55
by kenkoknz
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,

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

Posted: 08 Feb 2019, 09:00
by grovkillen
Then it looks correct. Please provide all settings so I can look and see what might be the problem.