Manage Notifications πŸ“£ via: Custom Flexible Notifications

This Script is there to manage Mobile Notifications for the Home Assistant Companion App, coming with some considerable extra features, compared to the onboard functionalities.

:brain: This script solves two problems:

  1. You are getting Notifications in inconvenient situations?
    • Set up zones where you want unimportant notifications be skipped and reference the zones in the blueprint.
      • Examples: work, school, university, gym, …
    • Once the device leaves the zone, notifications will be delivered as normal
  2. Going on vacation/business trip and don’t want to get unimportant notifications?
    • Create a Helper Toggle-Switch*, reference it in the blueprint and turn it off in the Home Assistant User-Interface. This excludes the device from unimportant notifications delivered by this script.
      • Examples: empty battery, vacuum robot is stuck, appliance finished, …
    • Once the Toggle-Switch is turned on again, the device will be considered as normal.

* I know, this could be configuration within the blueprint. But the automation setup is only accessible for Administrators, not for regular users. In order to make it more accessible I decided to use input_boolean-Helper.

NOTE: The skipped notifications will NOT be queued and delivered after the person leaves the zone or the switch is turned on again. This means these notifications will simply be discarded for this device at this moment. Of course the device will be reconsidered in the next run of the script, if the switch is turned on again or the person is not in any excluded zone anymore.

:rotating_light: What about Critical Notifications?

Of course there are notifications, which should always be delivered. Therefore, additional checks are implemented to always deliver Critical notifications, even when:

  • The toggle-button is turned off
  • The device is in an excluded zone

Critical Notifications can be detected by a couple of identifies. For details about that, please take a look into blueprint options and the official Documentation of the Companion App.

NOTE: Critical can be sent to ALL DEVICES in Home Assistant (even those, who are not selected in this blueprint), using the notify.notify service.


:hammer_and_wrench: How to set up the Blueprint?

  1. Import the blueprint to your Home Assistant instance:
    Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.
  2. Click on Custom Flexible Notification (Script) and set up
    • which notifications are allowed to bypass the zone and toggle-button-logic
    • how critical notifications should be identified
    • per device:
      • which device should be notified
      • optional: a Helper Toggle-Switch, to disable the device temporary from the UI
      • a list of zones which should block sending notifications
  3. Update your existing automations to use the script-logic instead of selected devices or the notify-services. Here are two examples:

:pushpin: Open Topics

  • The Script is well tested with Android Devices. If anyone is finding problems with iOS Devices, feel free to optimize the blueprint and add a Pull-Request.


:heart: Like My Work?

ko-fi

3 Likes