RULES parameter in different chip

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
giorgino
Normal user
Posts: 122
Joined: 24 Oct 2022, 21:06

RULES parameter in different chip

#1 Post by giorgino » 04 Nov 2024, 00:25

sorry, I'm a little confused... Is there any different dimension changing ESP32 model? (I'm starting with the ESP32-s3 16M)
I mean if using a 16M there is bigger memory space for rules or not... is there the limitation of 2000bytes for every RULE ?

I don't remember why have you built the rule1,rule2,rule3,rule4 instead of an unique space....... :roll:

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

Re: RULES parameter in different chip

#2 Post by TD-er » 04 Nov 2024, 01:01

The rules files are no longer sent to the webserver running on the ESP using HTTP POST.
Rules will now be saved by using some JavaScript which actually calls the upload URL.

So the rules can be (much) larger nowadays, however on ESP32 the entire rules file will be cached in memory (leaving out comments) and thus you still might not want to have those files really large.

giorgino
Normal user
Posts: 122
Joined: 24 Oct 2022, 21:06

Re: RULES parameter in different chip

#3 Post by giorgino » 04 Nov 2024, 08:45

so you mean that I can use "rule1" only, with all the code there?
totally It will be 3500/4000 bytes long

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

Re: RULES parameter in different chip

#4 Post by TD-er » 04 Nov 2024, 08:59

Yep.
What I usually do with 'batches' of ESPEasy nodes is that I reserve one rules file for node specific stuff, like setting calibrations, renaming a node based on its MAC-address, etc.
This way I can easily maintain configurations.

For example in some rules file I have this:

Code: Select all

On System#Boot Do
  Event,LoadCalibration
Endon
And in the 4th rules file I have a section like this:

Code: Select all

On LoadCalibration Do
  // Test units @Gijs
  if %cpu_id% = 0x1280E0
    config,task,bat,SetCalib,TwoPoint,392,13.9846,571,19.9924
    config,task,batBackup,SetCalib,TwoPoint,1785,10.000
    unit,2
  // Test units @Gijs
  elseif %cpu_id% = 0x0C17E4
    config,task,bat,SetCalib,TwoPoint,370.8615,13,520.857,18
    config,task,batBackup,SetCalib,TwoPoint,1785,10.000
    unit,3

  endif
  Save
EndOn
Tip for tweaking rules processing speed:
- Place the least frequently used block at the end (look at the rules files as being a single concatenated file)

Still make sure the more specific blocks are before less specific.
For example keep this order:
- on foo#bar=1 do...endon
- on foo#bar do...endon
- on foo do...endon

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests