Changing AND to OR

I'm sure this has been answered but searching for words like "OR" and "AND" results in every topic.

I am trying to make a basic set away rule. Using Life360 as a presence sensor I can add me and my wife, but that makes the rule as "Any". If I add me and my wife separately it lists it as me OR my wife leave sets it to away. I want the rule to only go into effect when both me and my wife are away.

Erase expression and change it to AND

1 Like

Show the rule you are trying to setup. Also, you might want to use Mode Manager to do this. Presumably you want to switch to Away mode when all have left, and back from Away mode when any arrive.

Are you talking about a trigger or a conditional? (You said "rule," but that no longer exists as a discrete entity in Rule 4.0, so I assume you're just talking about one of these two major components where the whole thing is often just called a rule; if you're still using 3.0, let us know because that changes things.)

It sounds like you might mean a trigger. Triggers are momentary events; they have no duration, and as such, all your triggers are basically "OR"s because any of them firing will cause your actions to run. You can combine multiple devices into one trigger and choose "all" instead of "any," but that may not always do what you want (e.g., if you choose "any present" as a trigger it will still fire any time either changes to anything while one remains present--it looks at the result, not whether there was a change in the result).

You can combine multiple things into one condition using AND a mentioned above. Conditions check states, so that works. Again, two triggers can't happen at the "same time" because they are just events. For a condition, you need to think about what you want to trigger the rule, I.e., when you want to check these conditions. Often that is a "changed" trigger with an IF/ELSE in your actions to do different things depending on which state your devices are in.

...but it's hard to suggest specifics without knowing what you're trying to do. Feel free to share a screenshot and someone may have suggestions.


Presence wife and husband change

Condition and event

If wife and husband all not presence
End if

I am using Rule 4.0, I was going by instructions given for 3.0 in the video series.

I did mean Triggers as Rules do no longer exist in that form in 4.0.

What I am trying to do is when Life360 shows that I have left the house AND my wife has left the house that the mode is set to Away. That way I can trigger events when the mode status changes to Away, things like locking the doors, turning off lights and once I can find a way of doing it turning off things like my Samsung TVs.

I don't want the mode to change to Away if only me OR my wife leave the house.

At some point I will add a wall mounted tablet and then will be able to do things like arm the system when we leave, but until then I would like the system to adjust things when we both leave the house.

The issue is, the two events, your wife leaving and you leaving, by definition cannot happen at the exact same instant. That is why triggers in RM 4.0 are always OR. The triggering events are your wife leaving or you leaving. But those are just what triggers the rule to fire. What you are going to do in the action is set up a conditional action that will look at both you AND your wife being Not Present. You'll set up that condition like this:

Then after that you will put whatever actions you want to take when both of you are not home. So, if you are both home, let's say your wife's sensor picks up her leaving 4 seconds before yours does. When her trigger occurs, nothing will happen, because you are still "present" to hubitat. But 4 seconds later, when your sensor departs, the actions will take place because you are both not present. You can expand that 4 second delay to be 4 hours, 4 days, 4 months...however long it takes for both sensors to not be present. Does that make sense?

This is easy to do in Mode Manager and not Rule Machine. Just open up Mode Manager and select "Set Mode based on presence". On the next screen make sure "Use time settings for Return from Away?" is selected. And then choose the presence sensors you want to use to activate away mode along with defining "any" or "all". And also choosing the presence sensors you want to use to activate return from away, again "any" or "all".

If you don't have the app "Mode Manager" installed. Simply go to "Add Built-in App" and install Mode Manager.

To close the loop on that, you would then have to set up a rule based on the mode changing to make the changes you wanted to the system when the mode changes to Away.

I would recommend before you do that deciding what is going to be the "master" system for your system. Will it be HSM (security) or the house's "mode". Frequently I've seen several people get themselves tied into knots because they are trying to link the two by having one control it sometimes and the other control it for others and then manually doing still is just a mess. So, if you are going to have Mode dictate what the settings are for HSM, you can have a mode tile on your tablet and just change the mode and let HSM follow along with that. Conversely, you can have mode controlled by the state of HSM. However, that linking you would have to do in RM manually. There's no built in way for that direction of control like there is to manage HSM by mode.

@Ryan780 what type of presence sensor are you using for your car?

I have an Xbee 3 mounted in a small plastic enclosure in the far-back quarter window where you can't even see it. I have it wired to my car's electrical (with a voltage regulator to go from 12v to 3v) so it only draws power when the car is on. I have another Xbee mounted with it's external antenna right outside my garage door. It has not failed to detect me coming home yet. Search for "Everything Xbee" if you're interested.

1 Like