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:
Front Door *changed*
Front Door Lock *changed*
IF Front Door open
OR Front Door Lock unlocked THEN
Command: setStatusLed(3,1,1) on all the fans
Command: setStatusLed(3,0,0) on all the fans
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.
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?
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.