This is a set of scripts / automations / other snippets for your Home Assistant configuration that enable you to postpone notifications and then have them automatically pushed to your phone when e.g. arriving home.
Some possible use cases for this set of snippets include:
- Sending any user at home a notification when the laundry is done.
- If no one is home, it does not make sense to send it out. But as soon as the first person arrives home, they can be notified about it.
- Sending any user at home a notification to empty the robot vacuum dustbin.
- A reminder to take out the thrash on pick up day.
- etc...
The set of files below has 2 main snippets of interest:
- Send pending notifications
- An automation that fires 5 minutes after someone arrives at home. This will fire all pending notifications and clear the queue.
- Append pending notification
- A script that takes the same arguments as a notification, but instead of sending it, it stores is in the pending notifications queue.
These are then used by, in my case, a wrapper script:
- Notify people at home
- A drop-in replacement for a
notify_mobile_<device>
service call that will notify any family member at home, or if none are at home, appends the notification to the queue.
- A drop-in replacement for a
Other files include the definition of the variable that stores the pending notifications queue, and a wrapper script for notifying a specific person (me / the wife). This just makes it all so much easier if one of us would get a new phone at some point.
- Home Assistant (duh)
- At least some knowledge about configuration in YAML
- A phone to notify
Neat! This is perfect! I've been looking for this a long time...
This is a very smart design, and if I read the documentation correctly, the template sensor state should be restored on HA restart, so notifications should not be lost. What a must!
I noticed a small typo: (scripts_append_pending_notification.yaml:32), I think
pending_notification_entity
is in factsensor.pending_notifications_when_away
I also had trouble with the
sensor
without the-
, but that was my fault to think it was misaligned.Thank you for your work.