Brewing coffee based on varying morning routines

[Note: edited Oct 2 to prevent coffee maker from turning on when we return from a trip. edited Nov 21 to use new Simple Automation Rules 1.1 released in the Hub 2.2.4 update]

Thought I'd describe a fairly simple automation that had to work reliably in the face of varying situations. Comments (and improvements) welcome.

Problem: My spouse likes to have her coffee brewing for her when she returns from her morning walks.


  1. She doesn't always take a walk, and if she does, her return time is unpredictable. She also leaves and returns for other chores, usually after her walk, and the coffee maker should not turn on for those returns.
  2. She may also brew coffee in the evening if friends come over. Of course, in these COVID-19 days, that's not happening, but I have to accommodate that in the future.
  3. In the evening, she sets up her coffee. If the wall switch were on, this would start brewing, which she does not want to happen.
  4. She wants things to "just work". Any extra steps added to her current process would be frowned upon and she has no patience to either detect or respond to automation failures.

Approach: I spent a week adjusting the automation without actually connecting it to the coffee maker so that I could observe its behavior before subjecting my spouse to it. This week was critical to success.


  1. A very dumb cheap coffee maker that only has a mechanical on-off switch. This way, I could completely control it using a switched outlet. The switch is always left on (except in special circumstances—see below).
  2. A plug-in zigbee outlet that has a readily-accessible manual on/off button as well (and button is lit when it is on).
  3. A virtual switch in HE called "Virtual Coffee Done Today".
  4. A presence sensor (set-up not addressed here).

Simple automation rules

  1. Turn on Kitchen Coffee Maker when Spouse arrives, turn off after 65 minutes. Restrictions: only between 7 am and 11 am. Switch to disable Simple Automation Rule: Virtual Coffee Done Today. (Wow! Simple automation rules can do a lot of things if your needs match what it offers.)
  2. Turn off Virtual Coffee Done Today at 11:05 am, Turn on at 4:10 am. Only when Mode is Away, Day, Evening. (See discussion below—the 11:05 off resets the trigger for the next day and the 4:10 am on is a sneaky way of disabling the auto on when we're returning from a trip.)

Rule machine rule

  1. Mark coffee done and turn off coffee maker if it was turned on at wall switch.
  • Trigger event: Kitchen Coffee Maker turns on.
  • Actions to run:
    • If (Time between 7:00 AM and 11:00AM) On: Virtual Coffee Done Today
    • Cancel Delayed Actions
    • Off: Kitchen Coffee Maker --> delayed 1:05 (cancelable)

How it works:

  1. If spouse leaves and returns in the morning, the coffee is brewed by the simple rule and the coffee done switch is set by the rule machine rule, preventing further responses to arrival status changes. The outlet resets to off after a reasonable time. This rule is only active 7-11 am, so arrivals outside that time range won't trigger the coffee maker. The coffee done switch is reset to off at 11:05 am, to be ready for the next day.
  2. If spouse doesn't want to take a walk, she presses the button on the outlet, starting the coffee, and the rule machine rule prevents further responses to arrival status changes. The outlet resets to off after a reasonable time.
  3. Likewise, if coffee is desired later in the day, the outlet switch is used to start brewing, and it resets to off quickly enough that she won't be setting up for the morning coffee while the outlet is on.
  4. The trickiest situation is when she doesn't want the coffee to start when she comes home after a walk (e.g., about to run a quick errand before breakfast). She (or I) has to set Virtual Coffee Done Today to on in the dashboard sometime after 11:05 am the day before (see simple rule #2). Then unset the Virtual Coffee Done Today when we want it to respond to the next return from away.
  5. Yes, the coffee maker is turned off twice if it is started by the simple rule: once by the simple rule, and a second time by the rule machine rule. I did this so that if I changed things later about how the rule machine rule runs, I wouldn't forget to turn off the coffee maker. The duplication seems harmless.
  6. Simple rule #2 doesn't run when the mode is Night. So, if we're at home, the rule does not turn on Virtual Coffee Done Today at 4:10 am. But, if we're away, the mode is Away and the switch is turned on. This is how we prevent it from triggering the coffee maker when we return from a trip.

Happiness ensued.


Nice! :clap: :clap:

How about if you add another restriction: "Running Errands Today"
Set to disable the rule until the 2nd arrival.
Of course you'd need some sort of trigger, i.e. button or....?

I did something simular w/ a Teaforia Tea “Kettle” and homebridge so i could load the Teaforia w/ leaves and sugar before bed and say “Hey Siri, brew black tea in the morning” which would turn on a virtual switch. Then in the morning when my hub is running through my wake up automations it turns that switch off, sending a http command to the kettle to set the temp and brew time to brew black tea or whatever type of tea i specify.

Ya just gave me the inspiration to add a “when i get home” cause yeah.... sometimes it could be nice to have a nice cup of tea ready when i get home... THX!

Just a word of caution. You may want to add some form secondary level of protection incase it doesn't turn off for whatever reason that isn't dependent on the hub. Same would go for fireplaces and such.

1 Like

Lots of the simple on/off coffee makers I have used (like mr coffee) have built in timers for turn off)

Yes, they have a built-in auto cutoff but I would at least confirm. They are easy enough to add if it doesn't have one.

1 Like

Yes, it has a built-in cutoff. The only thing that might keep running is the heater under the coffee pot. Worst thing that would happen, it would dry out the coffee in the pot and ruin the pot.

1 Like

I'm still working on this one. The human interface portion is what is stymieing me right now.

I might repurpose one of my Aqara Opple buttons for this. I think what I'd do is have the "Coffee Done Today" switch forced to "on" when the errand switch is on. She'd then hit the off button on the Opple when she's about to go on her last errand, and the "Coffee Done Today" would be set to off. That way, it'd turn on with the next arrival.

This will need some spousal acceptance testing.

1 Like

Now if someone could just do this for my Keurig.

That's the benefit of dumb coffee makers. They're easy to automate if all you're trying to do is start it.

1 Like

I want it made and waiting with my bullet proof ingredients. blended ... with the lid on

This is what you need...

1 Like

Looks like I'm doing it myself. The ol' fashined way.

I do this for my wife every morning for her 8AM coffee delivery...Two shots espresso and steamed milk to make her morning latte. Lesson learned: My wife married very well. :wink:

1 Like

Here's a start:

One of these days (maybe this winter) I have plans to get inside it and get a relay attached to the power button. Then at least I can control on/off also.

1 Like

I've revised the automation based upon the new capabilities in Simple Automation Rules starting with firmware 2.2.4. The first post in this thread has been edited to show the new automation.

This eliminates one rule machine rule, and also gives me the capability to hold the coffee brewing if she's leaving the house twice in the morning before she wants coffee.