Notifications are a well-liked characteristic of the Companion apps, however the variations between Android and iOS made it painful to make use of them to their full potential. Beginning with in the present day’s launch of iOS 2021.5, the overwhelming majority of performance is now shared throughout each platforms. As a part of this, the notifications documentation has been extensively up to date as effectively.
Constructing actionable notifications for iOS and watchOS now not requires defining classes prematurely of utilizing them; as an alternative, you possibly can embrace the actions proper within the notification. Assist for macOS will probably be included in a future launch. Classes had been one of many hurdles round multi-server help, so eradicating them fully solves that half!
Included within the documentation is the right way to migrate from classes to dynamic actions. Each are nonetheless supported within the app at the moment, however classes will probably be eliminated sooner or later.
# In a script's `sequence` or an automation's `actions` - alias: "Arrange motion variables" variables: # Together with 'id' in 'motion' permits us to establish this script run # and never unintentionally set off for different notification actions action_very: " 'VERY_' ~ context.id " action_mod: " 'MOD_' ~ context.id " - alias: "Ship the notification" service: notify.mobile_app_zac_iphone information: message: "Are you hungry?" information: actions: - motion: " action_very " title: "Very Hungry" - motion: " action_mod " title: "Reasonably Hungry" - alias: "Watch for a response" wait_for_trigger: # We look ahead to particular actions as a result of we do not need to run for # any motion, just for a response to the one we simply despatched - platform: occasion event_type: mobile_app_notification_action event_data: motion: " action_very " - platform: occasion event_type: mobile_app_notification_action event_data: motion: " action_mod " - alias: "Deal with the response" select: - circumstances: " wait.set off.occasion.information.motion == action_very " sequence: - service: notify.notify information: message: "⚠️ Soylent Launch Incoming" - service: homeassistant.turn_on goal: entity_id: change.soylent_dispenser - circumstances: " wait.set off.occasion.information.motion == action_mod " sequence: - service: notify.notify information: message: "Anybody need to seize a croissant? -Zac"
This works for each platforms with out together with any platform-specific logic! Different options round actionable notifications are additionally shared, together with including a URL to open when selecting an motion:
actions: - motion: "URI" title: "View Extra" uri: "/lovelace/some-dashboard"
Changing present notifications or threading sure notifications was one other distinction between platforms, and the iOS-specific variations had been a bit much less ergonomic, so the Android variations now work for each. Now you can use the easier
- service: notify.mobile_app_<your_device> information: message: "The entrance door is unlocked!" information: # substitute any present front_door_lock notifications tag: front_door_lock # thread with different doorways notifications group: doorways
You can too take away an present notification by its tag:
- service: notify.mobile_app_<your_device> information: message: clear_notification information: tag: front_door_lock
Attachments now not require sure classes for dynamic attachment, so you possibly can embrace streaming playback of a digicam for any notification:
- service: notify.mobile_app_<your_device> information: message: "Movement detected" information: entity_id: digicam.outdoors
Specifying a non-dynamic attachment is a bit of simpler now, permitting you to short-hand the attachment half:
- service: notify.mobile_app_<your_device> information: message: "3D Print Full" information: picture: /media/native/3dprinter/newest.jpg
You should use
picture is supported on Android.
You could have seen that iOS notifications have file limits; this launch provides on-demand downloading of attachments that exceed the scale restrict or when requested utilizing the
lazy attachment possibility.
We’re nonetheless looking out for locations of confusion or redundancy in notifications throughout the iOS and Android apps. What would you wish to see improved?