“And” function

Hello group
I have before got fast and good help, thanks, so now I am back.

I can easily find functions that “if 1 or 2 then 3” but I want “if 1 and 2 then 3” but I can’t find out how to do it.
Suggestions please, and a little detailed, I am quite new in this

Henrik Ullum🇩🇰

What is the context you are referring to?

I have a door contact and a presence sensor (life360), when they both are on, I want a light to turn on

Which app are you using to try to do this? Basic rules, simple rules, rule machine, motion and mode lighting?

I am going to guess that you are trying to use AND in the trigger section of Rule Machine and you cannot do that because a triggers are moments in time and 2 different triggers cannot occur at the exact same moment in time.

Instead, list your triggers as OR then, in your Actions, you use conditionals. For example, your trigger is:
If Door Contact opens OR presence sensor changes to present.

Then your Action is:

If Door Contact is open AND Presence Sensor is present, then turn on light.

The key is that a trigger is an event that occurs in an exact moment of time and a conditional tests the current state of the device.

This confuses a lot of people.

8 Likes

@stephen_nutt's approach will definitely work. With RM5 you have one more option that I think (have not tested) will also work, and that's to use predicate conditions. This condition must be met before the rule triggers.

2 Likes

just know that based on how you want the rule to work (if you're present and the door opens), then the light will turn on when you leave through that door, or if other people open the door as well

I am sorry not to be specific enough, but at least I got something to work with.
I will let you know the outcome.

Sorry and apologize to everyone in this tread

To take it from the beginning, I was not precise about the therms, because I thougth it was pretty simple, which I now realize it is not.
Wipe out the blackboard and see this as a new start :smiley:

I have builded two bed presence senors via Aqara door sensors. In bed “door closed”, out of bed “door open”

As it is, we dont go to bed at the same time, I got some night calls for job, as well as my wife works abroad.

So to activate my alarm system, it should be:
Me in bed, my wife away
Wife in bed, me away, could happen at 0300
Both in bed, normaly happens a different times😃

One of these conditions should tell the house to go to sleep
I do not have preferences about which app to use, maybe rule mashine
Due to lack of time, I have not yet gone any further since my first post.

Thanks🇩🇰

Assuming that you have presence sensors for both you and your wife:

You would trigger a rule in Rule Machine with either bed sensor closed (in-bed). Then the actions would start with a Conditional Action (IF-THEN) with three conditions:

(you-in-bed AND wife-not-present)
OR
(wife-in-bed AND you-not present)
OR
(you-in-bed AND wife-in-bed)

Be sure to use the parenthesized sub-expressions to keep the logic as shown above. Following the IF-THEN is your action to tell the house to go to sleep. The only app that can do this automation is Rule Machine.

Thanks, I will look at it when my time alows, right now, other interesting Hubitat projects, but I need this one in the near future, I will update here.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.