🔔 Notifications - Actionable Mobile Notifications Script, with optional Timeout Feature and Camera Snapshots [works with iOS/Android]

I just wanted to say why I don’t use the HA notifications. I am happy with my Pushover integration. I have duplicated the notifies with different sounds, priorities and persons.

I do not use your blueprint. Not necessary to adjust your code (for me). BTW: I like your idea!

I am using an iPhone. No history in the companion app there. :disappointed:

1 Like

i was playing aroung with this script, and almost everyting is working, except the send to multipe mobile phons.
To get this working i tried to solve this using a group made in the config.yaml:

notify:
  - platform: group
    name: alle_mobieltjes
    services:
      - service: mobile_app_nothing_phone_2_pim
      - service: mobile_app_a065

When i test this by calling the servive from the developrs tools, its working fine, but when i tried to use this in the "Service to notify " like : notify.mobile_app_alle_mobieltjes it tells me that it failed to call the service unable to find service.
So what did i do wrong :thinking:

Hey @TheCosmicGate, thanks for trying out the script.

Unfortunately, the script really isn’t intended for sending to more than one device as that would interrupt with the timeout functionality (which is a core feature).

However, if you still do want to proceed, you can refer to this post where Joseph has kindly shared his modifications based off an earlier version of the script.

I think that his modification is very elegant and would work well with the latest version of the script to send to multiple devices.

Edit:

:test_tube: Experimental: Version 1.6.1 - Multi-device

:link: Github Link | :male_detective:t2: Compare Changes | :question: How to update
See historical changelogs here.

:memo: What’s New

Since this has been requested quite a few times, here’s a variant of the blueprint that sends notifications to multiple devices.

  • :busts_in_silhouette: Send notifications to multiple devices.

:mag_right: Things to check after updating:

  • As usual, existing scripts should be loaded.
  • Script should show Version 1.6.1 - Multi-device .
  • Check the Device(s) to notify field.
🙋🏻‍♂️ Show/Hide: Help - I can't see any device selection in the `Device(s) to notify` field.
  1. Edit your script in yaml mode
    image

  2. Remove the notify_device field in the yaml
    image

  3. You should see the dropdown selectors now after switching back to the visual editor.

Version 1.6.1 Multiple Device - 31 Oct 2023

  • Added: Experimental Multiple Device Support
2 Likes

Hey thanks so much for creating this! I tried it out and it works great!

One issue I was facing is that an attachment seems to be added even when the “Attachment Type” is set to None, at least on iOS. This results in a failure message in the notification:

Any idea if this is an issue with the blueprint or in my configuration? Thanks for the help!

1 Like

Thank you very much, will try this tonight!

1 Like

Hey @CurryBay, firstly, welcome to the community and thank you for reporting the issue!

I wasn’t able to reproduce the issue when Attachment Type: None.
When set to None, notifications do not include image thumbnails as expected on macOS and iOS.
Do try to set it to None again, save the script and do let me know how that goes for you.

I can however reproduce the Failed to load attachment issue, it has got to do with an Android vs iOS compatibility thing. Might have to add an option to attachment type for restricting options being sent to iOS devices… :sob:

Will look into different strategies to workaround this issue over the next few weeks. :+1:t2:

I don’t suppose that there is such a thing as a syntax checker?

In a lot of other languages there is some kind of debug available to tell you which line, or even which character, it the problem.

I get the feeling that I’ve got a tab or something in the wrong place or some other silly thing like that.

There is but since it’s out of the scope of this blueprint, I’ll message you some links directly instead.

Hey @CurryBay,

I’ve come up with a solution that should not break anything and don’t require any additional input from your end. These are experimental right now so it’s understandable if you’d prefer to avoid it.

:test_tube: Experimental: Version 2.0 Beta 1

:link: Github Link | :male_detective:t2: Compare Changes | :question: How to update
See historical changelogs here.

Multi-device Variant:

:link: Github Link | :male_detective:t2: Compare Changes | :question: How to update

:memo: What’s Fixed

Existing scripts should not be affected this release. :crossed_fingers:t2:🫳🏻🪵

  • :beetle: iOS Notifications with Camera Snapshots showing Failed to load attachment.
    Many thanks to @CurryBay for bringing this to my attention.

:mag_right: Things to check after updating:

  • As usual, existing scripts should be loaded.
  • If you have switched between either variants, check out this reply.
  • Script should show Version 2.0 Beta 1 or Version 2.0 Beta 1 - Multi-device.

Hey @samuelthng,

Thanks for the quick reply! I’ve tested the experimental version and it works, there isnt any Failed to load attachment message now!

Thanks for the quick and excellent work, well done!

1 Like

@samuelthng Thanks so much for putting this together. This is insanely useful for making my notifications easier to manage!

I might have missed it, but I’m looking for a way to pass variables/arguments from my automation into the script.

For example, I’d like to set up a single script for garage door notifications, with my message being something like '{{garage_door_name}} is now {{garage_door_state}}.', of which I can pass both of these in from the automation, so I don’t need to author multiple separate scripts for each state change.

Is this possible and am I just overlooking something that has already been documented? Thanks!

Hey there @andyrak, thank you for trying out the script. It is not possible right now but it’s also something I’m looking at.

Who knows, your question might just motivate me to add it in faster. :rofl:

P.s. 2023.11 also blessed us with this. :partying_face:

2 Likes

Delivery! @andyrak :sweat_smile:

Again this is experimental - I’m still testing out quirks of fields, totally understandable if you want to give it some time to become stable.

:test_tube: Experimental: Version 2.0 Beta 2

:link: Github Link | :male_detective:t2: Compare Changes | :question: How to update
See historical changelogs here.

Multi-device Variant:

:link: Github Link | :male_detective:t2: Compare Changes | :question: How to update

:memo: What’s Changed

Existing scripts should not be affected this release. :crossed_fingers:t2:🫳🏻:wood:

  • :oncoming_automobile: Android: Added Show on Android Auto option.
  • :hourglass: Enable Timeout Action(s) option to dynamically disable timeout actions
  • :scroll: Fields Support Added! (requires Home Assistant 2023.11 or newer)

:mag_right: Things to check after updating:

  • As usual, existing scripts should be loaded.
  • If you have switched between either variants, check out this reply.
  • Script should show one of:
    • Version 2.0 Beta 2
    • Version 2.0 Beta 2 - Multi-device.

:eyes: Preview:

Show/Hide: Script Fields Preview


Show/Hide: Script Fields with Templates


Example payload:

service: script.my_test_notifications
data:
  field_title: >-
    {{ state_attr("sun.sun", "friendly_name") }}
  field_message: >-
    {% if is_state("sun.sun", "above_horizon") -%}
      The sun rose {{ relative_time(states.sun.sun.last_changed) }} ago.
    {%- else -%}
      The sun will rise at {{ as_timestamp(state_attr("sun.sun", "next_rising")) | timestamp_local }}.
    {%- endif %}

Result:


Show/Hide: Script Fields in Automations with Templates


Version 2 Beta 2 - 2 Nov 2023

  • Deprecated: 📲 Notification Strategy due to refactor.
  • Deprecated: 📲 Service to notify due to refactor.
  • Added: Support for fields
    • Added: 🏷️ Title field
    • Added: 💬 Message field
    • Added: 🏷️ Subtitle field
    • Added: 📸 Attachment: Camera Entity: Camera Entity field
    • Added: Options show/hide fields
    • Added: ⌛️ Enable Timeout and ⌛️ Enable Timeout Action(s) fields.
  • Added: 🚘 Show on Android Auto option.
  • Added: ⌛️ Enable Timeout Action(s) option and field.

Notes:

  • When enabling boolean fields with value of false, be sure to toggle them to true once, and then to false.
    There seems to be a bug where the boolean value is not passed if it’s enabled and value is false without the toggle.
  • If you rely on 📲 Service to notify, do not upgrade, Version 1.6.1 will be the last version supporting that feature.
2 Likes

Thank you, installed version:
Home Assistant 2023.6.1
Frontend 20230608.0 - latest

Hey @trobnc, I’m certain it is due to the version now.

If you cannot update, you may try Version 1.4 or earlier.

Ask and ye shall receive, eh?

Cheers for the update! This is exactly what I was looking for!

Works like a charm.

The automation visual editor doesn’t support templates, so it’s not as “prettty”, but that’s no fault of yours.

For anyone else that comes in here and wants their message to be dynamic per automation trigger entity and state, here’s my snippet:
{{trigger.to_state.attributes.friendly_name}} is now {{trigger.to_state.state}}.

2 Likes

Thank you, this certainly was the issue!

1 Like

Welcome, happy to help! Hope you managed to resolve it!

Hi All,
I have created a Notify Group like this:

notify:
  - name: ALL_DEVICES
    platform: group
    services:
      - service: mobile_app_marcolinos21
      - service: mobile_app_s21anto

but when I select Device to Notify I have not the group I created:

Is there a way to send same notification to more than one device?

Thanks

Hey @marcolino7,

Multi-device is not officially supported at this point as it will interfere with the experience of the timeout feature for each device at this time.

However, you can find a “Multi-device” variant of the script (not groups, select each device individually).

You can find my experimental variants of the script :link: here.

1 Like