Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended rules (up to 8 rules-sets) #19438

Closed
wants to merge 1 commit into from

Conversation

barbudor
Copy link
Contributor

@barbudor barbudor commented Sep 2, 2023

Description:

Related issue (if applicable): fixes #15832

This PR add the capability to extended rules up to 8 rules set.

  • The 5 new additional rules requires USE_UFILESYS in order to save the rules to a file (and restore at boot). Without filesystem, the extended rules work but would not be saved.
  • All Rules features are supported including compression.
  • All extended rules are also 512 bytes as the original ones.

NOTE : Because some constants have to be updated before user_config_override.h is included, this feature cannot be simply enabled from user_config_override.h. It requires a dedicated environment in platformio_tasmota_cenv.ini

Exemple with ESP8266, 4MB flash with 2MB filesystem (USE_UFILESYS is implicit when using an ESP8266 board > 1M):

[env:tasmota-rulesext4m]
build_flags             = ${env.build_flags} -DUSE_RULES_EXTENDED
board                   = esp8266_4M2M

Exemple with ESP32, 4MB flash with 320KB filesystem (USE_UFILESYS is implicit when using ESP32):

[env:tasmota32-rulesext4m]
extends                 = env:tasmota32_base
build_flags             = ${env:tasmota32_base.build_flags} -DUSE_RULES_EXTENDED

Flash usage: +460 bytes, not counting the mandatory filesystem
Ram usage: + 2648 bytes

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • The code change is tested and works with Tasmota core ESP32 V.2.0.11
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@barbudor
Copy link
Contributor Author

barbudor commented Sep 2, 2023

20:14:37.609 CMD: rule0
20:14:37.617 MQT: stat/nodemcu/RULE = {"Rule1":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":34,"Free":477,"Rules":"on tele-time do var1 %value% endon"}}
20:14:37.638 MQT: stat/nodemcu/RULE = {"Rule2":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":36,"Free":475,"Rules":"on tele-uptime do var2 %value% endon"}}
20:14:37.652 MQT: stat/nodemcu/RULE = {"Rule3":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":39,"Free":472,"Rules":"on tele-uptimesec do var3 %value% endon"}}
20:14:37.667 MQT: stat/nodemcu/RULE = {"Rule4":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":34,"Free":477,"Rules":"on tele-heap do var4 %value% endon"}}
20:14:37.684 MQT: stat/nodemcu/RULE = {"Rule5":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":39,"Free":472,"Rules":"on tele-sleepmode do var5 %value% endon"}}
20:14:37.701 MQT: stat/nodemcu/RULE = {"Rule6":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":35,"Free":476,"Rules":"on tele-sleep do var6 %value% endon"}}
20:14:37.717 MQT: stat/nodemcu/RULE = {"Rule7":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":37,"Free":474,"Rules":"on tele-loadavg do var7 %value% endon"}}
20:14:37.732 MQT: stat/nodemcu/RULE = {"Rule8":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":39,"Free":472,"Rules":"on tele-wifi#rssi do var8 %value% endon"}}
20:14:47.404 MQT: tele/nodemcu/STATE = {"Time":"2023-09-02T20:14:47+02:00","Uptime":"0T00:00:21","UptimeSec":21,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"BNETWLAN","BSSId":"88:C3:97:F2:25:EC","Channel":1,"Mode":"11n","RSSI":100,"Signal":-42,"LinkCount":1,"Downtime":"0T00:00:06"}}
20:14:47.440 RUL: TELE-TIME performs "var1 2023-09-02T20:14:47+02:00"
20:14:47.451 MQT: stat/nodemcu/VAR = {"Var1":"2023-09-02T20:14:47+02:00"}
20:14:47.466 RUL: TELE-UPTIME performs "var2 0T00:00:21"
20:14:47.473 MQT: stat/nodemcu/VAR = {"Var2":"0T00:00:21"}
20:14:47.485 RUL: TELE-UPTIMESEC performs "var3 21"
20:14:47.495 MQT: stat/nodemcu/VAR = {"Var3":"21"}
20:14:47.506 RUL: TELE-HEAP performs "var4 24"
20:14:47.515 MQT: stat/nodemcu/VAR = {"Var4":"24"}
20:14:47.529 RUL: TELE-SLEEPMODE performs "var5 DYNAMIC"
20:14:47.537 MQT: stat/nodemcu/VAR = {"Var5":"DYNAMIC"}
20:14:47.551 RUL: TELE-SLEEP performs "var6 50"
20:14:47.560 MQT: stat/nodemcu/VAR = {"Var6":"50"}
20:14:47.572 RUL: TELE-LOADAVG performs "var7 19"
20:14:47.579 MQT: stat/nodemcu/VAR = {"Var7":"19"}
20:14:47.591 RUL: TELE-WIFI#RSSI performs "var8 100"
20:14:47.602 MQT: stat/nodemcu/VAR = {"Var8":"100"}

@arendst
Copy link
Owner

arendst commented Sep 3, 2023

Nice solution. Let Alex do some tests especially on 1M devices ;-)

@Jason2866
Copy link
Collaborator

@AleXSR700 We are waiting for your feedback :-)

@Jason2866 Jason2866 added the awaiting feedback Action - Waiting for response or more information label Sep 22, 2023
@AleXSR700
Copy link
Contributor

Sorry everyone. I thought it had been tested internally already, so I did not run a "proper" test protocol.

I will do so once I get back from my vacation. :)

@github-actions
Copy link

This PR has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Action - Issue left behind - Used by the BOT to call for attention label Oct 30, 2023
@arendst
Copy link
Owner

arendst commented Oct 30, 2023

Bump

@github-actions github-actions bot removed the stale Action - Issue left behind - Used by the BOT to call for attention label Oct 30, 2023
Copy link

This PR has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Action - Issue left behind - Used by the BOT to call for attention label Nov 24, 2023
@AleXSR700
Copy link
Contributor

Not stale, just under review

@github-actions github-actions bot removed the stale Action - Issue left behind - Used by the BOT to call for attention label Nov 25, 2023
Copy link

This PR has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Action - Issue left behind - Used by the BOT to call for attention label Dec 20, 2023
Copy link

This PR was automatically closed because of being stale.

@github-actions github-actions bot closed this Dec 25, 2023
@aldweb
Copy link

aldweb commented Mar 22, 2024

No more bump?
It would be really great to have extended rules storage for ESP8266.

@barbudor
Copy link
Contributor Author

The branch is still available if you want to test and report, we could reopen

@aldweb
Copy link

aldweb commented Mar 22, 2024

Thank you barbudor for your quick answer.
I am not sure I would be able to proceed, I do not have enough technical knowledge yet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Action - Waiting for response or more information stale Action - Issue left behind - Used by the BOT to call for attention
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants