Reset output pin after a specific time to 0

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
cybtrash
New user
Posts: 2
Joined: 16 Jun 2022, 22:51

Reset output pin after a specific time to 0

#1 Post by cybtrash » 16 Jun 2022, 23:15

Hello,

I created an irrigation/sprinkler controller with water valves, that are controlled by relays.

I can open a water valve by setting a dedicated output pin to "1" and close the valve by setting the pin to "0". The ESP (with ESP Easy) is controlled with via MQTT / iobroker.

I would like to implement a "safety measure":

Every time a pin is set to "1" (and the valve opens = water flows) a counter should start and reset that pin (only that one) to 0 again after a specific time (e.g. 30 minutes). Just in case the ESP looses WiFi connection and the "close valve" command from my smart home doesn't arrive.

Is this possible with ESP Easy? If not, is not possible with Tasmota?

Thank you very much.

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

Re: Reset output pin after a specific time to 0

#2 Post by TD-er » 16 Jun 2022, 23:23

Sure it is possible in ESPEasy :)
You can monitor the pin and if something is done to it, you can start a timer to disable the pin.

Code: Select all

on System#Boot do
  Monitor,GPIO,15   // Monitor GPIO 15
endon

on GPIO#15 do
  if %eventvalue1% = 0  // GPIO event sent by monitoring a pin, has an eventvalue reflecting the GPIO state
    timerSet,1,0 // Clear timer #1
  else
    timerSet,1,30 // Set timer #1 to 30 seconds
  endif
endon
 
on Rules#Timer=1 do
  GPIO,15,0  // Set GPIO 15 to 0
endon

cybtrash
New user
Posts: 2
Joined: 16 Jun 2022, 22:51

Re: Reset output pin after a specific time to 0

#3 Post by cybtrash » 16 Jun 2022, 23:36

TD-er wrote: 16 Jun 2022, 23:23 Sure it is possible in ESPEasy :)
You can monitor the pin and if something is done to it, you can start a timer to disable the pin.
Thanks so much TD-er!
I'll try it out immediately.

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests