[Released] Rule 4.0

That's a database error. I've seen it also, just a time or two -- as if it was some transient glitch.

Need help with what is likely to be a simple 4.0 rule but I’m just not understanding most likely...

So I have closets in my bedrooms that are double sliding doors. I have a contact sensor on each door (left and right). I want the light in the closet to come on when either door opens, but only shut off when BOTH doors are closed. If both or one door doesn’t close after 15 minutes, shut off the light (so it’s not on all the time if someone forgets to shut a door).

The rule I’ve created turns on the lights, but when I close the doors the lights do not shut off. I’m also not understanding how to add the delay for turning the lights off after 15 minutes if the doors are open.

Any help would be appreciated. Thanks!

Insert an ENDIF before the second IF.

1 Like

Either what Mike said above Or

Change the second If to ELSE IF, then put ENDIF at the end should work.

1 Like

Built in variables for actions in Rules 4.0? I am converting a lot of WebCore pistons from SmartThings to Rule 4.0. And one thing I have been looking for is what variables are pre-defined. in SmartThings when I had a list of devices that would trigger an event the variable $device would be populated and I could use that to build strings for notification.

For example I have 5 leak sensors and I set the trigger to have all 5 devices. One of those statements would trigger the rule and then in actions how do I determine the device/rule that triggered it.

I went to your documentation page and couldn't find anything on variables and searching hear hasn't turned up anything but the new local variables. Is there a article or documentation page that I am missing?

Thanks.

There is:

%device% will give you the device name that triggered the rule
%value% will give you the value of the device that triggered the rule
%date% gives you the current date
%time% gives you the current time

%variable-name% will get you the value of global/local defined variable

@bravenel, it might be helpful to others to show the internal variables in the wiki. Especially if there are other variables

2 Likes

After the On command add:
Off: Master Bedroom Closet Light --> delay after 00:15:00
This will turn the lights off after 15 minutes with the door(s) open. The delay is added when you add the off action. On the action page there will be a toggle to delay action. Once set you can enter your delay.

1 Like

In the following rule, when the Kitchen goes off then I turn off a couple other things after a short delay. It works ok. But there is an occasion when the Kitchen doesn't go off for some reason. I want to have a longer delay if that doesn't happen and still turn off the last 2 items. What is the best way to add that in? In other words, if the Kitchen doesn't go off after about 10 minutes, turn off Flower and Bedtime.

Mine started working again after the prior update and rebate. It stopped working again after most recent update and reboot.

Chromecast Ultra with Google mini speakers.I am on lasted versions of Google Home and HE.

I have an issue where I have found multiple entries for setting scene's from "Groups and Scenes" in Rule Machine. I am converting a room from SmartThings/WebCORE/Action Tiles into Hubitat and have the following scenes defined:

When adding rules to rule machine 4.0 for actions I see multiple entries for each scene. Selecting just one of them checks all for that scene name:

And then on the rule page I see in the action the duplicate scenes after saving.

The rules fire just fine from the dashboard and the lights respond just fine but seeing 2 to 3 entries for a single scene concerns me. What I am trying to do is replicate my dashboard funtions for room presets and automation and have been testing using the "button" template on the dashboard:

Operating the dashboard and using the button functions everything seems to be working fine:

Ok, this is a UI bug. Will track it down. Do me a favor, when the next release comes out, please check this again.

Will do, I have 8 more rooms to configure the same way and doing things "slowly" :slight_smile:

Does anyone else use "Mode is changed" as a trigger or condition?

On my system (.128 firmware, so current), "Mode is changed" is always true, screwing up its use in logic.

Is it supposed to always be true, or is it a bug?

This is what the condition shows no matter when I look at the rule. Obviously the individual mode conditions change as expected, but the changed one is TRUE 100% of the time.
31%20AM

Mine is the same. But I've not noticed anything amiss. Have you?

Nothing other than I don't think it should always be TRUE... If always true, how do you do conditional actions that should only happen when the mode CHANGES?

I'll guess I'll do a workaround and shove the current mode into a local variable, and check current mode against last stored mode to detect mode changes.

And another question / issue... How do you make a condition that compares two local variables??? It doesn't seem to work.

Condition:

Variable values:
57%20AM

Notice the condition is "TRUE". It should be "FALSE".

@bravenel I guess I'm stuck at this point. I can't use Mode changed as a condition, and I can't manually compare CurrentMode and LastMode variables to detect mode change.

@bravenel Hey Bruce, I just about have my Hello and Goodbye routines doing what I want. One exception - I believe. So if someone arrives, I want a 20 second delay then the garage door opens. Then three minutes after arrival I want the door to close. Seems to work. However, if someone arrives and the rule triggers THEN someone ELSE arrives during the 3 minute delay I don't want the garage door to close based on the first arrival, but shift to the second arrival. I believe I need to set the 3 minute delay with a (cancel) but then also believe I need a Cancel Delayed Actions - somewhere in there as well. Can you confirm?

The * * changed* * for any device/mode is not really a condition. It just says that you want to trigger the rule independent of what the value is. You than have to make your conditions explicit, as in checking for the actual value that you want to test for, like Day, Night, etc. * * changed * * will always be true. Otherwise the rule wouldn’t have fired in the first place

Like this:

Just add a Cancel Delayed Actions as the first action of the rule and enable that cancel on the delayed actions. That should accomplish what you want

Funnily enough, I started testing local var comparisons as well as local to global. In both cases they fail... (in my simple tests)

Shown below is local var comparisons:
image

image