How to Automate Your Morning Brew with Home Assistant Scripts

Ever hit the snooze button, stare at the kitchen counter, and wish your coffee could magically appear the moment you roll out of bed? That tiny, half‑asleep wish is the exact reason I started fiddling with Home Assistant last winter. The result? A coffee maker that starts brewing the second my smart alarm says “good morning.” If you love coffee as much as I love a good piece of code, let’s walk through how to make that happen.

Why Home Assistant?

Home Assistant (HA) is an open‑source platform that lets you glue together smart devices, sensors, and even custom scripts. Think of it as the nervous system for a house that actually listens. Unlike proprietary hubs that lock you into a single brand, HA runs on a Raspberry Pi, a modest PC, or even a Docker container, and it talks to pretty much anything that speaks MQTT, Zigbee, or Wi‑Fi.

The biggest draw for coffee lovers is the ability to trigger a brew based on events that aren’t just “press a button.” Want the kettle to heat up when the bedroom temperature drops below 68°F? Want the espresso shot to start when your calendar says “Client Call”? HA makes those “if‑this‑then‑that” scenarios painless to set up.

Getting Your Gear Ready

1. A Smart Coffee Maker that Plays Nice

Not every coffee machine can be controlled via Wi‑Fi or Bluetooth. I’m currently using the BrewBot 3000, a modestly priced drip brewer with a simple REST API. If you have a machine that only offers a physical on/off switch, a cheap Wi‑Fi relay (like the Sonoff Basic) can do the trick—just wire it across the power line and you’ve got a software‑controlled switch.

2. Home Assistant Core

Install HA on a Raspberry Pi 4 (4 GB RAM is a comfortable sweet spot). The official image is called “Home Assistant OS” and it boots straight into a web UI. Follow the on‑screen wizard, connect it to your Wi‑Fi, and you’re ready to add integrations.

3. A Trigger Device

I use the Google Nest Hub as my morning alarm because it can fire a Home Assistant event when the alarm stops. Any device that can run a short script or send a webhook works—your phone’s alarm app, a motion sensor, or even a smart plug that detects when the bedroom lamp turns on.

Writing the Brew Script

Home Assistant uses YAML (a human‑readable data format) for configuration, and Python‑based automations for more complex logic. Below is a straightforward automation that starts the BrewBot when the Nest alarm ends.

automation:
  - alias: "Start coffee after alarm"
    trigger:
      platform: event
      event_type: nest_alarm_stopped
    condition:
      - condition: time
        after: "06:00:00"
        before: "09:00:00"
    action:
      - service: switch.turn_on
        target:
          entity_id: switch.brewbot_power

Breakdown:

  • Trigger – The automation listens for a custom event nest_alarm_stopped. You can create this event with a small Google Assistant routine that calls a Home Assistant webhook when the alarm stops.
  • Condition – Limits the automation to typical breakfast hours. No coffee at 2 AM, unless you’re a night‑owl.
  • Action – Sends a command to the switch entity that powers the BrewBot. If your machine has a richer API (e.g., set brew strength), replace the switch.turn_on with a rest_command call.

Adding a Brew Strength Parameter

If your coffee maker supports setting brew strength via a POST request, define a rest_command first:

rest_command:
  set_brew_strength:
    url: "http://192.168.1.45/api/strength"
    method: post
    payload: '{"strength": "{{ strength }}"}'
    content_type: "application/json"

Then modify the automation action:

    action:
      - service: rest_command.set_brew_strength
        data:
          strength: "medium"
      - service: switch.turn_on
        target:
          entity_id: switch.brewbot_power

Now you can tweak the strength without touching the hardware.

Testing and Tweaking

Automation is a living thing. After you reload your YAML (Configuration → Server Controls → Reload Automations), fire the trigger manually from the Developer Tools panel. Watch the BrewBot power up; if it doesn’t, check the Logs tab for error messages. Common hiccups include:

  • Wrong entity ID – HA shows a list of all entities; copy‑paste to avoid typos.
  • Network timeout – Ensure your coffee maker and HA are on the same subnet.
  • API authentication – Some devices need a token; store it in HA’s secrets.yaml so it isn’t exposed in the UI.

Once the basic flow works, add a notification so you know when the coffee is ready. A simple push notification looks like this:

    - service: notify.mobile_app_jordan_phone
      data:
        title: "Coffee is brewing"
        message: "Your morning cup will be ready in about 5 minutes."

I love the moment my phone buzzes while I’m still in bed – it feels like the house is looking out for me.

Beyond the Basics

Scheduling Multiple Brews

If you have a second pot for guests, duplicate the automation with a different trigger (e.g., a button press on a smart wall switch). Use a script to bundle the two actions, then call the script from both automations.

Integrating with Calendar

Home Assistant can read Google Calendar events. Set a “Coffee with Alex” event, and HA can start a stronger brew automatically. The calendar integration uses OAuth; once authorized, you can filter events by keyword.

Energy Monitoring

Add a smart plug with power monitoring (e.g., TP-Link Kasa) to track how much electricity each brew consumes. Over a month you’ll see the real cost of that extra shot of espresso.

Voice Control

If you’re already shouting “Hey Google, good morning,” add a voice command that triggers the same automation. In the Google Home app, create a routine that calls the Home Assistant webhook you set up for the alarm. Voila – you can stay in bed and still get a fresh cup.

My Morning, Now

A week after setting this up, my mornings have a new rhythm: alarm, a brief stretch, a glance at the phone to see “Coffee is brewing,” and then the comforting drip of the BrewBot. No more fumbling for the power button in the dark, no more waiting for the kettle to boil while the house is still quiet. It’s a tiny slice of automation that feels like a personal butler, and it’s surprisingly satisfying.

If you’re on the fence about diving into Home Assistant, start small. A single switch automation is a low‑risk way to see the power of a connected home. Once you’ve tasted the convenience, you’ll probably find yourself automating the toaster, the blinds, and maybe even the dishwasher. The coffee is just the beginning.

Reactions