*Solved *Rules not working

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
SoN
New user
Posts: 4
Joined: 03 Jan 2018, 11:05

*Solved *Rules not working

#1 Post by SoN » 03 Jan 2018, 11:10

Hi, i don't know why this code isn't working:

Code: Select all

On System#Boot do
TaskValueSet,5,1,1 //Dummy-Task5 Para#SP
TaskValueSet,5,2,1 //Dummy-Task5 Para#HYST
endOn

On WW-VL#Temp do // WW-VL#Temp = DS18B20 Nr1  WW-RL#Temp = DS18B20 Nr2
   if [Para#HYST] = 1
   TaskValueSet,5,1,([WW-VL#Temp]-[WW-RL#Temp]) //Temp-Diff in Para#SP
      if [Para#SP] > 5
        gpio,5,1
        TaskValueSet,5,2,0
        timerSet,1,180
      endif
   endif
endOn

On Rules#Timer=1 do
    gpio,5,0
    timerSet,2,3600 //Pause 1h
endOn

On Rules#Timer=2 do
    TaskValueSet,5,2,1 
endOn
If enabled, the esp webserver is no longer accessible. a permanent ping results in irregular timeouts. for brief moments the esp answers

Please can someone explain why?
Thank You
Last edited by SoN on 03 Jan 2018, 14:45, edited 1 time in total.

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

Re: Rules not working

#2 Post by grovkillen » 03 Jan 2018, 11:34

This section here is not allowed (nesting if statements are not possible in the esp easy rule engine... please study the wiki on how to overcome this "problem")

Code: Select all

   if [Para#HYST] = 1
   TaskValueSet,5,1,([WW-VL#Temp]-[WW-RL#Temp]) //Temp-Diff in Para#SP
      if [Para#SP] > 5
        gpio,5,1
        TaskValueSet,5,2,0
        timerSet,1,180
      endif
   endif
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:

SoN
New user
Posts: 4
Joined: 03 Jan 2018, 11:05

Re: Rules not working

#3 Post by SoN » 03 Jan 2018, 12:24

Thank you !!
is this ok?
for 1. try ... isn't working

Code: Select all

On System#Boot do
TaskValueSet,5,1,1 //Dummy-Task5 Para#SP
TaskValueSet,5,2,1 //Dummy-Task5 Para#HYST
endOn

On WW-VL#Temp do // WW-VL#Temp = DS18B20 Nr1  WW-RL#Temp = DS18B20 Nr2
if [Para#HYST] = 1
TaskValueSet,5,1,([WW-VL#Temp]-[WW-RL#Temp]) //Temp-Diff in Para#SP
event <pump-on>     
endif
endOn


on <pump-on> do
if [Para#SP] > 5
gpio,5,1
TaskValueSet,5,2,0
timerSet,1,180
endif
endon

On Rules#Timer=1 do
gpio,5,0
timerSet,2,3600 //Pause 1h
endOn

On Rules#Timer=2 do
TaskValueSet,5,2,1 
endOn

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Rules not working

#4 Post by vader » 03 Jan 2018, 12:35

Try this...

on Para#HYST = 1 do
TaskValueSet,5,1,[WW-VL#Temp]-[WW-RL#Temp] //Temp-Diff in Para#SP
if [Para#SP] > 5
gpio,5,1
TaskValueSet,5,2,0
timerSet,1,180
endif
endon

SoN
New user
Posts: 4
Joined: 03 Jan 2018, 11:05

Re: Rules not working

#5 Post by SoN » 03 Jan 2018, 13:14

as soon as I activate the rules the esp is not reliable anymore.
many timeouts.
it is a matter of luck if the web interface responds.
Load on Main-page is 75%, without rules 0%
is it possible that there is an endless loop?

without this line everything is ok:
TaskValueSet,5,1,[WW-VL#Temp]-[WW-RL#Temp]

do i need a delay for reading the ds18b20 sensors?

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Rules not working

#6 Post by vader » 03 Jan 2018, 13:28

You have
on <pump-on> do

Correct it to: on pump-on do

Or better change all to "pumpon" or "pump_on". Maybe the parser has a problem with the "-" in the name!

Normally sensors have a delay of 60 sec. Post a screenshot of yours....

SoN
New user
Posts: 4
Joined: 03 Jan 2018, 11:05

Re: Rules not working

#7 Post by SoN » 03 Jan 2018, 14:24

This works :

Code: Select all

On System#Boot do
TaskValueSet,5,1,1 //Dummy-Task5 Para#SP
TaskValueSet,5,2,1 //Dummy-Task5 Para#HYST
endon

On WW-VL#Temp do // WW-VL#Temp = DS18B20 Nr1  WW-RL#Temp = DS18B20 Nr2
if [Para#HYST] = 1
TaskValueSet,5,1,([WW-VL#Temp]-[WW-RL#Temp]) //Temp-Diff in Para#SP
event pumpon
endif
endon

on pumpon do
if [Para#SP] > 5
gpio,5,1
TaskValueSet,5,2,0
timerSet,1,180
endif
endon

On Rules#Timer=1 do
gpio,5,0
timerSet,2,3600 //Pause 1h
endon

On Rules#Timer=2 do
TaskValueSet,5,2,1
endon
Thank you for help

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: *Solved *Rules not working

#8 Post by vader » 03 Jan 2018, 15:30

Supi. U r welcome.

You can change this
TaskValueSet,5,1,([WW-VL#Temp]-[WW-RL#Temp])
into this
TaskValueSet,5,1,[WW-VL#Temp]-[WW-RL#Temp]

because it's just a simple subtraction, so we don't need the brackets ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 46 guests