I have a rule that uses a 'wait for expression' that seemed to silently fail today. The rule usually works, but a few minutes ago the rule logged the 'wait for expresson' line and then nothing after that.
The rule is used to adjust the power reserve of my home batteries when there is high power draw. (I don't want to draw down the batteries when charging my cars or using high draw appliances if the grid is available).
The two criteria are that either my clothes dryer is reporting that it is drying OR the house load is > 5 kW. Once it fires, the reset requires both the dryer to NOT be drying and the house load to be < 5 kW for a duration of 1 minute.
To prevent multiple activation of the rule, I use a hub variable ("powerwall_load_rule") that I set to false when the rule runs the first time and only set back to true when the rule has completed its 'wait for expression' process. Since the rule will be triggered everytime the house load changes, the first action is to exit the rule if the variable is false, since that means there is already an instance of the rule in progress.
I use required expressions to not run the rule when the reserve level is already 100% nor when the battery is already below its reserve level, since in either of those cases, I would already be on grid power.
Here is the rule:
Here are the logs from the failure (newest at the top). I have it set to log actions but not triggers:
app:943 2023-07-04 13:24:34.700 info Action: Wait for Expression: Dryer currentState(power off) ≠ drying(T) AND
Power level of Powerwall - Home Power(5863) < 5000.0(F) [FALSE] --> duration: 0:01:00 (waiting for Expression to be true)
app:943 2023-07-04 13:24:34.537 info Action: Dim: Powerwall: 100
app:943 2023-07-04 13:24:34.525 info Action: Set powerwall_load_rule to false
app:943 2023-07-04 13:24:34.512 info Action: ELSE (do actions)
app:943 2023-07-04 13:24:34.509 info Action: Exit Rule (skipped)
app:943 2023-07-04 13:24:34.506 info Action: IF (Variable powerwall_load_rule(true) = false(F) [FALSE]) THEN (skipping)
The previous time it ran it looked like this:
app:943 2023-07-04 08:46:34.616 info Action: END-IF
app:943 2023-07-04 08:46:34.605 info Action: Set powerwall_load_rule to true
app:943 2023-07-04 08:46:34.542 info Action: Dim: Powerwall: powerwall_reserve_level(30)
app:943 2023-07-04 08:46:34.487 info Wait over: duration
app:943 2023-07-04 08:46:34.441 info Expression still true: power is 1661, still waiting for 0:00:00
app:943 2023-07-04 08:45:34.487 info Expression now true: Powerwall - Home Power power is 1675, waiting for duration 0:01:00
app:943 2023-07-04 08:44:34.411 info Expression now false: power is 8941, waiting for Expression to be true
app:943 2023-07-04 08:43:40.825 info Expression now false: power is 9120, waiting for Expression to be true
app:943 2023-07-04 08:43:34.599 info Action: Wait for Expression: Dryer currentState(power off) ≠ drying(T) AND
Power level of Powerwall - Home Power(9099) < 5000.0(F) [FALSE] --> duration: 0:01:00 (waiting for Expression to be true)
app:943 2023-07-04 08:43:34.414 info Action: Dim: Powerwall: 100
app:943 2023-07-04 08:43:34.402 info Action: Set powerwall_load_rule to false
app:943 2023-07-04 08:43:34.389 info Action: ELSE (do actions)
app:943 2023-07-04 08:43:34.387 info Action: Exit Rule (skipped)
app:943 2023-07-04 08:43:34.384 info Action: IF (Variable powerwall_load_rule(true) = false(F) [FALSE]) THEN (skipping)
That is the expected behavior. I didn't modify the rule between the time it worked and the time it failed, so I think this may be a bug in Rule Machine.
Here is something else odd that I noticed. The rule currently shows this:
Looking through the logs, the value 9099 was from the activation at 08:43 today. The latest activation shows the home power was 5863 at 13:24. Why does the Local Variables section still show the 9099 value?