Rule Machine Rule Question

I have a temperature sensor and an outlet that turns on a heat lamp. I want to turn on the outlet if the temp is below 37 degrees and off if above 39 degrees. I figured how to do this with 2 rules, one for on and one for off. Is there a way to do this with just one rule?

I think this will do it:

complex rule
if (outlet is on and temperature<39) or (Outlet is off and temperature<37)

true outlet on
false outlet off

Can't seem to figure out how to make that rule.

With RM v3.0 so much more is possible. @napalmcsr has indicated the v3.0 way.

There's a new Conditional Actions option.. and then simple or if-then

48%20AM

When you're done, you can add an End-If

Ok, I found that. I created a conditional Actions as:

If temp< 37 then turn on
else if temp>39 turn off
endif

But it wants me to put in a condition on the rule. What is the condition?

I think this will work:

Condition: (temp < 37) || (temp > 39)

Action for true:

If temp< 37 then turn on
else if temp>39 turn off
endif

Action for false: None

The condition will cause the Action for true to run whenever the temperature drops below 37 or rises above 39.

Thanks @smr06. But I still confusing : " If temp<37 " or " If temp>39 " is a Condition , why need " Condition: (temp <37) || (temp > 39) " a condiction again ?

The way I look at it is:

The first set of conditions is used to check for rule truth. The rule only runs if the rule truth changes.

Once the rule runs, the conditional action now breaks out what needs to happen for < 37 vs. > 39.

1 Like

I create a simple rule :


but 2 Delay( 15s ) not working , this light not dim and turn off after motion active : 2 minutes ?

If I make 2 rule : one for motion active, one for motion inactive ( not use IF- THEN ) , 2 delay is working and the light turn off after motion active : 40 seconds !

Any help , thanks .

I have to admit I have not yet updated to RM 3.0 (waiting for the inevitable hot fixes to 2.0.9 before updating :slight_smile: .)

That said, your "Actions for True" will only run when motion is active. When motion becomes inactive, RM will run "Actions for False". So your ELSE clause will never run.

You could try adding "motion inactive' to your conditions, and define the rule as "motion active" OR "motion inactive". This may not work, as there will no longer be any change to rule truth when motion changes from active to inactive.

Or you could re-write the rule without conditional actions. Instead, change as follows:
Actions for True: Everything in the THEN clause
Actions for False: Everything in the ELSE clause

2 Likes

You don't need a conditional action. Just get rid of the IF/ELSE and just put:

  1. "Dim: L3. Closet light: 100" in your "Actions for True" section
  2. And all of the actions you currently have in the ELSE section in the "Actions for False" section

EDIT: Dang it, @smr06 ninja'ed me.

1 Like

When you create a rule do you need to hit 'Run Rule' to get it enabled?

No. Run Rule does evaluate the rule and do whatever the rule would do based on its truth.

You do need to hit Done in a new Rule to create its event subscriptions and schedules, and to hit Done should you change any of its Conditions that affect subscriptions or schedules.

The Run Rule button is just for convenience in testing your rule.

1 Like

Thanks @smr06 , @JasonJoel. I already have 2 rule without conditional actions, and its running good. I want to learn how to use IF/THEN on the new RM 3.0 , but it's more difficult than I thought , my first " IF/THEN" not working!!!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.