Well if you can pull the rate into a local variable, have the piston run comparisons between rate and set 3-4 price brackets for your high energy draw items via pistons.
If price is
(1-4) then set variable to A
(5-9) then set variable to B
(10-14) then set variable to C
(11-15) then set variable to D
When Variable changes, set global variable to same value
(I’m only suggesting keeping a local variable too Incase you want to use it further within the piston, if not just have all the ifs set global)
Take your HVAC piston for example
Obviously you can break it down by awake/sleep modes, outside temps, home vs away, triggers for coming or going, but for the sake of this I’m just being super simple.
If variable changes, then:
If variable = A, then set HVAC to 25 degrees
If variable = B, then set HVAC to 28 degrees
If variable = C, then turn off HVAC (unless outside temp is above 35 decrees)
If variable = D, turn off all non essential lights, HVAC off regardless of temp if nobody is home.