My Coffee Machine

Finally happy with my coffee machine routines with Alexa and Mobile App notifications so I thought I’d share…


image

alias: Coffee is brewing Notification
description: ''
trigger:
  - entity_id: binary_sensor.coffee_brewing
    from: 'off'
    platform: state
    to: 'on'
condition: []
action:
  - service: notify.alexa_media
    data:
      target: |
        {{ states('sensor.last_alexa') }}
      message: coffeemachine has started.
      data:
        type: announce
  - data:
      data:
        group: Coffee Machine
        color: '#98CCFD'
        icon_url: 'https://img.icons8.com/ultraviolet/2x/coffee-maker.png'
        importance: high
        timeout: 300
        vibrationPattern: '100, 1000, 100, 1000, 100'
      message: Coffee is now brewing
      title: Home Assistant
    service: notify.mobile_app_vog_l04
mode: single
alias: Coffee is ready Notification
description: ''
trigger:
  - entity_id: binary_sensor.coffee_brewing
    platform: state
    to: 'off'
    from: 'on'
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{
              (as_timestamp(now())-as_timestamp(trigger.from_state.last_changed))
              < 60 }}
        sequence:
          - service: notify.alexa_media
            data:
              target: |
                {{ states('sensor.last_alexa') }}
              message: You forgot to prepare the coffeemachine.
              data:
                type: announce
    default:
      - service: notify.alexa_media
        data:
          target: |
            {{ states('sensor.last_alexa') }}
          message: Your coffee is ready!
          data:
            type: announce
      - data:
          data:
            group: Coffee Machine
            color: '#F78F8F'
            icon_url: 'https://img.icons8.com/officel/2x/cafe.png'
            importance: high
            timeout: 600
            vibrationPattern: '100, 1000, 100, 1000, 100'
          message: Coffee is ready!
          title: Home Assistant
        service: notify.mobile_app_vog_l04
mode: single
entities:
  - entity: switch.sonoff_inching
    icon: 'hass:power'
  - entity: binary_sensor.coffee_brewing
    secondary_info: last-changed
    icon: 'hass:coffee-maker'
show_header_toggle: false
type: entities
state_color: true
title: Kitchen
  - platform: threshold
    name: "Coffee Brewing"
    upper: 1
    entity_id: sensor.nas_wr01z_power_plug_12a_electric_a
2 Likes

Just wondering, do you have any sort of wireless button on the coffee machine that start the brewing? Like switchbot button?

I wired a Sonoff inching relay in parallel to the on/off button as the machine’s on/off switch is a momentary contact to turn the machine on or off. It’s now powered by a 5v transformer from AliExpress connected internally to the coffee maker’s mains (rather than the jerry-rigged external USB adapter I had before) and it’s connected to HA via HACS Integration Sonoff LAN

Nice one. So the Sonoff relay is supported as well by AlexxIT component.

Yes, it was recognized!

Here are my latest tweaks…

Haozee Power Plug is off:
image

Power plug is on:
image

After I do the water-filter-coffee-grounds thing, I say “Alexa, coffee is prepared”…
image

Then I either press the on/off button on the machine (which I avoid), or the Sonoff “Make Coffee” switch in HA, or utter “Alexa, make coffee”, or wait until morning when she asks me…
image

If I mess up and forget the water (machine is on < 1 minute), Alexa says “You forgot to prepare the coffee”

When coffee is finished, Alexa says: “Your coffee is ready!” and HA App Alert: “Your coffee is ready!”

In my “Alexa, Good morning!” routine, I implemented an actionable notification in my Good Morning script: “Would you like me to start your coffee?”

If anyone is interested in more details, I’d be happy to provide or post…

3 Likes

very sexy

could show us the code (love lace)

type: vertical-stack
title: Kitchen
cards:
  - type: 'custom:auto-entities'
    card:
      type: entities
      title: ' '
      show_header_toggle: false
      state_color: true
    filter:
      template: |
        sensor.coffee_machine,
        input_boolean.coffee_prepared,
        {% if is_state('sensor.coffee_machine','Ready') %}
          switch.sonoff_inching,
        {% endif %}

Other items worth mentioning for the above to work…

  - platform: template
    sensors:
    
      coffee_machine:
        friendly_name: "Coffee Machine"
        unique_id: "kenmore-coffee-machine"
        value_template: >-
          {% if is_state('switch.nas_wr01z_power_plug_12a_switch', 'off') %}
            Off
          {% elif states('sensor.nas_wr01z_power_plug_12a_electric_a')|float > 1.0 %}
            Brewing
          {% elif is_state('input_boolean.coffee_prepared', 'off') %}
            Not Ready
          {% else %}
            Ready
          {% endif %}

custom-ui:

#customize.yaml

sensor.coffee_machine:
  templates:
    theme: >
    icon_color: >
      if (state == 'Off') return 'slategray';
      if (state == 'Not Ready') return '#FFBF00';
      if (state == 'Ready') return 'lime';
      if (state == 'Brewing') return 'orangered';

I’ve since added a filter counter that decrements each time the machine runs for more than a minute (in case it was run without water).

image

image

I increment the filter count via Alexa…
“Alexa, I bought coffee filters”
Alexa: “How many coffee filters did you buy?”
“80”
and the filter count gets incremented +80

4 Likes

Hello,

I’m sorry for my English. I have my DeLonghi Magnifica “smart” version. I check power with smart socket bw-shp10 pm. I turn on/off with SwitchBot. My automation, script check states and counters (how much to do coffee from bag 0-1000g, daily coffee, small/long coffee, water, filter etc.). Notifications/voice add coffee to shop than >20 coffee, water tank is empty, coffee tank is empty.

20220827_160605

I use google nest hub, say: “hey google, coffee please” and DeLonghi turn on :slight_smile:

1 Like

Any of these machine have 2 coffee containers for both regular and decaf coffee beans?