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

Edit:

Found the solution. The Color option only works if it is not in a category which is silenced on the android phone.
Using another categorie fixed the problem. Just for your information if you run in similar problems


I really like your script. I just updated to the version 1.6.1 after running 1.1 before.

I have a problem with the icon color on my android device.

I have one script which works with the colors and another one which doesn’t. But I dont find the solution:

alias: Verbrauchs Notify
use_blueprint:
  path: samuelthng/notifications.yaml
  input:
    notify_device: 52859422b0df7431586319b2259f2758b
    title: Verbrauch für heute
    message: >-
      🔌: {{ (( states('sensor.verbrauch_daily_kwh') )) }} kWh \n\n ☀️: {{ ((
      states('sensor.solar_daily_kwh') )) }} kWh \n\n 🔥: {{
      ((states('sensor.gas_daily') )) }} qm
    enable_icon_color: true
    icon_color:
      - 102
      - 240
      - 125
    confirm_enabled: false
    dismiss_enabled: false

For any hints a will be thankful.

1 Like

Hey Sebastian,

Thank you very much for the kind words and also for posting the solution.

I’m currently working on some setup migration on my end so I won’t be able to test this case out for a couple of days.

I’ll test it out on my device as well once my setup is ready, and hopefully fix it. Otherwise, I’ll get it addressed/raised if it’s a bug with the Notifications implementation from either the blueprint or with the HA Companion app.

1 Like

Hey Samuel I just run into another issue. I am testing the “new” version with the image from the camera.

I trigger your script if my camera detects a person I send a snapshot. Some snapshots looking fine but others have an old image als content. So if I get an image and 1 minute after that I get the same image.

If I can debug anything just let me know.

Again thank you for your great work.

1 Like

Got it. Sounds like a caching issue to me from first impressions, will check it out as well but can’t promise much - I don’t have any cameras, will test with fake camera entities.

Thanks for your reply. Where can I find the images? I am struggeling to reproduce the issue.There is also the delay from the camera. So not easy to find out

The blueprint pulls the images directly from the camera entity’s attribute 'entity_picture’.

It’s supposed to be set by every camera entity and would come with a token specifically for external access.

You can try using Developer Tools :arrow_right: States, select a camera entity in the set states section. It will show you all the attributes on the entity, and you should find entity picture there as a relative path to the image.

I’m looking to trigger notification after a certain time. How can I set this up?
Ex: If lights were left on for more than 30 minutes, I will get a notification.

Thanks

Hello @hazio, this is a script blueprint. After creating the script for your notification, you can trigger it in any automation you require.

See How To Use for some pointers.

1 Like

:christmas_tree: Version 2.0: Fields!

:arrow_double_down: Import Version | :link: Github Link | :male_detective:t2: Compare Changes

Multi-device Variant:

:arrow_double_down: Import Version | :link: Github Link | :male_detective:t2: Compare Changes

:memo: What’s Changed

If you are already using Version 2 Beta 2, you may skip this release.

:warning: Service to Notify has been deprecated, stay on v1.6.1 if you rely on this option.

Existing scripts that do not use the above should not be affected this release. :crossed_fingers:t2: 🫳🏻 :wood:

  • :beetle: iOS Notifications with Camera Snapshots showing Failed to load attachment.
  • :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)

:question: How to update:

Home Assistant 2023.12 and up:

Before Home Assistant 2023.12:

: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
    • Version 2.0 - 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 - 12 Dec 2023

  • Fixed: iOS showing Failed to load attachment
  • Refactor: Build payload in templates
  • 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.

Hi @samuelthng, I am trying your blueprint for the first time and it looks amazing! My congratulations for the great work.

I’m just having a small problem and that is that I would like to group several related notifications (group) and be able to replace them with new ones (tag) as reminders.

I have created a new script using your Blueprint and just set a message, disabled the action buttons (option 1 and option 2) and set the Group ID field to “tasks” and Tag to “dishwasher”. Then, I run the script and, when I check the traces, I see that neither the group nor the tag are being sent.

What could be the problem?

Thanks in advance!

Hey @Deivy7,

Firstly, welcome to the community, thank you for your kind words!

Secondly, it’s a bug on the blueprint - a miss on my end after the last refactor.
Thank you very much for bringing this to my attention, really appreciate it!

Here’s a fixed version that should resolve the missing tag and group data:

:lady_beetle: Version 2.0.1: Missing Tag and Group!

:arrow_double_down: Import Version | :link: Github Link | :male_detective:t2: Compare Changes

Multi-device Variant:

:arrow_double_down: Import Version | :link: Github Link | :male_detective:t2: Compare Changes

:memo: What’s Changed

Existing scripts that do not use the tag and group fields should not be affected this release. :crossed_fingers:t2: 🫳🏻 :wood:

  • :lady_beetle: Fixed: Tag and Group were not being sent after the refactor.

:question: How to update:

Home Assistant 2023.12 and up:

Before Home Assistant 2023.12:

: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.1
    • Version 2.0.1 - Multi-device.
  • The tag and group property should now be set if you have them defined, you can verify this in the notification step of your trace.
2 Likes

Hi, just installed and completly love your scripts. simple to use, very powerful. AWESOME!

I got one question. how can i access the pictures which are attached to the push notification?
Where is it saved? How can i access this folder?

Thanks for your work and help!

1 Like

Hey @flrnwrzl, thank you for the kind words, makes the effort totally worth it!

The pictures from the camera entity are derived directly from it’s entity_picture attribute.
You can use this template to view the relative path to the image:

{{ state_attr('camera.<your_camera_entity_id>', 'entity_picture') }}

You can get the value of the attribute at this page:
Open your Home Assistant instance and show your template developer tools.

The result of the template will be a relative URL to the snapshot used in the blueprint.

Example:

  1. Home assistant URL: http://homeassistant.local:8123

  2. Entity: camera.roborock_g10_map

  3. Using the template:

  4. The image URL:
    http://homeassistant.local:8123/api/camera_proxy/camera.roborock_g10_map?token=<some_token>

Hope this helps!

P.S. Do keep the token private, it’s considered sensitive data.

1 Like

Hey @samuelthng ,

I just tested again and now the tag and group are working perfectly!
I’m going to start creating all my notifications with your blueprint.

Thank you very much for your quick response and hotfix! :blush:

1 Like

Wow thanks for the quick and detailed answer. I will try this weekend and give feedback. And maybe ask again if needed. But still amazed by this powerful script.

Maybe one thing as inspiration for a possible new feature in the fututre. The 1 thing I am missing is to add YAML code to message text. If this would work in the future…amazing.

Keep up the amazing work!

Thank you so much again! :saluting_face:

As for yaml code, if you meant to use templates in the message, we can do that right now, but it is a little less pretty due to interface user interface limitations.

Check out the preview section in this changelog for some examples of using templates in the scripts.

1 Like

Hello, so got it to work but as soon as I restart the token changes. is there a way to solve this? is there the possibility to save them somehow permanently?
Maybe save the snapshots to a www folder or so?

You can try the camera.snapshot service, this might be what you’re looking for. I have not used it myself, so won’t be able to advice much on it!

The service saves the image to a folder of your choosing if I’m not wrong. I don’t really like this method because if you’re accessing it externally it would be less secure than having the token attached.

Edit: @flrnwrzl oof sorry man, reply didn’t work somehow. So tagging you here instead.

Thanks.

Fore some reason when i try to send a notification with a snapshot of the camera attached using your script it takes too long to capture. So i never see whats happening.
I call the script in a automatiom when movement is detected via automation.

In different blueprint it works faster and very reliable. What can it be softwareside?

Yeah there can be differences based on how the integrations setup the entity’s image, or which source image is being used.

Do you have a link to the other blueprint? I could have a study to understand the mechanism used by the other blueprint, and if it’s more effective, could review having that as an optional alternative strategy.