[UPDATED] Rule Machine with Triggers

There have been a few requests for custom conditionals, this is doable, Bruce and I are looking into it.

When I set a rule with a trigger, a condition, and a rule the option to delay the rule by x minutes doesn’t work. As soon as I remove the trigger from the rule the delay woks fine. Am I using this feature correctly?

Once you have a trigger, only that trigger will cause the rule to be evaluated. Perhaps you could post a screenshot.

So you can set a trigger OR a Condition and a Rule but not a Trigger AND a Condition and a Rule?

You can have triggers and conditions.

The trigger is what starts the rule evaluation, but it then verifies that the specific conditions are met. If you have no conditions, the rule runs everytime the trigger happens. If you have a condition for only happening in Away mode, the trigger will happen and essentially check to see if the condition is met. If the condition is met, the rule continues, if not, it’s ignored.

No, you can do all variants. What they means is as follows:

Trigger but no conditions / rule: this is a simple trigger.
Conditions / rule but no trigger: this is a standard rule.
Trigger / conditions / rule: this is a “triggered rule” or a “conditioned trigger”, depending on how you think.

A trigger does its actions for any of its events.
A rule does its true actions after an evaluation changes rule truth from false to true.
A rule does its false actions after an evaluation changes rule truth from true to false.
A conditioned trigger does its true action after any trigger event where the rule is true.
A conditioned trigger does its false action after any trigger event where the rule is false.

The conditioned trigger does not concern itself with prior rule truth, unlike a standard rule.

1 Like

Bruce, I have a question about something I’m trying to do.

I have stair lights and foyer lights. Both are independent of each other. Both are fully automated via switches, contact sensors, time, and other rules.

Both sets of lights have rules that turn them off after a set amount of time.

Stairs off after three minutes on
Foyer off two minutes after for closes or five minutes if for remains open.

So either way, the lights turn off.

What I want to do is this… Over ride the rules.
Yes, simple, but I do not want to use a virtual switch to do it. I try to stay away from then to reduce the clutter.

But what I do have is physical switches that are hardly ever used.

I’d like to use one of those switches as an override switch for my rules, but only if it is physically pressed. That way the override is not operational if the switches load is active remotely.

Physical switch is only an option for a trigger, not for the override in the rule section.

Is this a platform limitation or was it the way you wanted to program it? (I hope that didn’t sound nasty)

I’m just curious I’d it can be done our if I should just use a different route.

Thanks.

There is an option for “Switch to Disable Rule when ON” - this is at the very bottom of the rule, very last thing above the Remove option.

You could just set that switch up there so when it’s ON, that rule gets an override.

I added on or off for the disable switch.

1 Like

I know this. My point is then the rule is overridden anytime that switch is on.

I want the override to work from a physical switch poss only.

That way the switch can still be used remotely and not override the rules.

Haven’t upgraded yet this week. That’s tonight’s plan once I’m off work!

I think I missed where he was saying a physical press of the switch though. That isn’t an option currently at this point. Read right through it without stopping.

There is Physical Switch for a trigger, so you can use that… @bamarayne

Yea. I missed that word physically when I read it initially.

I’d be interested in seeing this as an implementation option as I am about to add a pair of switches myself and will never have a need to use them physically unless it gives me more options for control.

Be aware that isPhysical is broken on the stock device types in the cloud, hub V1 device types. Older custom device types still have it on V1. I’m told that it works on V2.

It ‘works’ most of the time on V2 hubs… it occasionally loses its mind though/ :frowning: I use it, but don’t rely on it (sounds like a lot of things in ST)…

You can revert to a custom device type in the cloud, where it does work!

1 Like

Right, and I use that in the triggers.

What I’m asking about is in the role, way down at the bottom. The switch to disable rule option…
Physical switch is not an option there.
I’m wondering if that is a platform limitation? Is it possible to have a physical switch as an option?

I don’t think so, isPhysical is part of the device state event change message. The disable rule option just reads the device state, which is only on or off. The isPhysical flag is only contained within a device event.

1 Like

Like Mike says, it’s just the way I implemented it. And implementing it with isPhysical would make no sense. That’s why I say, that if you need to discriminate isPhysical for whatever reason, the only way Rule Machine can do that is with a trigger. So you could have a trigger that responds only to isPhysical, that turns on or off a virtual switch, that in turn is the disable switch. That’s as close as you can get.

ahhh, I understand now. Thank you, it makes sense.

Ok, so what I did instead is just make one virtual switch called Override Switch. The main reason I wanted was so I could just put it in certain rules for when I didn’t want the rule to run, which is very random.

But, I made the switch and now when I don’t want the rule to run I will just go into the rule and add the switch.
I was hoping to kind of automate the override rule… no worries… thanks guys.