Help with Rule Machine 4.0 rule replacing 2.5 rule?

I'm trying to replace a working 2.5 rule with a new 4.0 rule and expand on it but I can't get it to do anything.
First let me explain the working 2.5 rule and what it does. When the door is unlocked, it sets a specific LED (the first number in the string) to on and blinking (the second and third numbers in the string) on all my fan switches in the house using that custom command. When the door is locked, it turns it off. Here is the 2.5 rule for my back door:

Now, I had the same rule set up to do this on my front door. I removed it and added a new 4.0 rule. The 4.0 rule should turn the LED on if the door is unlocked OR opened. Right now I just have it running the same custom commands (4,1,1) for testing. But it does nothing. Here is the 4.0 rule. I had the door unlocked as you can see that portion is true:

Can anyone offer any advise on what I am doing wrong here? I see the two conditions in the if statements toggle to true/false when i unlock and/or open the door. But no LEDs on my switches turn on as they do with the old 2.5 rules.

First, you probably want to change your triggers to "changed" rather than unlocked or open. If you only have unlocked and open, the actions for locked and closed will never run because they'll never be triggered. Then you'll need IF conditions to determine what's actually going on. You can combine the two trigger conditions in a single IF with an OR.

So, something like this might work:

Triggers:
Front Door *changed*
OR
Front Door Lock *changed*

Actions:
IF Front Door open
OR Front Door Lock unlocked THEN
  Command: setStatusLed(3,1,1) on all the fans
ELSE
  Command: setStatusLed(3,0,0) on all the fans
END-IF

Thanks for the help. I tried changing the triggers to "changed" but it still doesn't work. How you explain it makes sense though.

I can't do that because the triggered commands will be different. Right now I have them the same as I know that command worked on the 2.5 rule.

But for whatever reason, it seems custom commands do not work on the 4.0 rules? I can't figure out what else it could be.

I added some test bulb color changes to my rule. The bulb turns perfectly so it appears custom commands do not work at all in rule manager 4.0. It's a shame because this would have reduced a lot of my rules.

1 Like

Can you use custom actions instead?

@bravenel - can support to use custom commands be added to Rule 4.0?

Edit - thanks for considering the request!

Shouldn’t you be able to add a custom action using this?

Yes that works, thank you. Through testing the old rule, I found that it needed 3 integers instead of one string as I was doing it. Got it working now.

One last question though. When setting up rules using "changed" instead of open or close for example, the changed defaults to open. The only way I found to get the if statement to look for the other condition was to choose that first, "closed", and then once the rule is all complete, go back in and edit it to be "changed". This seems like a hack. Is there no way to specify which part of "changed" I need my condition to look for?

Not really sure what you are asking. Can you elaborate?

Custom Commands were retired in Rule 4.0. It offers Custom Actions instead.

What you are missing is that Rule 4.0 creates conditions for you from your triggers as a shortcut. You can edit those conditions -- there is an entire section at the bottom of Actions just to do that. It had to make a guess as to what to use for "changed". Just open that section "Manage or Create Conditions", and change the condition to what you need. No need to go mess with the trigger at all. Use Edit Condition.

1 Like

Should the last one of these in your rule read this setStatusLed(4,0,0)
instead of 4,1,1

Thank you so much. Not sure how I missed that. Then again, it was midnight when I was making this rule.

Thanks, you are correct. I only had it set to 4,1,1 for testing.

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