Page 1 of 1

Rules: (Relay On / wait) x 4.

Posted: 07 Oct 2019, 19:40
by JR01
Hi, struggling with Rules, for a Sprinkler system. I have a some working rules that switches on a boreholepump together with the specific leg, of which I have 4. When set on Auto mode, a dummy variable, Vars#AutoI want it to start 15min after sunrise, sprinkle for 13min on Leg1, then wait for 20min for the borehole to fill with water, do the next leg, wait, etc. I have a dummy Device - with variables can set, but initialized with 13min (for relay on) / 20min for wait. This variable's name is then Vars#durLegRest.

So, I decided to use the Delay command - see below. But this does not work - the code goes fast from event,L1 (another action with the instructions to switch on pump and the specific leg), to event,L4 - without executing any of L1,L2,L3 - and only executes L4.

I assume the Delay node cannot wait - how do I do it then? With timerSet ?

Code: Select all

On Clock#Time=All,%sunrise+15m% do 
    if [Vars#Auto]=1
    	event,L1
   	Delay,[Vars#durLegRest]
   	event,L2
   	Delay,[Vars#durLegRest]
   	event,L3
    	Delay,[Vars#durLegRest]
   	event,L4
    	Delay,[Vars#durLegRest]
    endif
  endon


Re: Rules: (Relay On / wait) x 4.

Posted: 07 Oct 2019, 19:49
by JR01
This is how I have done it now, not sure yet if it will work - (testing tomorrow morning), is this the most efficient way to do it? Seams daft...

Code: Select all

On Clock#Time=All,%sunrise+15m% do 
  if [Vars#Auto]=1 
    event,L1
    timerSet,6,[Vars#durLegRest]
  endif
endon

on Rules#Timer=6 do
  if [Vars#Auto]=1 
    event,L2
    timerSet,7,[Vars#durLegRest]
  endif
endon

on Rules#Timer=7 do
  if [Vars#Auto]=1 
    event,L3
    timerSet,8,[Vars#durLegRest]
  endif
endon

on Rules#Timer=8 do
  if [Vars#Auto]=1 
    event,L4
  endif
endon


Re: Rules: (Relay On / wait) x 4.

Posted: 07 Oct 2019, 20:32
by grovkillen

Code: Select all

On Clock#Time=All,%sunrise+15m% Do
 Let,1,0
 Event,LoopDeLoop=[Vars#durLegRest]
EndOn

On LoopDeLoop Do
  if [Vars#Auto]=1
    Let,1,[VAR#1]+1
    event,L[VAR#1]
    timerSet,6,%eventvalue%
  endif
EndOn

On Rules#Timer=6 Do
  if [VAR#1]<5
   Event,LoopDeLoop=[Vars#durLegRest]
  endif
EndOn

Re: Rules: (Relay On / wait) x 4.

Posted: 07 Oct 2019, 21:20
by JR01
Ahhhh, smart !

Let me try that.

Re: Rules: (Relay On / wait) x 4.

Posted: 08 Oct 2019, 19:09
by JR01
Here is what is working, I had to use your new Rules formatting, for leg event,L1.

My 1st time I am using formatting rules !!! Thank you !

Code: Select all

On Clock#Time=All,06:00 Do
  Let,1,0
  Event,LoopDeLoop=[Vars#durLegRest]
EndOn

On LoopDeLoop Do
  if [Vars#Auto]=1
    Let,1,[VAR#1#D1.0]+1
    event,L[VAR#1#D1.0]
    timerSet,6,%eventvalue%
  endif
EndOn

On Rules#Timer=6 Do
  if [VAR#1]<5
    Event,LoopDeLoop=[Vars#durLegRest]
  endif
EndOn

Re: Rules: (Relay On / wait) x 4.

Posted: 08 Oct 2019, 19:45
by grovkillen
Instead of [VAR#1] use [INT#1]. That way you don't need to use the formatting.

Re: Rules: (Relay On / wait) x 4.

Posted: 10 Oct 2019, 21:48
by JR01
Nope,
Instead of [VAR#1] use [INT#1]. That way you don't need to use the formatting.
It does not work.

This :

Code: Select all

event,L[INT#1]
produces

Code: Select all

event,L 1
, with a space between the L and the 1.

Reverting back. But why a space?

Re: Rules: (Relay On / wait) x 4.

Posted: 10 Oct 2019, 22:38
by TD-er
Hmm that may be a formatting issue I should fix.

Edit:
Made an issue for it: https://github.com/letscontrolit/ESPEasy/issues/2655