how to get/read value of GPIO pin?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
hvdwolf
Normal user
Posts: 51
Joined: 09 Jun 2016, 12:37

how to get/read value of GPIO pin?

#1 Post by hvdwolf » 31 Jan 2020, 13:34

Maybe this is a simple question but I simply can't find it. Not here in the forum, not in the command reference wiki (not exact enough) and neither in the Rules turorial wiki.

I created a dummy value that should reflect the status of a GPIO pin. And I want that done from internally on the ESPeasy.

This GPIO13 pin controls a (Keyes) relais and that is triggered externally from pimatic and that works fine.
I "could" set the dummy value from pimatic, but I want the EspEasy to be more "self supporting" and read it itself.

So I created a rules set:

Code: Select all

On System#Boot do    //When the ESP boots, do
   timerSet,1,10      //Set Timer 1 for the next event in 10 seconds
endon

On Rules#Timer=1 do  //When Timer1 expires, do
  TaskValueSet 2,4,"status,gpio,13"
  timerSet,1,20      //Set Timer 1 for the next event in 20 seconds
endon
This does not work. I also tried TaskValueSet 2,4,"cmd=status,gpio,13"

I do not know how to use an event in this.
In above "Rules#Timer=1" loop I tried also something like:

Code: Select all

if [cmd=status,gpio,13]=1
  TaskValueSet 2,4,1
else
  TaskValueSet 2,4,1
endif
(with and without cmd= and some other tries)
That doesn't work either (and is actually a clumsy way to do it, but if it is the only way, so be it).

hvdwolf
Normal user
Posts: 51
Joined: 09 Jun 2016, 12:37

Re: how to get/read value of GPIO pin?

#2 Post by hvdwolf » 31 Jan 2020, 14:41

I am sorry. After about 4 hours trial and error, I found the solution myself in 20-30 minutes.
I am now using a Switch input "Thermostaat" with value "Status"
and created a rule:

Code: Select all

on Thermostaat#Status do
  TaskValueSet 2,4,"[Thermostaat#Status]"
endon
All works fine now.

Post Reply

Who is online

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