This script allows you to specify the title, message, unique persistent notification ID, the dismiss text, and timeout, in minutes, of a notification that is sent to all mobile devices and the HA dashboard.
Actions can be specified for when the notification is dismissed, these actions work both from the mobile notification or HA notification.
Optional actions are also specified for when the notification timeout is reached.
This was created as a sleep timer notification for my TV, but I'm sure there are many other use cases where this would come in handy.
Not having to list every device and being able to still access the notification through the mobile app or HA helps with accidental notification clearing or misses on mobile devices.
If you find a bug or want something added, let me know!
UPDATE 1: The original link posted was broken. The current one is tested and works to import!
UPDATE 2: I ran into issues using the notify.notify service where the notifications just weren't coming through on my mobile apps anymore. This is addressed in the documentation. Whoops!
UPDATE 3: Both scripts are now optional. If no script is specified, no actions are taken.
Instructions below
The new and improved version actually uses 2 notify groups that you must create in the configurations.yaml file. It should look like this:
#notification groups
notify:
#all mobile devices group
- platform: group
name: notify_all_mobile_devices
services:
- service: mobile_app_device_id_1
- service: mobile_app_device_id_2
#all devices group
- platform: group
name: notify_all_devices
services:
- service: mobile_app_device_id_1
- service: mobile_app_device_id_2
- service: persistent_notification
PLEASE READ BEFORE USE
Important information:
- The 'name' value can be anything you want, but these make the most sense to me. Make sure to only use lower case and underscores. Like entity id's.
You MUST match the names in the respective script inputs otherwise things might get weird. - You will need to find your unique device id for each phone or watch you want included. This is found by going to the 'Mobile App' integration under settings in HA.
- To add more devices, simply add more lines, following the same pattern.
- 'persistent_notification' is what notifies the HA app on the side panel itself. There is only one.
- The new version only accepts a script as the dismiss action and an optional timeout script if the notifications aren't dismissed.
Features:
- If you dismiss a notification in one place, it will automatically dismiss it everywhere else like magic!
- ALL notifications are automatically dismissed once the timeout is reached!
- Any new notifications coming from the same script will automatically overwrite the old ones to avoid duplicates.
- Custom channels can be set to allow for custom notification behavior per script.
Disclaimer: Not all features available on iOS.