Rules: (Relay On / wait) x 4.

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
JR01
Normal user
Posts: 260
Joined: 14 Feb 2016, 21:04
Location: South Africa

Rules: (Relay On / wait) x 4.

#1 Post by JR01 » 07 Oct 2019, 19:40

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

-----------
IOTPLAY. Tinkerer, my projects are @ http://GitHub.com/IoTPlay, and blog https://iotplay.org. Using RPi, Node-Red, ESP8266 to prove Industry 4.0 concepts.

JR01
Normal user
Posts: 260
Joined: 14 Feb 2016, 21:04
Location: South Africa

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

#2 Post by JR01 » 07 Oct 2019, 19:49

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

-----------
IOTPLAY. Tinkerer, my projects are @ http://GitHub.com/IoTPlay, and blog https://iotplay.org. Using RPi, Node-Red, ESP8266 to prove Industry 4.0 concepts.

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

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

#3 Post by grovkillen » 07 Oct 2019, 20:32

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
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:

JR01
Normal user
Posts: 260
Joined: 14 Feb 2016, 21:04
Location: South Africa

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

#4 Post by JR01 » 07 Oct 2019, 21:20

Ahhhh, smart !

Let me try that.
-----------
IOTPLAY. Tinkerer, my projects are @ http://GitHub.com/IoTPlay, and blog https://iotplay.org. Using RPi, Node-Red, ESP8266 to prove Industry 4.0 concepts.

JR01
Normal user
Posts: 260
Joined: 14 Feb 2016, 21:04
Location: South Africa

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

#5 Post by JR01 » 08 Oct 2019, 19:09

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
-----------
IOTPLAY. Tinkerer, my projects are @ http://GitHub.com/IoTPlay, and blog https://iotplay.org. Using RPi, Node-Red, ESP8266 to prove Industry 4.0 concepts.

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

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

#6 Post by grovkillen » 08 Oct 2019, 19:45

Instead of [VAR#1] use [INT#1]. That way you don't need to use the formatting.
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:

JR01
Normal user
Posts: 260
Joined: 14 Feb 2016, 21:04
Location: South Africa

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

#7 Post by JR01 » 10 Oct 2019, 21:48

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?
-----------
IOTPLAY. Tinkerer, my projects are @ http://GitHub.com/IoTPlay, and blog https://iotplay.org. Using RPi, Node-Red, ESP8266 to prove Industry 4.0 concepts.

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

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

#8 Post by TD-er » 10 Oct 2019, 22:38

Hmm that may be a formatting issue I should fix.

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

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 30 guests