Automation behavior - OR operator ("when any condition below is met")

Hi all,

I’m going to try to ask a question about something that has been puzzling me in the way Automations operate. I’ve not done a good job of describing the issue in a couple of posts over the last few days.

I’ll speak to a simple example - let’s say I’m trying to turn on a light if either of two contact sensors is opened.

I create the following automation:

Notice I selected what I would think is the OR operator: “when any condition below is met”.

The Automation works fine when I start with both doors closed and open either of the two. The light turns on.

The strange behavior I am experiencing is that if I start with both doors OPEN, the light turns on when I CLOSE one of them. This is not what I’d expect as I haven’t opened either of the doors.

Is this the way the Automations work for others as well when using the OR operator?

Is there any way to get it to work the way I’m expecting, other than by creating two Automations, one for each door? I’d rather not do this as the Automations I’m really trying to create have 7-8 actions (and some have 7-8 conditions as well) - this is just a simple example to demonstrate what I’m observing.

In Webcore, this would work fine if I had each of the devices in the IF and set to “changes to”. Trying to avoid Webcore due to the inevitable, eventual shutdown.

Thanks!

I don’t have any idea what smartthings thinks it’s supposed to do, but what you are describing makes perfect sense to me because this is an event driven platform.

So both sensors are open.

One sensor closes. This causes a sensor event report to be sent to the hub. At that point, the IF would be evaluated and would be found to be true, because the other sensor is still open.

I would think you could get around this by having a precondition of both sensors being closed, so that the IF only gets evaluated when both sensors were closed and then either one of them opens. But I don’t really know if smartthings can do that easily, nor do I know if that meets your particular use case.

But without a precondition, I would expect the IF to be reevaluated whenever I got a sensor report. So you would see the result you are seeing.

I thought this was the fix, but Smartthings won’t allow a device to be both a condition and a precondition (same as it won’t let a device be re-used twice in a condition).

I did it with a virtual proxy for each sensor, but that requires even more automations to make the whole thing work. I don’t know if there’s a better way to do this with the rules API, that’s not voice friendly so I haven’t done anything with it.

The Automation conditions are implementing something more like ‘is open’ in webCoRE, yet still not quite the same.

WebCoRE is more complicated than it seems. For example: a contact can be open and yet ‘contact is open’ might evaluate to false; and a contact can change from closed to open and yet ‘changes to open’ might evaluate to false.

You don’t really get that sort of thing in Automations or the underlying Rules.

Sometimes, or indeed often, using more than one Automation is the best solution.

2 Likes

It sort of makes sense but is so different than what I’ve come to expect with Webcore. By having all the different qualifiers like “is”, “changes to”, “changes away from”, etc., I’ve gotten spoiled with some very flexible automation options. The built in Automations are incredibly weak.

I would have thought the built-in Automations would have operated like a “changes to” condition and wouldn’t trigger unless one of the two changes to open state.

1 Like

I almost always use “changes to” in Webcore and all automations have triggered exactly as expected.

Unfortunately multiple automations just won’t cut it. I was trying to create a locally executed version of STHM using just the Automations.

I ventured in to this partly because I wanted local execution, but also in part because I wanted to avoid the need to “dismiss” active STHM alarm conditions through the Smartthings app. The iOS app has been miserable for me since June (slow, spinning circles, network errors, devices don’t respond, incorrect device status), and there appears to be no end in sight despite multiple cases with Support (and promise of a beta to test over a month and a half ago!). This would have given me the chance to move to an alternate app for control.

I was so close, just not enough Automation functionality to make it work.

1 Like

The Rules API has a changes condition that might help. I’ve not used it yet.

2 Likes

Not everyone knows what to expect.

For example:

if
  time is between sunset and sunrise
  and
  Door contact changes to open
then
  ...
end if

Changes to open will only return true if the door was closed before sunrise or after sunset.

That sort of thing.

1 Like

Yea, I’d use the “restriction” function in Webcore as a precondition to handle that.

In this case you just flip the conditions around to make sure ‘changes to’ is always evaluated when the door opens or closes.

It seems ridiculous that we need the app for anything to dismiss alerts. Maybe there is another way but no one wants to tell us because they think they’ll be ripped to shreds.

2 Likes

OT, but where do I find automations like that? In the smartthings app or somewhere else?