Rules on mega version problem

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kimot
Normal user
Posts: 157
Joined: 12 Oct 2017, 20:46

Rules on mega version problem

#1 Post by kimot » 14 Mar 2019, 22:17

Can somebody check my rules, which not works on mega version firmware please.

I am normally using v2.0 version firmware for my floor heating controller.
Rules have got about 1900 characters and all works fine.

If I try new mega versions no "if" statements works.

I "strip" down this rules for testing and easy understood.

Code: Select all

On System#Boot do
 gpio,13,0            // relay and LED off
 gpio,12,0 
 TaskValueSet,2,2,27  // Var#Setpoint  27deg
 TaskValueSet,2,3,0   // Var#Heating
 TaskValueSet,2,4,20  // Var#Mode
 TaskValueSet,2,1,1   // Var#HDO
 TaskValueSet,4,1,0
 TaskValueSet,4,2,0
 TaskValueSet,3,1,24.5  //  Floor#Temp simulation to 24.5deg
 timerSet,1,30         // timer1 event after 30s
endon

on HeatingOn do        // relay and LED on
 gpio,12,1
 gpio,13,0
endon

on HeatingOff do      // relay and LED off
 gpio,12,0
 gpio,13,1
endon

On Rules#Timer=1 do
 TaskValueSet,2,3,0              // clear Var#Heating

if [Floor#Temp]<[Var#Setpoint]
  TaskValueSet,2,3,1             // if heating needed, set Var#Heating to 1
endif
 
if [Var#Heating]=1        
  event,HeatingOn             // relay and LED on
 else
  event,HeatingOff             // relay and LED off
 endif
 timerSet,1,60                  // next timer1 event after 60s
endon
Dummy variable Floor#Temp simulates temperature from DS18B20 for this testing.


On v2.0 it works fine and debug is here ( commented by me ):

Code: Select all

EVENT: Rules#Timer=1
ACT  : TaskValueSet,2,3,0
ACT  : TaskValueSet,2,3,1         // if [Floor#Temp]<[Var#Setpoint]    24.5<27
ACT  : 
ACT  : event,HeatingOn         // if [Var#Heating]=1
EVENT: HeatingOn
ACT  : gpio,12,1
SW   : GPIO 12 Set to 1
ACT  : gpio,13,0
SW   : GPIO 13 Set to 0
EVENT: HeatingOn Processing time:69 milliSeconds
ACT  : timerSet,1,60
EVENT: Rules#Timer=1 Processing time:128 milliSeconds
for mega it do not work - no setting Var#Heating to 1
I see problems in "if" statements

Code: Select all

31767 : EVENT: Rules#Timer=1
31800 : ACT  : TaskValueSet,2,3,0
31811 : Command: taskvalueset
31811 : TaskValueSet,2,3,0
31831 : Lev.1: [if 24.50<]=false               // if [Floor#Temp]<[Var#Setpoint]    24.5<27
31839 : ACT  : 
31849 : Lev.1: [if =1]=false                        // if [Var#Heating]=1
31854 : Lev.1: [else]=true
31857 : ACT  : event,HeatingOff
31865 : Command: event
31866 : event,HeatingOff
31868 : EVENT: HeatingOff
31925 : ACT  : gpio,12,0
31930 : SW   : GPIO 12 Set to 0
31933 : ACT  : gpio,13,1
31937 : SW   : GPIO 13 Set to 1
31962 : EVENT: HeatingOff Processing time:94 milliSeconds
31967 : ACT  : timerSet,1,60
31974 : Command: timerset
31975 : timerSet,1,60
31992 : EVENT: Rules#Timer=1 Processing time:225 milliSeconds
If I change if [Floor#Temp]<[Var#Setpoint] to if [Floor#Temp]<27
this part of code works and sets Var#Heating to 1
But in real version I am sending Setpoint from Domoticz, so I need store it and compare from dummy variable.

Code: Select all

31824 : Lev.1: [if 24.50<27]=true
31828 : ACT  : TaskValueSet,2,3,1
31839 : Command: taskvalueset
31839 : TaskValueSet,2,3,1
But if[Var#Heating]=1 still do not work correctly.

Thanks for your advice.

My Dummy variables:
2019-03-14-214709_1920x1080_scrot.png
2019-03-14-214709_1920x1080_scrot.png (105.17 KiB) Viewed 362 times

User avatar
ThomasB
Normal user
Posts: 383
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Rules on mega version problem

#2 Post by ThomasB » 15 Mar 2019, 01:24

I see two TaskValue variables in your rules that are referencing a missing Dummy Device. These:

Code: Select all

 TaskValueSet,4,1,0
 TaskValueSet,4,2,0
Maybe this is confusing the rule engine? Try removing them (or create the mating Dummy Device and its 2 variables) and see what happens.

- Thomas

kimot
Normal user
Posts: 157
Joined: 12 Oct 2017, 20:46

Re: Rules on mega version problem

#3 Post by kimot » 15 Mar 2019, 23:12

I remove it, but result is the same.
I think - it is very simple rules and I do not understand why it not works on mega version.

User avatar
ThomasB
Normal user
Posts: 383
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Rules on mega version problem

#4 Post by ThomasB » 16 Mar 2019, 18:05

You have a odd problem. I don't see any other issues in the rule syntax. Maybe another set of eyes will spot something.

BTW, in Tools=>Advanced_Settings->Rule_Settings there is a entry for "Old Engine." This box should be checked (enable old engine).

- Thomas

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests