Rule problem in mega-20191028

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mackowiakp
Normal user
Posts: 183
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Rule problem in mega-20191028

#1 Post by mackowiakp » 28 Oct 2019, 14:05

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.

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

Re: Rule problem in mega-20191028

#2 Post by grovkillen » 28 Oct 2019, 15:24

What does the log say?
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:

mackowiakp
Normal user
Posts: 183
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Rule problem in mega-20191028

#3 Post by mackowiakp » 28 Oct 2019, 16:13

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

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

Re: Rule problem in mega-20191028

#4 Post by TD-er » 28 Oct 2019, 16:40

Just as a test, can you replace the double space in your if statement with a single space?

mackowiakp
Normal user
Posts: 183
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Rule problem in mega-20191028

#5 Post by mackowiakp » 28 Oct 2019, 16:50

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

mackowiakp
Normal user
Posts: 183
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Rule problem in mega-20191028

#6 Post by mackowiakp » 28 Oct 2019, 17:07

Sorry, maybe misunderstanding. What You mean " double space" ?

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

Re: Rule problem in mega-20191028

#7 Post by TD-er » 28 Oct 2019, 18:29

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

mackowiakp
Normal user
Posts: 183
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Rule problem in mega-20191028

#8 Post by mackowiakp » 28 Oct 2019, 18:38

The same, wrong result

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

Re: Rule problem in mega-20191028

#9 Post by TD-er » 28 Oct 2019, 19:06

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.

mackowiakp
Normal user
Posts: 183
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Rule problem in mega-20191028

#10 Post by mackowiakp » 28 Oct 2019, 19:17

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.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 15 guests