How to push notification with icon

Hi,
When setting up a new notification, I get an error while configuring an icon/image in the message data:
The docs confuses me a bit, but According to documentation I should have 2 options: Introduction | Home Assistant Companion Docs and Standard Attachments | Home Assistant Companion Docs

In tried

the error:
extra keys not allowed @ data['icon_url']
extra keys not allowed @ data['attachment']

My code:

alias: Notify Doorbell rings
description: >-
  This automation triggers when the doorbell button is pushed and sends out a
  notification to our Apple iPhones
trigger:
  - platform: state
    entity_id:
      - binary_sensor.doorbell_doorbell_button
    to: "on"
condition: []
action:
  - service: notify.notify_all_iphones
    data:
      title: Deurbel
      message: Er staat iemand voor de deur.
      icon_url: https://xxxxx.duckdns.org:8123/local/images/Bell-Icon.png
mode: single

leaving that image part out, it works as expected (without image of course :wink: )

    data:
      title: Deurbel
      message: Er staat iemand voor de deur.
      data:
        icon_url: https://xxxxx.duckdns.org:8123/local/images/Bell-Icon.png

Make sure to check the docs and follow the examples closely. YAML is very specific with where things need to be.

thx @dshokouhi
I know the YAML is very strict and found that the GUI does some changes to the actual YAML and I did not read very well (meaning read it many times wrong / did not notice) … 2x data element…
Sorry, I’m embarrassed.

alias: Notify Doorbell rings
description: >-
  This automation triggers when the doorbell button is pushed and sends out a
  notification to our Apple iPhones
trigger:
  - platform: state
    entity_id:
      - binary_sensor.doorbell_doorbell_button
    to: 'on'
condition: []
action:
  - service: notify.notify_all_iphones
    data:
      title: Deurbel
      message: Er staat iemand voor de deur.
      data:
        icon_url: /local/images/Bell-Icon.jpg
mode: single

The code now does not error anymore and I get the message on the phone, though without icon.
I checked the local path (tested it on the front end) and is oke / showing as well, same for the full URL. Both showing the correct icon.

clues?

This feature is android specific, sorry should’ve mentioned that earlier.

https://companion.home-assistant.io/docs/notifications/notifications-basic/#notification-icon

https://companion.home-assistant.io/docs/notifications/notifications-basic/#android-specific

thx @dshokouhi
I’m sure I had this working (somehow) in the past…
Solved it like this (past an emoij directly in the text) :slight_smile:

alias: Notify Doorbell rings
description: >-
  This automation triggers when the doorbell button is pushed and sends out a
  notification to our Apple iPhones
trigger:
  - platform: state
    entity_id:
      - binary_sensor.doorbell_doorbell_button
    to: "on"
condition: []
action:
  - service: notify.notify_all_iphones
    data:
      title: Deurbel 🔔
      message: Er staat iemand voor de deur.
mode: single
2 Likes