This post has been updated to use the latest and greatest from Home Assistant. There are no more categories and things are MUCH more streamlined!
In this post I will cover how I use actionable notifications within Home Assistant. Using push notifications with the Home Assistant iOS App you can setup some really cool triggers within the system.
Below is a list of the technology used at the time of writing:
- Home Assistant - Version 2024.1.4
- Apple iPhone 13 Pro and iPhone 15 Pro
- Apple iOS 17.3
I have two actionable notifications that get used most often:
-
At 6AM I receive a push notification that asks if I am working from home today.
Yes
andNo
options are presented- If I answer
Yes
, it will turn on the AC in my office and set the proper temperature based on the temperature outside.
-
On days when my wife and I go into our “real” offices we will receive a notification when we leave in the evening and the house is set to away. This notification asks if you are headed home.
Yes
andNo
options are presented- If
Yes
is selected, it will set the air conditioner to the home setting to cool/heat the house in advance.
We will use my “Are you working from home today?” notification as the example[^1].
Step One:
I have an automation configured to send me a message asking if I am working from home on weekdays
at 6AM
if the house is in sleep
mode:
- alias: Ask if Dan is working from home in the morning - Weekday
condition:
condition: and
conditions:
- condition: state
entity_id: input_select.home_state
state: sleep
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
trigger:
platform: time
at: '06:00:00'
action:
service: notify.mobile_app_daniels_iphone
data:
message: "Are you working from home today?"
data:
actions:
- action: ‘WORKING_FROM_HOME_YES’
title: ‘Yes’
destructive: true
- identifier: ‘WORKING_FROM_HOME_NO’
title: ‘No’
Step Two:
This is where the rubber meets the road!
In this case the No
option does nothing. The notification will close on the phone and that is all. But, ‘Yes’ will trigger an automation in Home Assistant.
Here is the automation that is triggered when Yes
is selected:
- alias: iOS Action - Working From Home Yes
trigger:
platform: event
event_type: mobile_app_notification_action
event_data:
action: WORKING_FROM_HOME_YES
action:
- service: input_select.select_option
data:
entity_id: input_select.office_ac_power
option: 'on'
- service: input_select.select_option
data_template:
entity_id: input_select.office_ac_mode
option: >
{% if (states("sensor.dark_sky_temperature") | int) < 65 %}
heat
{% else %}
cool
{% endif %}
- service: input_number.set_value
data:
entity_id: input_number.office_ac_temperature
value: 72
Under the trigger event_data
you will see that the action
corresponds to the action
used in Step One. When Yes
was selected it kicked off the automation to turn on the AC in my office and set the mode based on the outside temperature. It has worked great!
IMPORTANT NOTES!
Interacting with Push Notifications:
When you receive a notification on you iPhone, do not just tap on it! This will open the Home Assistant app and not present your options!
You can, however, tap notifications on your Apple Watch. See explanations below:
On iPhone:
-
While phone is locked:
-
Your received notification will look like this:
-
Long press the notification to bring up the selection options
-
You will then be presented with your options:
-
-
While phone is unlocked:
-
Your received notification will look like this:
-
Swipe down on the notification and you will be presented with your options:
-
On Apple Watch:
-
Your received notification will look like this:
-
Tap the notification to receive your options:
Summary
This is covered often in the Home Assistant Community and I just wanted to get my configuration out in hopes that others will find it useful. If you have any questions feel free to leave a comment.
Thanks for reading!
No comment
Say something
Thank you
Your post has been submitted and will be published once it has been approved.
OK