Help request for 'Good Morning' once a day

I'm struggling with Rule Machine 4, to make this rule. Here is what I logically want to do:

Daily set a variable SaidGoodMorning=False

Trigger is time becomes 8am
Motion in Bedroom is active, and Motion in Kitchen is active
Say GM on the Echo, Set SaidGoodMorning=True

Stop this at 10am,

Can someone assist with this? I tried a few things, but it's not working right.

Can I ask what good morning does for you? Is this a mode?

Sorry, i was pretty vague with that. It is the custom command feature in Rule Machine for one of My Echos - the Echo speaks command 'Good Morning'. That part works, my logic needed help.

1 Like

This is how I would do it. Now rereading your post, i see that if the time is between 8am and 10am and if motion is active then do this.
This will trigger whenever the sensor is tripped, though. I know there's a way to have the rule fire only one time, but I'm not sure how that is done as I don't have any rules that I need to run one time only, so I've never researched it. I'm hoping someone else will fill in that blank.
Tagging @bertabcd1234 or @JasonJoel or @aaiyar @neonturbo :arrow_left: some of my go to peeps to weigh in.


Run the rule if a private boolean is true.
Set the private boolean to false as soon as the the speak on echo action is done
Set the private boolean to true again at 7:59AM

Isn't that trigger an OR? Is there a way for the trigger to be an AND of both motion events?

Or, do I ignore that, have the IF be multi conditional.
if (motion Kitchen active) AND (motion bedroom active) AND (Time between 8 and 10) then ...

The trigger has one of the conditions, so it will trigger the conditional setup. Right?


Maybe try this?

1 Like

If I understand your situation correctly, you are trying to use the variable SaidGoodMorning to ensure that the action only happens once per day. You may need two rules. One rule could trigger at 7:30 and simply set the variable to false. The other rule would trigger at either 8:00 or your motion criteria. The actions of the second rule should have an if statements that tests a combination of things:

  1. SaidGoodMorning is false
  2. time between 8:00 and 10:00 and
  3. your motion criteria

Between the if and the end-if, you should do you good morning action and set SaidGoodMorning to true.

In the context of April's input can you elaborate?

Is the trigger the same? Do I add the boolean as another AND? Were would I initialize the boolean the very first time?


Triggers can never be AND because it would only trigger if they both became active at the exact same time which is virtually impossible.

I think if you take April's suggestion and say IF (Kitchen Multi active AND Bedroom Multi active AND Time between 8am - 10am then....., it would trigger when you want.

Then, do what @aaiyar suggested or this will run every time that both sensors are active between 8am-10am and I assume you only want it to run the 1st time.


I follow. I was wondering if I needed a second rule to set the this variable as a global.

Edit - changed the trigger to Kitchen motion, which I now get. Next is to add the variable part. Thanks all

Clicking "Run Actions" will not do anything right now with your rule because your IF (aka conditional) evaluates to false, so it will skip the contents (BTW, to have proper syntax, I'd close this with an END-IF, though at the end of the rule RM will infer one for you regardless so it doesn't matter here). Do you need both kitchen and bedroom motion to be active at the same time? If you normally walk right from one to the other and they have a timeout that's long enough to do this--for many it's 30-60 seconds by default--longer for some other sensors, then this should work, but it's worth asking.

In that case, I'd keep something like what you have. Assuming kitchen is the second sensor to become active, two rules like this should work:

Rule 1

Trigger Events: Motion Kitchen active

Actions to Run:

IF (Motion Master Bedroom active AND
 Motion Kitchen Active AND
 Time between 8 AM and 10 AM AND
 Private Boolean is True) THEN
   sayGood Morning() on Echo - Rick
   Set Private Boolean False (for this rule)

Rule 2

Trigger Events: Time is 7:59 AM

Actions to Run:

Set Private Boolean True: Rule 1

To give credit where due, the second rule is just what @aaiyar suggested, and the first is similar to what you and April already came up with, just with the addition of using Private Boolean to "track" this and resetting that variable in the morning, which you need the second rule to make work fully.

Thanks all, I'm pretty sure I got it now! I have a 'Good Night' RM rule to turn lots of stuff off, I added to that rule to reset the variable 'SaidGoodMorning' to false.

Now my GoodMorning2 rule is working, only once a day! The screen shot is from AFTER it said it for the day. Also will change from PM to AM :slight_smile:

I have a good morning routine triggered from a motion sensor downstairs, and the status of our sleep pads and a guest mode. Basically in the middle of the night some switches get reset ready for action, by checking we are present and if a guest is here or not. Then in the morning, with the motion triggered, a randomised message is made on a Google Home Mini. The rule reads a message appropriate to the person (eg. if our sleep pads say we are still in bed then the message is for the guest, or if mine is deactivated then it's for me, etc). These messages are fun ("good morning Superman.... La la la"). They also read out the weather forecast. It works pretty reliably every morning which is nice.

Is SaidGoodMorning a global variable? Or a local variable? How are you going to set it to be false again so it works the next day?

Also, you need an END-IF to finish your rule.

It is a global variable, and I'm setting it to false every night as part of a 'GoodNight' rule. It said a Good Morning phase today!
I'm confused about how to add the End-If. I tried editing the expression, and I keep seeing Insert before as the option. It need to be inserted after. How do I add it?

1 Like

That is slick! I'm going to add the weather forecast to this. I think I'll also try to grab the existing volume level, set it to where I want it, then restore the volume level.

1 Like

Add it as the next action.

Ok thanks, I'll try that when I get home.

1 Like