Quick demo on how I made a coffee request button on my Home Assistant alarm clock.

As mentioned on the other post, we charge our phones in the living room, so if someone is sleeping in there is no way for them to signal that they’re awake and would welcome a morning coffee. So I added a button on our alarm clock to do just that.

My Home Assistant clock showing the coffee button

My Home Assistant clock showing the coffee button

I created a new Home Assistant switch in Node Red and added a button on my clock screen that switches it on. I configured a Node Red call service node send a notification to our phones when the switch is turned on.

Node Red config

Node Red config

The notification has an action button to acknowledge the alert, which clears the alert from both phones and turns the switch back off.

// json for Android notification via Node Red

{
    "message": "coffee pls",
    "title": "It is time",
    "data": {
        "actions": [
            {
                "action": "COFFEE_ACK",
                "title": "I'm on it!"
            }
        ],
        "TTL": 0,
        "priority": "high",
        "tag": "coffee",
        "persistent": "true"
    }
}
# yaml for Home Assistant automation to acknowledge the coffee request 

alias: Acknowledge coffee
description: ""
trigger:
  - platform: event
    event_type: mobile_app_notification_action
    id: Coffee acknowledge
    event_data:
      action: COFFEE_ACK
condition: []
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.coffee
  - service: notify.me
    data:
      message: clear_notification
      data:
        tag: coffee
    alias: Clear me
  - service: notify.you
    data:
      message: clear_notification
      data:
        tag: coffee
    alias: Clear you
mode: single

On my clock page, holding down the coffee button will also trigger the acknowledge automation, so sleepy fingers dont do it accidentally.

# yaml for the coffee button

type: custom:mushroom-entity-card
entity: switch.coffee
icon: mdi:coffee
icon_color: blue
tap_action:
 action: call-service
 service: switch.turn_on
 target:
   entity_id: switch.coffee
 data: {}
hold_action:
 action: call-service
 service: automation.trigger
 target:
   entity_id: automation.acknowledge_coffee
 data:
   skip_condition: true
fill_container: true
secondary_info: state

After using this for a couple weeks I realised I could also get it to make an announcement on our Google Home, so i added that in via Node Red too. This is handy for when the person doesnt happen to be near their phone.

This has transformed my HA alarm clock from a gimick into a very useful item. The new coffe button gets used a couple times a week now ☕