Page 1 of 1

Rule problem in mega-20191028

Posted: 28 Oct 2019, 14:05
by mackowiakp
Below rule I use at least 1 year

Code: Select all

On Clock#Time=All,**:** Do
 Let,2,%sysweekday%
If [VAR#1]=1 and [VAR#7]=0  and  %sysyear% > 2000
  Let,1,0
  event,LCD_REFRESH
 else
  if [VAR#7]=0
   Let,1,0
   LCD,1,1,Synchronizacja czasu
  EndIf
 Endif
 event,LCD_DIM
 Let,1,1
 SendToHTTP,192.168.0.25,8080,/json.htm?type=command&param=switchlight&idx=124&switchcmd=On
Endon
After installing mega-20191028 normal 4M1M 2.6.0, the "if" statement does not work properly.

Below working and not working syntax:

Code: Select all

 // Not working statement
 If [VAR#1]=1 and [VAR#7]=0  and  %sysyear% > 2000
 
 // Working statement
  If [VAR#1]=1 and [VAR#7]=0
The "and %sysyear% > 2000" shows me that NTP is synced. Is it issue or my error?

EDIT:

Code: Select all

if [Temp+Baro#Baro] > 100 and [Temp+Baro#Baro] < 1200
does not work too.

Re: Rule problem in mega-20191028

Posted: 28 Oct 2019, 15:24
by grovkillen
What does the log say?

Re: Rule problem in mega-20191028

Posted: 28 Oct 2019, 16:13
by mackowiakp
Nothing special. Below logs when "On Clock#Time=All,**:** Do" is executed with "
If [VAR#1]=1 and [VAR#7]=0 and %sysyear% > 2000" statement. This shows that "IF" is not interpreted correctly.

Code: Select all

6095283: WD   : Uptime 102 ConnectFailures 0 FreeMem 18432 WiFiStatus 3
6112885: ADC  : Analog value: 0 = 0.000
6112887: EVENT: VOC-Piotr#VOC-Piotr=1024.00
6113764: EVENT: Clock#Time=Mon,16:10
6113894: ACT  : Let,2,2           
6113904: Command: let
6113916: ACT  : Let,1,0
6113921: Command: let
6113924: ACT  : LCD,1,1,Synchronizacja czasu
6113995: ACT  : event,LCD_DIM
6114001: Command: event
6114002: EVENT: LCD_DIM
6114201: ACT  : Let,1,1
6114207: Command: let
6114211: ACT  : SendToHTTP,192.168.0.25,8080,/json.htm?type=command¶m=switchlight&idx=124&switchcmd=On
6114218: Command: sendtohttp
6117174: HTTP: TaskValueSet,1,1,7.5
6117175: Command: taskvalueset
6117387: HTTP: TaskRun,1
6117388: Command: taskrun
6117419: Dummy: value 1: 7.50
6117419: Dummy: value 2: 1022.00
6117419: Dummy: value 3: 20.00
6117419: Dummy: value 4: 8.00
6117420: EVENT: Temp+Baro#Temp=7.50
6117538: ACT  : TimerSet,4,300
6117544: Command: timerset
6117549: ACT  : LCD,2,1,Pn.7.5°  Pd.8.0°                                
6117621: ACT  : LCD,3,1,Ciśnienie 1022hPa            
6117738: EVENT: Temp+Baro#Baro=1022.00
6117919: EVENT: Temp+Baro#Temp-Piotr=20.00
6118101: EVENT: Temp+Baro#Temp-Pld=8.00
6121921: Dummy: value 1: 0.00
6121922: Dummy: value 2: 0.00
6121922: Dummy: value 3: 0.00
6121922: Dummy: value 4: 0.00
6121923: EVENT: Parametry#Parametr-1=0.00
6122118: EVENT: Parametry#Parametr-2=0.00
6122338: EVENT: Parametry#Parametr-3=0.00
6122557: EVENT: Parametry#Parametr-4=0.00
6125294: WD   : Uptime 102 ConnectFailures 0 FreeMem 17728 WiFiStatus 3

Re: Rule problem in mega-20191028

Posted: 28 Oct 2019, 16:40
by TD-er
Just as a test, can you replace the double space in your if statement with a single space?

Re: Rule problem in mega-20191028

Posted: 28 Oct 2019, 16:50
by mackowiakp
I try syntax like this

Code: Select all

 If [VAR#1]=1 and [VAR#7]=0 and %sysyear%>2000
without spaces around ">" character. Still wrong result

Than I try to add additional spaces around "=" character, but without ">" character. Like this:

Code: Select all

If [VAR#1] = 1 and [VAR#7] = 0
Works properly

Re: Rule problem in mega-20191028

Posted: 28 Oct 2019, 17:07
by mackowiakp
Sorry, maybe misunderstanding. What You mean " double space" ?

Re: Rule problem in mega-20191028

Posted: 28 Oct 2019, 18:29
by TD-er
mackowiakp wrote: 28 Oct 2019, 17:07 Sorry, maybe misunderstanding. What You mean " double space" ?
Change:

Code: Select all

 If [VAR#1]=1 and [VAR#7]=0  and  %sysyear% > 2000

into:

Code: Select all

 If [VAR#1]=1 and [VAR#7]=0 and %sysyear% > 2000

Re: Rule problem in mega-20191028

Posted: 28 Oct 2019, 18:38
by mackowiakp
The same, wrong result

Re: Rule problem in mega-20191028

Posted: 28 Oct 2019, 19:06
by TD-er
I have been looking at the code and to be honest I don't see how it should have been working in the past.
I don't see a while loop for multiple conditionMatchExtended calls on the same line.

I do believe you when you say you had it running on older versions, but I don't see how it must have been working then.

Re: Rule problem in mega-20191028

Posted: 28 Oct 2019, 19:17
by mackowiakp
Works correctly in ver mega-20190928. I use this sources ast the last working correctly. In mega-20191003 was a problem with SendToHTTP, but it works in mega-20190928.