Error using attachment in notification

Hi all,

I’ve been trying to google how to do this and I thought I got it right but apparently didn’t.

What I want to do:

Get a notification on my phone when someone is detected at the door and include a still from my reolink camera.

What I did so far:

Found a way to send a jpg file to the home assistant file system using FTP. This bit is working fine, I can see the file gets updated anytime I walk by the camera

Created an automation in home assistant sending a notification to my phone anytime the the human detection turns on on the reolink camera. This bit works fine as well, I can get a standard notification telling me someone is at the door.

I however cannot get the jpg file to display in the notification. In the traces from my automation, I get the following error:

Stopped because an error was encountered at September 15, 2023 at 11:15:41 PM (runtime: 0.01 seconds)

extra keys not allowed @ data[‘attachment’]

This is the full yaml automation

alias: Front Porch - Human detection notification
description: Sends notification to  phone if someone is detected at the door
trigger:
  - type: turned_on
    platform: device
    device_id: 092524197ea1fcdbc21a116f6cf7886d
    entity_id: 99abd7ebd2ee2ddeea766132c19e732b
    domain: binary_sensor
condition: []
action:
  - service: notify.mobile_app_pixel
    data:
      message: Someone is at the door
      data:
        attachment:
          url: /media/reolink/2023/09/FrontPorch.jpg
          content-type: JPEG
          hide-thumbnail: false
mode: single

What am I doing wrong?

The documentation says:

So I assume that the correct URL is:

/media/local/reolink/2023/09/FrontPorch.jpg

In the meantime I tried this with my installation. It did not work when using /media or /media/local. I don’t know why. I then stored the snapshot in the /config/www directory and that worked. Files in /config/www are accessed using the /local directory. Here is my code that worked.

  - service: notify.mobile_app_sm_s916b
    data:
      message: Someone is at the door
      data:
        image: "/local/snapshot.jpg"

Note, there is also no “attachment” key bering used and instead of URL I used “image” . Your device ist called “pixel” so I assume you are using Andoid. But your code has specifics for Apple. So I’m a bit confused. I’m using a Android mobile so my code works for Andoid devices.

Thanks. I will try your code instead. I do indeed use android. I didn’t realize the code snippets I’ve used would be for iOS. I’ll give yours a try. Many thanks!

Many thanks @starob, It fixed my issue! You’re a rockstar!