Performance executing Rules #22442
Replies: 2 comments 2 replies
-
When you use ESP32, I'd suggest you to stop using rules, to instead use the Berry language, where you have much more flexibility in controlling things, and without the contortions needed to do non-simple things in rules. Those contortions takes time too. When it comes to making suggestions about your "too long", without logs (with BTW. Your Sendxxxx rules are also broken, missing |
Beta Was this translation helpful? Give feedback.
-
Thank you for your quick reply. Logs were a good cue. I immediately found an inaccuracy in my time measurement. I determined the time between pressing and last light on incorrectly because I had plugged in the LED on the breadboard incorrectly. On the actual topic: Do you have any ways of shortening the time between trigger and first light on? There is half a second in between. All ideas welcome. Second question: I save a change in relay state into var1-var7. While turning on on light after each other, everytime the rule to save the state is triggered, taking some time. Is there any other chance of saving the state of a relay into a var in a different way then being triggered by the change?
|
Beta Was this translation helpful? Give feedback.
-
Hi,
TL,DR: Rule execution time by using events to shorten code is too long. I need help to reduce the runtime aka the time between initial trigger and final output.
I plan to use several ESP32 with Tasmota to control lights. All of them are configured the same way. Each MCU controls 8 lights by seven switches. Switches and Lights are uncoupled and I´d like to control the actions by rules. Each switch has 3 modes:
I need MQTT messages to sync all MCUs when it comes to turn on/turn off all lights that are connected to all MCUs. I need the logic run locally on each MCU to keep the system working even if middleware, wifi etc. is down.
Because the amount of characters per rule is limited, I used events to keep the lines of code low and avoid duplicating where possible. Now I´m facing a long runtime.
on Switch1#state=8 do backlog POWER1 1; POWER2 1; POWER3 1; POWER4 1; POWER5 1; POWER6 1; POWER7 1 endon
Using this line turns on Power1 immidiately, 2-7 are following one after each other. That´s not perfect but acceptable. Important: no delay between Double Press and first light on.
To reduce character I use events. Var1-Var7 just mirror the actual state of the corresponding relay (1 == On). Here in short to understand the logic easily.
This inreased the time between Double Press and first Light on a lot. Of course I reduced SetOption34 to 1, so the time between backlog commands is reduced to a minimum. After that long explanation I´d like to share the whole rule code including all 3 actions and the MQTT stuff. The execution time between Double Press and first light on is about 2.5 seconds. And that´s to long. Now my final question: What can I do to reduce that time and still manage to run all the logic locally. Thanks for advice in advance.
Beta Was this translation helpful? Give feedback.
All reactions