letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.22k stars 2.2k forks source link

Again a problem with the rules % systime% is not executed #1077

Closed micropet closed 6 years ago

micropet commented 6 years ago

With the current Mega Branch, the time query is again not executed. The source from yesterday worked fine. I had not changed my rules.

I just flashed the version from yesterday - it works.

uzi18 commented 6 years ago

Attach rules file here, but please download it from "Advenced/Flash" menu to have exact copy. If debug log is possible also attach.

micropet commented 6 years ago

rules1.txt

How do I make a debug log?

uzi18 commented 6 years ago

use serial converter or usb connection if it is NodeMcu

micropet commented 6 years ago

OK, is not so easy because the MH-Z19 or the PMS7003 hang on the serial port.

TD-er commented 6 years ago

You can also write the log to a syslog server.

micropet commented 6 years ago

It was so long ago when I used a syslog server.

You can not have changed so much in such a short time. :) Can you not see why it worked yesterday and today no more?

TD-er commented 6 years ago

The rules file, was it downloaded by downloading it from the filesystem, or cut and paste from the webinterface?

micropet commented 6 years ago

It is as desired from the file system.

TD-er commented 6 years ago

Just checking, since I did not see anything strange in the file. (judging on the special character view of Notepad++)

micropet commented 6 years ago

It can not be a "real" mistake in it. It worked for a few weeks.

micropet commented 6 years ago

And it also works with the version of yesterday.

TD-er commented 6 years ago

Wellll.... Last weekend there was an issue (which was fixed yesterday) that failed on lines ending with spaces. A trim() command (to remove spaces at the end of a line) was missing at the right place. Rules not edited for weeks were all at once not running anymore with that update

uzi18 commented 6 years ago

Do You mean all time comparisions doesn't work?

uzi18 commented 6 years ago

trimm can't do here anything wrong, maybe parseTemplate is messing?

micropet commented 6 years ago

Rules not edited for weeks were all at once not running anymore with that update

What is that supposed to mean? Either a rule is right or it has mistakes.

You can not see that today differently than in the past. I mean, if a rule was right in the past, then it has to be today.

TD-er commented 6 years ago

There have been some optimizations in the rules handling. It is now about 10x faster. But in that process something may have been overlooked.

Grovkillen commented 6 years ago

@micropet https://www.letscontrolit.com/forum/viewtopic.php?f=4&t=4032&p=22813&hilit=Tftpd64#p22813

For windows users... sys log server.

micropet commented 6 years ago

That's great. And so easy.

I have just flashed the latest mega software and written this syslog. Unfortunately, I am 50km away from home and can not see what the Neopixels are doing. But I think that they do not work. ESP-206 Syslog Not_OK.txt

micropet commented 6 years ago

I'm home again. The rules are not working.

uzi18 commented 6 years ago

Thanks for logs :+1: looks like this works:

on Motion#Pir>0 do      // nur tagsueber anzeigen
     if %systime% > 08:00:00 and %systime% < 20:00:00
          gpio,14,1     // Led2 pink ON
     endif
endon

on Motion#Pir=0 do
     gpio,14,0          // Led2 pink OFF
endon

on MH-Z19#PPM do
    if [MH-Z19#PPM]<=700
        event gruen
    endif
    if [MH-Z19#PPM]>=700 and [MH-Z19#PPM]<=1200
        event gelb
    endif
    if [MH-Z19#PPM]>=1200
        event rot
    endif
endon

but events gruen,gelb,rot are not working

uzi18 commented 6 years ago
<7>ESP-206 EspEasy: ACT  :         event gruen  192.168.0.206   14/03 11:12:10.417  
<7>ESP-206 EspEasy: EVENT:   event gruen    192.168.0.206   14/03 11:12:10.432  
<7>ESP-206 EspEasy: EVENT:   event gruen Processing time:34 milliSeconds    192.168.0.206   14/03 11:12:10.450  
micropet commented 6 years ago

Yes, that's how I see it. The events are no longer running, But probably because the systime compare is not working.

I flashed the version from the day before yesterday again. It works perfectly.

micropet commented 6 years ago

ESP-206 Syslog OK.txt Here is the version from 11.03.2018

uzi18 commented 6 years ago

@mvdbro @TD-er @Grovkillen

Debug log:

>event gruen
EVENT: gruen
RuleDebug Processing:rules1.txt
     flags CMI  parse output:
RuleDebug: 110: gruen do
RuleDebug: 111: if 17:26:39 > 08:00:00 and 17:26:39 < 20:00:00
RuleDebug: 111: neopixelall,0,250,0,0
ACT  :         NeoPixelAll,0,250,0,0   
RuleDebug: 111: else
ACT  :     else
RuleDebug: 111: neopixelall,0,8,0,0
ACT  :         NeoPixelAll,0,8,0,0     
RuleDebug: 111: endif
ACT  :     endif
RuleDebug: 000: endon
RuleDebug Processing:rules2.txt
     flags CMI  parse output:
RuleDebug Processing:rules3.txt 
     flags CMI  parse output:
RuleDebug Processing:rules4.txt 
     flags CMI  parse output:
EVENT: gruen Processing time:51 milliSeconds
ghost commented 6 years ago

Tested same here, and it's not good. The PR with the trim() fix was actually making things worse. Last commit should fix it.

ghost commented 6 years ago

Small test:

on demo do
  if [Dummy#Value1]=0
   event second
  endif
endon

on second do
  TEST
endon

RX: 19:30:13:893 RuleDebug Processing:rules1.txt RX: 19:30:13:902 flags CMI parse output: RX: 19:30:13:907 RuleDebug: 110: demo do RX: 19:30:13:910 RuleDebug: 111: if 0.00=0 RX: 19:30:13:913 RuleDebug: 111: event second RX: 19:30:13:915 ACT : event second RX: 19:30:13:922 EVENT: second RX: 19:30:13:926 RuleDebug Processing:rules1.txt RX: 19:30:13:930 flags CMI parse output: RX: 19:30:13:936 RuleDebug: 100: demo do RX: 19:30:13:938 RuleDebug: 101: if [dummy#value1]=0 RX: 19:30:13:940 RuleDebug: 101: event second RX: 19:30:13:940 RuleDebug: 101: endif RX: 19:30:13:942 RuleDebug: 000: endon RX: 19:30:13:943 RuleDebug: 110: second do RX: 19:30:13:946 RuleDebug: 111: test RX: 19:30:13:953 ACT : TEST RX: 19:30:13:954 RuleDebug: 000: endon RX: 19:30:13:959 EVENT: second Processing time:21 milliSeconds RX: 19:30:13:962 RuleDebug: 111: endif RX: 19:30:13:969 RuleDebug: 000: endon

micropet commented 6 years ago

Now it works again.!!

You should put the user settings from the ESPEasy.ino into a userconfig.h or something.

So I have to write each time i flash the personal settings into the ESPEasy.ino File.

TD-er commented 6 years ago

That's something we could do along with the issue of splitting of global vars/defines.

micropet commented 6 years ago

Thats fine.

TD-er commented 6 years ago

Are you building in Windows or Linux? For Linux you could make a small script to patch the file using sed commands.

micropet commented 6 years ago

I use Windows.

micropet commented 6 years ago

I thing the most Users use Windows.

I have here 3 Windows Server 2016. Under HyperV some machines run under Linux. But all without a graphical interface. I use them for opemHAB and some for Python scripts. Others are running W10, which I use via RDP. The Linux computer I use with Putty.

uzi18 commented 6 years ago

I see now lineOrg is used later as action, so trimm before copy is real fix :) thx @mvdbro

uzi18 commented 6 years ago

@micropet @TD-er user overrides are better, as usually we change only some settings like: rulestimers_max, task_max etc.

micropet commented 6 years ago

Then Gijs has to act. :)