I'm combining global expressions and a rule to handle my pool heater. I monitor my electric meter and get real time values every 8-10 seconds.
I'm allowing it to run a little bit even on bought electricity and have an expression triggered by MQTT to manually override the rule with another rule.
Global Expressions:
Rule:
I use Sustained for and Delay reset to prevent flapping. I also handle manual and automatic triggers different. Automatic with sustained/delayed and manual no delays. The Set reaction starts the heater, sets the poolHeatTrigger to "auto" and sends a notification (if automatic start), the Reset reaction turns it off (with notification if started by auto logic).
That's my approach, hope it gives you some new ideas.