Home Assistant scripts and automations to postpone mobile phone notifications and deliver them when the recipient returns home. Also create advanced (e.g. actionable) notifications within the visual editor.
- Works with personalized notifications. For broadcasting style notifications (recipient is not predetermined but selected based on their location) something like iq_notify might be a better solution.
- Change device information at only one location when people in your home change devices.
- Create mobile app notifications in scripts and automations using the visual editor (without yaml):
- Basic notifications with
title
,message
anddata
. - Actionable notifications:
- With two customizable actions and up to two automatic postponement options.
- Allow parallel notifications without blocking behavior.
- Time out script instances waiting for user interaction.
- Clear notifications after corresponding scipt instance timed out.
- Stop waiting script instances when notification is replaced.
- uri values.
- iOS specific options.
- Attatchments.
- Clearing.
- Critical Notifications.
- Notification Commands:
- request_location_update
- clear_notification
- iOS specific Notification Commands.
- Android specific Notification Commands.
- Grouping.
- Opening a URL.
- Replacing.
- Sounds.
- Subtitle/ Subject.
- Basic notifications with
- Automatically add
Remind me at home
button to notifications delivered when recipient is not home (❗not fully tested). - Automatically add
Remind me later
andRemind me tomorrow
button to notifications delivered when recipient is home (❗not fully tested). - Queue postponed notifications for later delivery.
- Deliver queued notifications when recipient returns home.
- Deliver notifications after user queued them for later delivery.
- Add an action to a automation or script and select the notify script.
- Configure your notification using the visual editor.
- Add the template sensor from sensor_pending_notifications_when_away.yaml to your
configurations.yaml
. - Create a scipt with the content of script_parallel_notification_helper.yaml
- Create a scipt with the content of script_notify.yaml. Make sure to change:
fields
:people
:options
add the names of your users here.- Add the
device_id
s, names and device OS for those users to:sequence
:[1]
:variables
:users
- Create an automation with the content of automation_notify_people_when_they_are_getting_home.yaml.
- Make sure to change the triggers to represent your home:
- The automation should trigger when people come home.
- The automation should trigger regularly so notifications postponed by the user with the
Remind me later
button are delivered. - I added an
input_button
helper to clear pending notifications in case something goes wrong. This is not needed since the action could be triggered from the automation editor or development tools too.
- Make sure to change the conditions for the second choose to represent your home:
{{ (as_timestamp(now()) - as_timestamp(state_attr("automation_notify_people_when_they_are_getting_home","last_triggered"))) | int(0) > 600 }}
makes sure the automation does not run when it was triggered within 5 minutes prior.- The second condition avoids automation runs when there are no pending notifications. Duh...
- All the other conditions are specific to my home. If you don't have similar entities you can simply delete those conditions:
- I use the custom template sensor
binary_sensor.home_jemand_zuhause
as condition to any automation that should only run when someone is home. input_boolean.home_state_gast_modus
is a helper so thebinary_sensor.home_jemand_zuhause
can set tohome
manually in case guests are staying at the house (without my wifes or mine phone present) and stuff like heating has to work.input_boolean.home_state_schlafen
andinput_boolean.home_state_nsdr
will be set automatically when someone is sleeping so shades and stuff don't move unexpectedly
- I use the custom template sensor
- Make sure to change the triggers to represent your home:
- Add option for automatic actions
Remind me later
,Remind me tomorrow
andRemind me at home
instead of always adding them. - Implement Android specific Notification Cleared.
- Add URL-Selector for lovelace pages.
This project was inspired by Simon42. The scripts and ideas are heavily based on Pending / Postponed notifications by RoboMagus.
Thank you to the Home Assistant Developers and Community! ❤️