EPMatt / awesome-ha-blueprints

A curated collection of automation blueprints for Home Assistant.
https://epmatt.github.io/awesome-ha-blueprints
GNU General Public License v3.0
824 stars 242 forks source link

Bug - Send Web UI persistent notifications to Mobile Devices doesn't work #288

Open ElVit opened 2 years ago

ElVit commented 2 years ago

Blueprint name

Send Web UI persistent notifications to Mobile Devices

Home Assistant Core Version

2022.3.5

Home Assistant Installation Type

Home Assistant Operating System

Description

Blueprint doesn't work with the iOS Home Assistant App. The persistent notifications are not forwarded to my iPhone. But I can send a notification to my iPhone by sending notify.mobile_app_myiphone.

Automation YAML config

id: '1643998917699'
alias: Update notification to all iPhones
description: ''
use_blueprint:
  path: EPMatt/persistent_notification_to_mobile.yaml
  input:
    mobile_notify_service: notify.mobile_app_myiphone
    notification_id: '1234'

To Reproduce

  1. Create automation with this blueprint. Define only mobile_notify_service and notification_id = 1234
  2. persistent_notification.create (with messgae, title & notification_id = 1234)
  3. -> no notify message on my iPhone
  4. notify.mobile_app_myiphone (with message & title)
  5. -> I can see a notification message on my iPhone

Expected behavior

All persistent notifications with the ID="1234" shall be forwarded to my iPhone.

Actual Behaviour

I don't get any notifications to my iPhone. I get the follwing error in trace step details: Error: Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

Additional Details

Screenshots

No response

Additional context

No response

EPMatt commented 2 years ago

Hi @ElVit,

thank you for reaching out here, I'm sorry for my huge delay. It seems the event is not properly recognized after the automation has been triggered. Could you please share screenshots from the HA trace tool regarding the automation you're setting up with this blueprint?

Thank you for your patience!

Xx-Ness-xX commented 2 years ago

Hello,

I have the exact same error message, and my notification ID is set to http-login, see the details below:

Screenshot_20220708-154248

Blueprint name

Send Web UI persistent notifications to Mobile Devices

Home Assistant Core Version

2022.3.9

Home Assistant Installation Type

Home Assistant Core

Description

Blueprint doesn't work with the Android Home Assistant App. The persistent notifications are not forwarded to my Android. But I can send a notification to my Android by sending notify.mobile_app_pixel_5.

Automation YAML config

id: '1631811045862'
alias: Invalid login attempts notifications to Mobile Devices
description: ''
use_blueprint:
  path: EPMatt/persistent_notification_to_mobile.yaml
  input:
    mobile_notify_service: notify.mobile_app_pixel_5
    notification_id: http-login

To Reproduce

  1. Invalid login attempts
  2. persistent_notification.create
  3. -> no notify message on my Android
  4. notify.mobile_app_pixel_5 (with message & title)-> I can see a notification message on my Android

Expected behavior

All persistent notifications with the ID="http-login" shall be forwarded to my Android.

Actual Behaviour

I don't get any notifications to my Android. I get the follwing error in trace step details: Error: Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

Additional Details

Screenshots

No response

Additional context

No response

Xx-Ness-xX commented 2 years ago

Hi

any update on this? Thanks

Fruitsmart commented 8 months ago

Hello i have the same mistake. Core 2023.12.3 Supervisor 2023.11.6 Operating System 11.2 Frontend 20231208.2

niemtec commented 8 months ago

I've noticed the same issue in my setup 😞

niemtec commented 8 months ago

I was able to create a dummy automation with the following action and it worked:

service: notify.mobile_app_xxx
data:
  message: "{{ trigger.notification.message }}"
  title: "{{ trigger.notification.title }}"
Xx-Ness-xX commented 8 months ago

I was able to create a dummy automation with the following action and it worked:

service: notify.mobile_app_xxx
data:
  message: "{{ trigger.notification.message }}"
  title: "{{ trigger.notification.title }}"

Hi, could you please elaborate how you get this to work?

Fruitsmart commented 8 months ago

Error rendering data template: UndefinedError: 'trigger' is undefined

grafik

niemtec commented 8 months ago

Hi, could you please elaborate how you get this to work?

Sure, I created a new automation that is triggered on "When persistent notification is updated" and set the above as a call service action.

So the automation looks like so:


alias: Notification Forward
description: ""
trigger:
  - platform: persistent_notification
    update_type:
      - added
      - updated
      - current
    notification_id: ""
condition: []
action:
  - service: notify.mobile_app_jakubs_iphone_15
    data:
      message: "{{ trigger.notification.message }}"
      title: "{{ trigger.notification.title }}"
mode: single
niemtec commented 8 months ago

@Fruitsmart it won't work in developer tools this way because trigger only exists in automation space.

Fruitsmart commented 8 months ago

@niemtec Thank you very much, it's working perfectly. I thought I could test it in the developer tool. Thanks for that!

niemtec commented 8 months ago

@Fruitsmart glad it's working for you! Sorry, I could have been clearer with my initial comment... and maybe not type it out on a phone 😅

Fruitsmart commented 4 months ago

@niemtec "Hi, does this automation still work for you? I'm getting the following error."

Error rendering data template: UndefinedError: 'dict object' has no attribute 'notification'

image

niemtec commented 3 months ago

@niemtec "Hi, does this automation still work for you? I'm getting the following error."

Error rendering data template: UndefinedError: 'dict object' has no attribute 'notification'

image

Yeah still works