Have questions moving from webCore to Rule Machine

In ST, I have a few things set up in Smart Lighting and webCore that I want to do in Rule Machine. I cannot figure them out (probably being dense).

  1. In ST, I have an automation that turns off all lights if everyone leaves. I was trying to use a trigger in RM, but I only can do "or" - so it reads if I leave "or" my wife leaves. I need it to be if I leave "and" my wife leaves...
    Am I missing something obvious?

  2. This one is a little more complicated:
    a. If wife presence sensor arrives, AND Living Room motion detector becomes active, Speaker says "Welcome home wife".
    b. If my presence sensor arrives, AND Living Room motion detector becomes active. Speaker says "Welcome home Michael".
    c. If BOTH my presence sensor and the wife's arrive, AND the Living Room motion detector becomes active. Speaker says "Welcome home Michael and wife".
    Using Life 360 and have speaker set up and working, but cannot figure out the logic for this.

Anybody got any help?

I do this with Rooms manager

1 Like

you mean event? Or a Triggered Rule?

I would build that from a Rule rule (not a trigger or a triggered rule) by adding the Presence conditions and then setting up the Rule section to use the AND.

The answer's the same for #2

I was using a triggered rule... I'll play around with a rule to try to use and.

Thanks!!

Triggers are Events inside RM and yet Triggers are also the word we use to describe "making the automation go"

Since a Trigger is just one style of three to build a Rule:
21%20PM
...it's so easy to confuse me. :slight_smile:

All Rules, no matter which style are Event Driven.

An event is, to name a few examples: Sunrise; 30 mins after sunrise; switch ON, dim to level 25, Door closed, Humidity at 30% or greater. They have ZERO time in how we should think of them. A door going from closed to open... that change is the event.. the fact it's still open is the state, the event is gone, happened and done.

A Rule that uses a Trigger is NOT looking at state. It's not going to run if the light is on.. it will only run if the light changes from off to on.

For example: You create a Trigger for a Door Contact = open. And the Action is: light on
You'll notice that Triggers don't have Action for True/False, there's just ACTION.
36%20PM

If you include a Restriction of some kind.. say sunrise to sunset.. if the door is Open prior to sunrise, when sunrise comes along, the Action doesn't run. The Event occurred while the Rule was restricted.

The purpose of a Rule is to run on either event. Door Open and Door Closed are events and a Rule will have Action for True (turn the light on, in this exceedingly simple example) and Action for False (Light Off) but the same thing happens related to the Restriction. If the door is open prior to the restriction ending, there's no Event to cause the Rule to be evaluated. You'd get an evaluation when the door closed, but since the light was already off, another Off being sent won't be seen.

1 Like

In rule machine, create a rule, then pick capability presence and select all your presence sensors. Then toggle the "all" switch below that. Then the condition will be "all of your sensors not present". Then you can select the actions for "true" when that happens. You don't have to do it with a trigger, you want to use a rule. I know this is counter-intuitive for a former webCoRE user...it was for me too. But in this case, a rule is more appropriate than a trigger.

23-18-00-37

When either device is present, the total condition will return false and therefore not run the actions defined for True. When both are away, the rule will switch to True and the lights will turn off. The rule will only trigger events when changing from True to False or False to True. Not every time the conditions are evaluated.

1 Like

To follow up on your more complex scenario, the false path could trigger more actions which enable rules to speak your welcome message.

1 Like

But that would not trigger if one person was home and the other came home. If you want an action to happen based on an individual event, I would recommend a Trigger instead of the rule. This way, you know exactly what you are getting.

1 Like

Thanks for all the help! I'm getting the hang of it. I was having trouble with terminology, but I think I'm catching on!

1 Like

@bravenel Is this even possible in RM? I've had a look but can't work it out.

It works out if a speaker is on when we leave and if it is, it stores that in a variable and pauses the speaker. Then if we return within the day time it will press play on that speaker. There is also a bootlean in there so stop it starting again if we are home and stoped it then someone else comes home.

I don't believe that the Bolean variable is needed for a rule in Rule machine. If anyone of them are present the rule would be true. Until they all leave again, the rule will continue to be true which is the equivalent of setting the variable to true.

So basically:

  • WebCoRE executes the rule when any event from any trigger occurs, which will re-run the actions even if nothing has actually changed.
  • RM evaluates the rule when any trigger occurs, but only executes the actions on truth change.

Is that right?

Nope it depends on how you set it up same as RM. RM used to only have conditions so that statement was true for RM. But now it has conditions and triggers they both do the same.

That doesn't feel right to me...
RM has Triggers and Rules, and they are both Event driven. With a Trigger, there's an Action... it's not labeled Action on True because there is no false with a trigger. Trigger occurs, blam, the action is run/executed. "Truth change" didn't happen. The Event happened and that was the trigger.

For Rules, every Event has Rules that subscribe to it. Every subscribed event causes the Rule to be Evaluated. If the evaluation finds that "Truth changed" then the corresponding Action is run/executed. If the Truth Changed from False to True, then Action on True is run, If Truth Changed from True to False, then Action on False is run. [ Restrictions prevent / disable subscribed Events. They are ignored. ]

The simple nature of the above can be obscured by what you're including as conditions. It's easy to think: Door sensor... open means turn on the Light, turn it off when the door closes. BUT you can make the condition NOT Open... and thus "True" means the door is closed.

I'm hoping I'm adding to an understanding.. but

Possibly not but that's not the main problem. The main issue I have, is I want RM to work out what speaker is ON then store that in its memory untill someone returns then press play on that one again.

Okay...what's the scenario in words?
Speaker is on.
Someone comes home
Press play

Is that right? Couldn't that be done with a virtual switch? That's the very definition of a boolean variable. On or Off. Boolean would be the last variables i would want to see added to RM. Lets get string first!

It's already there. Private Boolean obviates most needs for a virtual switch, at least with respect to multiple rules interacting.

the Boolean was so that if someone was already home it wouldn't start again if another person arrived. I can sort that bit i'm sure.

The scenario is speaker is playing everyone leaves and house shuts down. But before it turns off the speaker, i need it to work out what speakers are playing. Store this

someone comes home before 10PM (Night mode) and because the speaker was on before, playing the radio EX, because someone has arrived it presses play on them speakers. They decide to turn off the speaker, but because the stored device variable hasn't changed (because everyone has not left again) you don't want the speaker to turn on again the 2nd time. Thats where the boolean will come in. But its the storing what device was ON that i'm interested in.

And again, a boolean variable can be stored as a virtual device turning on or off. Think about it. A boolean variable has two states.... A virtual switch has two states. RM can set a switch on or off. So, why can't you use a virtual switch?

I don't want a boolean, I know i can do that with a switch! Is the device variable I need! I have 3 speakers soon to be more how can a switch only on and off know which speaker is on. It's more that 2 states isn't it
dining room ON only
lounge ON only
master bed ON only
Dining room and lounge ON
Dining room and bedroom ON
Lounge and bedroom ON
or all 3 ON

then when i have more it gets even more possibilities! On WC you could do a check for a state and all devices matching that state you could store in a temp device variable group then turn on or off that group.