I have a simple automation rule to turn on office lights in the morning, M-F.
I want a condition to be that I am home (I travel for work)
I have to build it using Rule Machine, as Simple Automation does not do Presence.
This is what I have so far:
I dont have triggers, as triggers seem to be only OR not AND
Does this look correct?
Thanks in advance.
Just remember that because you set conditions, they are not automatically added to your rule. If you want to use any of these, you will have to add them to actions.
Also, there is no AND in triggers because the chances of things happening exactly the same microsecond is not going to happen. The triggers are simply an event. You can have more than one trigger, but the AND part will be in the actions.
In case this isn't clear, he's explaining that you have created the conditions, but your rule isn't actually using them. In order for them to be part of your actions, you need to add a "conditional action" using the drop down menus, select/create your condition(s), and then list your actions to take if the conditions are true.
And you'll need a trigger. Based on your explanation, a time of day trigger will likely be the most simple.
Watching those videos should help clear things up as well.
Thank you both for the insight.
Changed the rule to include one trigger, and everything works great!
Okay. Rule has worked great all week.
Then weekend came around, and lights came on...
Here are conditions:
What went wrong?
Is it the fact that the conditions are OR, and should be AND?
Can you share a screen shot of the actual rule?
The conditions you can already see (previously sent)
You have created the conditions, but you haven't actually included them to be evaluated prior to running your actions. My first screenshot below shows the structure of a rule that will evaluate for presence and the day of the week. Because they are evaluated using an AND they must both be true in order for that portion of the IF to be run.
Yours will look similar but will have more actions, and should also include your Wait and Off actions. Also, best practice is also to always close the IF section with an END-IF.
In order to get this into your rule, you will need to add/insert a conditional action and choose the conditions that you've already created. In my opinion, the "flow" of adding conditional actions is not very intuitive, but it works once you understand the process. See below for the first two steps...
A "simple conditional" only allows one condition and one action. Because you have multiple conditions and actions, you'll need to use the full IF - THEN structure. Once you get past that, you can choose your first condition, choose AND, then select your second condition. Once you've got both conditions added, choose Done with Conditional Actions. Your rule should now include the IF ... THEN line with your conditions listed in between.
Now you can add the actual actions you want to perform if the conditions are true. When viewing the rule, they should appear indented to let you know they are contained "underneath" the first part of the IF statement. For more complex rules you can add additional ELSE-IF sections, and/or an ELSE action. Every IF action should include an END-IF at the end to formally end the evaluation of conditions.
A full complex rule looks something like this...
I think I've got it:
In like manner, I can list certain Holidays throughout the year to also include as conditions.
That looks good...
So for holidays, I'm assuming you would want to skip the rule and leave the lights off... correct? I've never done this, but assuming you have some way of checking if the day is a holiday, you could insert a simple conditional action at the beginning of your rule...
[Using simple conditional]
IF holiday is [TRUE] Exit Rule
If this is the first action in the rule, it will exit the rule on holidays and prevent any following actions from running. Note that simple conditionals are completely self-contained and there is need for an END-IF and no option for ELSE-IF or ELSE statements.