Lighting automation using (Rule Machine). How to ignore a presence state


(Fao Gozalo) #1

Hello everyone. This is my first post here.

I’m trying to set up an automation scenario for my entrance lighting. To do so, I’m using the Rule machine app, making in addition to the mobile presence sensors.

My question is quite simple. Is there a way for the rule machine to ignore the presence state of a mobile, if it is already set to true?

This is because when someone is already at home, there is no need for the automation scenario to run (turn on the lights). It should only activate if someone is arriving.

Any help or imput is much appreciated.

Thank you.


(Tolik) #2

You can use a conditional trigger, the arrival of a presence. If I were you, and this is a simple “turn the light on when someone arrives” situation I would use the official “Smart Lights” smartapp. It runs local on the hub. It has the capability you seek.


(Jason "The Enabler" as deemed so by @Smart) #3

Hey there and welcome to the forum.

It sound like you are wanting an action to occur when they first presence sensor arrives, but not when any other ones arrive after that, and to have it run no matter which one arrives there first.

Is that right?

Well, if that’s it, than yes, rule machine is what you want.

Take a look at this thread and repost your question there. We try to keep things on topic so that others can find the examples as well. It’s not to too difficult of a rule to create, but it can be done.

I’ll see what I can make up for you.


(Jason "The Enabler" as deemed so by @Smart) #4

@FAOGozalo

This is how I would do it. It would take two rules.

Rule one - light on/off

Conditions - presence sensor present (any), private Boolean true
Rule - presence sensor present (any) AND private Boolean true
Actions for true - turn on light
Actions for false - leave blank

Rule two - arrival

Conditions - presence sensors present (any)
Rule - presence sensors present (any)
Actions for true - set private Boolean: rule one: true
Actions for false - set private Boolean: rule one: false

What this does -
Rule two becomes true when any of the presence sensors are at home. It changes the private Boolean of Rule one, which then makes it true and turns on the light. Since rule two is already true, each consecutive arrival will have no affect on the rules. A rule truth change must occur for an action to be done.
Once all of the presence sensors are gone again, rule two becomes false and sets rule one to false, thus resetting the system.


(Fao Gozalo) #5

Thanks for the reply.

Upon reading the thread you indicated. I liked the OP idea very much.

The logic would be this:

Upon sunset, all corridor lights should turn at a 10% dimmer level, and stay on up to 10:00PM.

If someone arrives (mobile presence sensor), the dimmer level should increase to 99% for a 10 minute period. After which, the dimmer level should return to 10%.

After 10:00PM the lights should turn off. If someone arrives after this time, the lights should turn on to a 99% dimmer level for 10 minutes and then, turn off again.

All of this instructions should ignore if someone is already present at home.

I tried, following the instructions in that post, but I think I did something wrong, since it didn’t work as planned.

Any addition input is much appreciated. Thank you.


(Jason "The Enabler" as deemed so by @Smart) #6

I was the OP on that thread and that scenario was interesting indeed. I can write it for you the way you want it, but not until this evening. I’ll post it here for you and tag you.

Edit:
You said that if someone is airway hone that the entire sensei should be disabled… Still, no lights on at sunset and no lights after 10pm if someone is already home?


(Fao Gozalo) #7

That is awesome. Thank you so much. By saying “All of this instructions should ignore if someone is already present at home”, what I meant was that the system should run regardless. This is because I don’t know how the second part logic would work if someone is already home: would the dimmer increase to 99% or would it just ignore that person sensor and increase only when someone else arrives home.

Thank you in advance.


(Jason "The Enabler" as deemed so by @Smart) #8

Ok, this is what I’m thinking of.
Scenario one
Nobody home… Lights come on at sunset and go off at 10pm (at 10%).
Someone comes home at 8:30pm. Lights increase to 99% for ten minutes and go back to 10%.
Someone else comes home at 9:45.The first person is still home, but the lights come up to 99% for ten minutes and then back to 10%.
At 10pm the lights turn off.
Person 3 comes home at 11:45. The other two are still home. Lights go to 99% for ten minutes and then turn back off.

Is that what you want?

Or is it this.

Scenario two.
Lights come on at 10% at sunset. Person one comes home, lights go to 99% for ten minutes, then bank to 10%. Lights stay at 10% and turn off at 10pm. When others arrive the lights do nothing because someone else has already arrived.

I can do either one. Just let me know which scenario.


(Fao Gozalo) #9

The first scenario you illustrated is what I want to implement.

Out of curiosity, what happens if the scenario starts and someone is already home (as in, someone arrives before sunset)? Does it affect its execution (this is my main concern)?

Cheers.


(Jason "The Enabler" as deemed so by @Smart) #10

No, I will set this up so that it only ONLY runs between sunset and sunrise… So only when it’s dark.


(Jason "The Enabler" as deemed so by @Smart) #11

Rule one: lights on at sunset
Condition - time between sunset and 10pm
Rule - time between sunset and 10pm
Actions for true: dim corridor lights: 10%

Rule two: capture/restore lights
Condition - private Boolean: this rule: false
Rule - private Boolean: this rule: false
Action for true - Capture: corridor lights, Set private Boolean: rule three: false
Actions for false - restore captured bulbs, set private Boolean: rule three: true

Rule three: arrival lights
Conditions - private Boolean: this rule: false
Rule - private Boolean: this rule: false
Actions for true - dim corridor lights: 99%, set private Boolean: rule two: true - delay 10 minutes
Actions for false - leave blank

Rule four: trigger - someone arrives
Trigger actions - presence sensor arrives (any)
Actions - set private Boolean: rule two: false
Restrictions - only between two times: sunset and sunrise

What this scenario does…

Rule one turns on the lights to 10% at sunset and turns them off at 10 pm.

When someone arrives home, rule three turns on rule two. Rule two captures the current state of the bulbs and turns on rule three.

Rule three sets the bulbs to 99% for ten minutes. After ten minutes rule three turns off Rule two. When rule two turns off it restores the bulbs to their previous state and it turns off Rule three.

At this point everything is reset and awaiting the next person to arrive.

Rules two thru four will only operate between sunset and sunrise.

Let me know if you have any trouble. This can be tricky to set up correctly.


(Fao Gozalo) #12

Hey Bamarayne, thanks so much for your help! When setting a private boolean I get the option "for this rule (default) - on, should I leave it that way, or should I turn it off?

This is showing when setting up the action for rule number 2 (capture/restore lights) and for 3 (arrival lights). Ill post some screenshots to show what I mean, and more importantly, to ask if what I did is correct.

Rule 1:


Rule 2:


Rule 3:

Thanks once again!


(Jason "The Enabler" as deemed so by @Smart) #13

Hey, I’ll go over these in a bit and get back to you. But at quick glance, you forgot to choose which rule in rule number 3 Boolean.

And don’t forget to delete those rules from the first scenario. I worked those into this, but they are different. So delete those.

I don’t see rule number four yet either.

But looking good so far.

Once it’s built we will trouble shoot it if there are glitches when it’s supposed to run.


(Jason "The Enabler" as deemed so by @Smart) #14

Rule one - actions for false - turn off lights

Rule two - add in the actions for false

Rule three - I don’t see the screen shots for the first page of this rule

Rule four - no screen shots


(Fao Gozalo) #15

Hey, I made the adjustments mentioned on your reply. Here’s what I got:

Rule 01: Lights on sunset.

Rule 02: Capture/Restore lights.

Rule 03: Arrival lights.

Rule 04: Someone arrives.

This is it.


(Jason "The Enabler" as deemed so by @Smart) #16

Awesome.
Here is how you test it.

Temporarily remove the sunset to sunrise restriction.
In the IDE create two virtual presence sensors.

Add then into rule four.

In the app, Tap on one of the virtual presence sensors. The lights should come on. Wait ten minutes. If they go off, awesome.

If they go off like they are supposed to, leave the first one present and tap on the second one to make it become present. The same thing should Jason.


(Fao Gozalo) #17

Well, I believe I did something wrong. I mean, the lights did go on at the specified time (sunset). But They are not going to 99% when someone arrives. Any idea, where should I check? Thank you.