RM 4.0 Rule Questions and Optimizations

Perfect

when I try to do that this happens:

actually - ignore that - I got it working!

I bet you discovered that it is range checking the value. So if the variable contains an out-of-range value when you set it up, you get ** bad value **

exactly

No, still haven't figured it out. I am having an issue with canceling a delayed action too, but I think it might have a similar solution. Look up canceling here, and I think a similar thing for repeats will work.

Having trouble with a rule. I'd like turn a lamp off at 10:05 if I'm away, otherwise turn it off after sunrise. We leave it on at night for one of the kiddos. It seems to always turn off at 10:05.

app:1332019-08-19 03:13:55.094 pm infobasementLampOff: Resumed

app:1332019-08-19 03:13:52.651 pm infobasementLampOff: Paused

app:1332019-08-19 06:50:00.960 am infoAction: IF (( Time is 10:05 PM CDT(F) AND Mode is Away(F) ) OR Time is Sunrise+30 minutes(T) [TRUE]) THEN

app:1332019-08-19 06:50:00.647 am infoAction: Off: basementLamp

app:1332019-08-19 06:50:00.578 am infobasementLampOff Triggered

app:1332019-08-19 06:50:00.542 am infobasementLampOff: Triggered at Certain Time

app:1332019-08-18 10:05:00.631 pm infoAction: IF (( Time is 10:05 PM CDT(T) AND Mode is Away(F) ) OR Time is Sunrise+30 minutes(F) [FALSE]) THEN (skipping)

app:1332019-08-18 10:05:00.409 pm infoAction: Off: basementLamp

app:1332019-08-18 10:05:00.352 pm infobasementLampOff Triggered

app:1332019-08-18 10:05:00.322 pm infobasementLampOff: Triggered at Certain Time

That's correct or at sunrise +30mins. Because that's what you have told to do. You condition does nothing because it's after the off.

1 Like

You have put the action to turn the light off at the begining.
At 10:05 it will turn the light off.
Thae action to turn the light off should be after the conditions.

I'm still trying to learn RM 4.0. Just need a bit of reassurance or help if incorrect. I'm converting a RM 3.0 rule over that used "cancel on truth change", my objective with the rule 4.0 is to be identical, I normally would leave this alone but the change with the "cancel" part of 4.0 I've yet to figure out completely so this is educational.

What I'm wanting to do with this rule is if the outside temp is below 90 set thermostat at 73, between 90.1 - 98 set thermostat at 74 over 98 set thermostat at 75. I need a 15 minute delay between transitions so that in case the temp is on the threshold it's not repeatedly changing back and forth. Therefore I wanted say if the current set point was 73 and the outside temp hit 91 wait 15 minutes before changing to 74, but if before that 15 minutes the temp hit either 89 or 100 it would cancel that command for 74 and start a new timer with cancel if before 15 minutes it changes.

Here is my current rule, is this set correctly?

I'll leave the thermostat part to others, but I can help with some Rule 4 logic. You need to put a "cancel delayed actions" after each IF/ELSE-IF statement. This needs to be the first thing you add. At present, the (cancel) trigger means that it is cancellable if the temperature changes within 15 minutes, but there is nothing to actually cancel them. This is what "cancel delayed actions" does. Repeat, it must be the first line after the IF/ELSE-IF, or you will end up cancelling you newly created 15 minute wait a few milliseconds after creating it.

I'm not really sure what those arrow are doing before Cool, fan and delayed. I've never seen them before (apart from in front of delayed). Are they one command, or multiple separate commands? If they are separate commands, then you need to select the "cancel" trigger to make them cancellable, for when your newly added "cancel delayed actions" does it's thing.

Just to make sure I'm understanding correctly, adding the "cancel delay actions" will only cancel the delay if the "changed" temperature is outside of the IF/ELSE specifications..... For example If the temp is set at 73 because the temperature is 88, and the temp rises to 91 the "cancel delayed actions" will only cancel if the changed temperature is now 88 or 99 (which is outside of the 90.1-98 setting)......It won't cancel if the temp changes from 91 to 93 which is still within those parameters, correct?

It's how the action populates when setting the action for my thermostat from here.

Hey @waynespringer79,

You still have to cancel the delayed actions.

The “cancel” flag says that this delayed action can be canceled, however, to cancel it you need an action that is called “Cancel Delayed Actions”. Given your flow, i would add this right in front of the “set Thermostat” action in each of the IF parts.

Does that make sense? I am on my phone but can mock up an example in a little bit if you need more

Incorrect, it will cancel anything that is cancellable, even if it's the scenario you describe above.

I'm unsure about thermotats, since we dont generally have them here in Australia. Just cool, all the time.

Here is a different way of doing what I think you want to do without cancelling any actions:

Trigger: Temperature change
Actions:

IF (Private Boolean is False) Exit Rule
If (temp <= 90) Then
  Set Thermostat Mode Cool, 73, auto
  Set Private Boolean False
  Set Private Boolean True -> delay 15 minutes
ELSE-IF (temp > 90 and temp < 98)
  Set Thermostat Mode Cool, 74, auto
  Set Private Boolean False
  Set Private Boolean True -> delay 15 minutes
ELSE-IF (temp > 98)
  Set Thermostat Mode Cool, 75, auto
  Set Private Boolean False
  Set Private Boolean True -> delay 15 minutes
END IF

What this does it ensures that the thermostat command is only executed once within 15 minutes but it is definitely executed. With the cancel/delay option there is theory a chance that command always gets canceled if you bounce back and forth between values.

This would work, the only thing I see I would rather have happen is the command ONLY execute if the temperature changes to one of the two other "Elses" conditions With the way I'm understanding this as written is it will basically create a 15 minute timer and send a command to set the thermostat every 15 minutes even if the command is the same set command as is already running.

No it doesn't. It will only reset the private boolean after 15 minutes but won't send the set thermostat command again.

EDIT: Scrap that, I see what you mean. Hold on

Ok,

you IF part becomes a bit more complicated:

Trigger: Temperature change
Actions:

IF (Private Boolean is False) Exit Rule
If (Temperature of Temp(77.90) is > 90.0 AND
  NOT Thermostat mode of Thermostat is cool 
  NOT Cool setpoint of Thermostat(73) is = 73.0) Then
  Set Thermostat Mode Cool, 73, auto
  Set Private Boolean False
  Set Private Boolean True -> delay 15 minutes
ELSE-IF (temp > 90 and temp < 98  AND
  NOT Thermostat mode of Thermostat is cool 
  NOT Cool setpoint of Thermostat(73) is = 74.0)
  Set Thermostat Mode Cool, 74, auto
  Set Private Boolean False
  Set Private Boolean True -> delay 15 minutes
ELSE-IF (temp > 98  AND
  NOT Thermostat mode of Thermostat is cool 
  NOT Cool setpoint of Thermostat(73) is = 75.0)
  Set Thermostat Mode Cool, 75, auto
  Set Private Boolean False
  Set Private Boolean True -> delay 15 minutes
END IF

Basically what this does is to check if the Thermostat is already cooling and the cooling setpoint is not the same as it should be.
This will ensure that the command is only set if the values are different and not every time the temperature changes

1 Like

Yep, that looks good in my book. You also solved one of my other curiosities in finding an actual use case for "NOT" in a rule. I'll give that a shot, thanks for your help.

Whew, got it down that took a bit.