prevent a timer restart before expiration

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jopare
Normal user
Posts: 11
Joined: 29 Oct 2018, 20:15

prevent a timer restart before expiration

#1 Post by jopare » 05 Nov 2018, 22:07

Hi, I trigger a relay with a radar motion sensor to switch a light on for a certain time.
Unfortunately the timer becomes restartet before his expiration whenever the motion sensor sends a signal.
I want to prevent this so that the timer can only be restarted after he has expired. Found nothing helpful
neither here nor in the docu. Any help will be appreciated. Thx.

Code: Select all

on Radar#send do     
if [Radar#send] = 1
timerset,1,10       
GPIO,5,1             
endon  
          
on Rules#Timer=1 do  
timerset,1,0         
GPIO,5,0

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

Re: prevent a timer restart before expiration

#2 Post by grovkillen » 05 Nov 2018, 22:35

The timers are always disabled one triggered.

Code: Select all

on Radar#send do
if [Radar#send]=1
timerset,1,10
GPIO,5,1
Endif
endon  
          
on Rules#Timer=1 do
GPIO,5,0
EndOn
But your code was not correct with closing "endif".

More on rules here: https://www.letscontrolit.com/wiki/inde ... rial_Rules
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:

jopare
Normal user
Posts: 11
Joined: 29 Oct 2018, 20:15

Re: prevent a timer restart before expiration

#3 Post by jopare » 05 Nov 2018, 22:54

Oh yes, thanks for the hint, i've obviously overlooked this. However, it doesn't change anything on the behaviour.

jopare
Normal user
Posts: 11
Joined: 29 Oct 2018, 20:15

Re: prevent a timer restart before expiration

#4 Post by jopare » 05 Nov 2018, 23:11

Sorry, i made a mistake. I've forgotten to submit the change. Thanks, everything works as favored.

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: prevent a timer restart before expiration

#5 Post by Domosapiens » 05 Nov 2018, 23:23

[you replied while i was typing, anyhow....]

Assuming you are using RCWL-0516.
connect RCWL-0516 CDS (Enable) to GPIO 15 (D8).
GPIO 15 (D8) is special for the boot sequence but can be used without pull-up!

Code: Select all

On System#Boot do
GPIO,15,1 //Enable RCWL-0516
Endon

On Radar#send=1 do
timerset,1,10
GPIO,5,1           //Your relay
GPIO,15,0         //Disable RCWL-0516
Endon

On Rules#Timer=1 do
GPIO,5,0
GPIO,15,1        //Re-Enable RCWL-0516
Endon
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

Post Reply

Who is online

Users browsing this forum: No registered users and 52 guests