Just wanted to check an assumption I had regarding required expression. I have a rule that uses a periodic schedule trigger of "every two seconds", with a required expression that is quite restrictive such that the rule doesn't get actually triggered very often and for short periods of time. This is on a C7 running 126.96.36.199.
It turns out that the Periodic Schedule is in fact scheduled at all times, even though the required expression is false. I noticed only because app stats revealed the rule is consuming a surprising amount of CPU, all things relative, due to its frequency.
Think of it this way, HE is an event based system so something has to trigger the execution of your rule. As written the event is every 2 seconds which will then execute the rule to check your required expression condition. Without the 2 second trigger the rule wouldn’t know to check the virtual switch defined in your expression.
HE being event-driven, I expect the rule to listen only to the events the required expression depends upon (in this case, the switch). And once the required expression becomes true, then listen to the events the triggers depend on.
For example, if I add another trigger, e.g. for another switch state change, that trigger doesn't get a subscription in the app settings (gear icon)
Required expressions are only evaluated when the trigger defined happens. So in your original example it is evaluated every 2 seconds. Think of it as an overarching condition for the rule to continue processing the actions or stop.
In your example if you want the rule to only fire based on the state of the switch then that should be the only trigger, not the periodic schedule of 2 seconds. Now if you want the rule to continue processing for 2 seconds after the switch turns on, then in the actions setup a repeat and go from there.
I don't recall why that wasn't done, and is maybe the source of the word 'typically' in what you quoted. Irrespective of the scheduled job still being there, the trigger is not run when the Required Expression is false (the rule wakes up on the schedule, discovers Required Expression false, and exits. I'll take a look at it...