Between two times rule or pause?

I have a switch for my pool pump. I want it to run on a cycle on for 30mins off for 90 mins. This runs 24hrs a day. However, I also use Griddy. If the price of electricity is high I want to pause this rule and then re-enter the rule once prices are low. I can't figure out how to either:

--Pause a rule and then reinstate it after a condition has been met.
--Create a "only between" two times rule and activate the rule when electricity is low.

I can figure this out in Rule 3.0. However, I can't figure it out in Rule 4.0. I've seen that RM3.0 is going away, I want to make sure my rules survive the long haul.

I am quite novice at programming the HE so any best practice advice for a situation like this is always appreciated. I'm really having a hard time wrapping my head around some of the methods to use RM4.0 which seemed well laid out in RM3.0.

Any Rule 3.0 rule you have will continue to work. Also see the post below for how to continue to use Rule 3.0 for new rules.

One rule (either 3.0 or 4.0) can pause another rule, and resume it. So you could have the price-of-electricity rule pause the one that repeats your 30/90 cycle, and resume it later. Or, if that's on a known schedule, it could all be done in a single rule.

For 4.0, assuming fixed schedule for lower cost electricity:

Trigger Events:  
   Certain time that electricity becomes lower cost
   Certain time that electricity becomes higher cost
Actions:  
   IF (Time-of-day is time that electricity becomes higher cost) THEN
      Stop Repeating
      Off: Pool Pump
   ELSE
      Repeat 02:00:00 Stop
         On: Pool Pump
         Delay Actions 00:30:00
         Off:  Pool Pump
      END-REP 
   END-IF

This rule has two triggers, for the beginning and ending of higher cost electricity. If it is fired by the higher cost time, it turns off the pump and stops the repetition. If it is fired by the lower cost time, it starts up the pool pump repetition. While it's repeating, if the time becomes the high cost time, that event will actually fire up another instance of the rule -- that's OK, because that instance is going to stop anything else from happening until the time again becomes the low cost time.

So in RM4.0 how do I make a "If between two times turn on" rule? This type of rule is quite handy, but I don't see it in RM4.0 (do see it in RM3.0). In your logic above it will simply stop the repeating rule when a specific time of day comes. How about a time frame?

You can have a condition in a conditional action of Time of Day, with between two times. You could replace the test in what I showed above with that. When, in Rule 3.0, you have a Condition of a Rule that is Between Two Times, it actually creates the same two triggers I showed above. Then it tests on each trigger event if the time is between those two times.

In Rule 4.0 all of this is now explicit, but works pretty much the same way. You can now have a Time of Day that is a single minute (shown above). That actually tests if the current time is within that minute, between :00 seconds and :59.999 seconds.

Trigger Events:  
   Certain time that electricity becomes lower cost
   Certain time that electricity becomes higher cost
Actions:  
   IF (Between high-cost-time and low-cost-time) THEN
      Stop Repeating
      Off: Pool Pump
   ELSE
      Repeat 02:00:00 Stop
         On: Pool Pump
         Delay Actions 00:30:00
         Off:  Pool Pump
      END-REP 
   END-IF

Either way, with either test, it's only going to look at the time at the beginning of the high cost period and the end of it.

I think you might be overestimating my abilities here. :slight_smile: I can follow the logic you laid out above, but how do I implement that? I only see drop down menus and buttons. I don't see the option for "Between two times" like I did in RM3.0.

It's name changed, now it's called Time of Day. It's a Condition. You can select it when you create a Conditional Action.

Is there a way to make the logic above work with a value instead of a time of day? I have the actual price updating in my HE as an "energy meter". I would like something like this in seudo code:

IF (realTimeCost > normalLimit && realTimeCost <= ecomodeLimit) THEN {
turn on EcoMode}

IF (realTimeCost > ecomodeLimit && realTimeCost <= hardEcomodeLimit) THEN {
turn on HardEcoMode}

I can't seem to figure out the right drop downs to select to get the AND logic to work with a value. I can see how to do it with a time of day.

When setting up the Conditional Action, it will first prompt you to select a condition. The first condition is realTimeCost > normalLimit, then it will prompt you to enter AND, OR, etc. Then it will prompt for the second condition.

I can't tell from your pseudo code what you mean by "realTimeCost" or by "normalLimit", etc. Are these variables you are setting?

That was the ticket I was missing. I didn't realize you had to CREATE a condition before you could use it. As soon as I created a condition, I could see the conditional option in the drop down. Upon rereading the documentation, I do see that sentence now. My father always told me RTFM and when you still can't figure it out RTFM again...

Thanks for the patience.