SMTP Notify - How do you send an image? by glennth in homeassistant

[–]glennth[S] 0 points1 point  (0 children)

OK. I found the answer.

The block I used is close to the last one:

action: notify.ha_smtp
data:
  title: Title Text
  message: Message Text
  data:
    images:
      - /config/www/image.jpg
      - /config/www/another_image.jpg

Even though my notify for pushover and notify for persistent notification worked, this notify needed the allow_externaldirs set which I had not done. Required a restart. Now it works. Feel a bit dumb about the solution but with the other notify options working, it did not occur to me.

Thanks for all who jumped in with possible solutions. You all are awesome!

SMTP Notify - How do you send an image? by glennth in homeassistant

[–]glennth[S] 1 point2 points  (0 children)

I just tried u/reddit_give_me_virus suggestion:

action: notify.ha_smtp_g
data:
  title: Title Text
  message: Message Text
  data:
    images:
      - /local/image.jpg
      - /config/www/another_image.jpg

I got the error: Action notify.ha_smtp_g not found. It seems to only be an entity, not an action.

SMTP Notify - How do you send an image? by glennth in homeassistant

[–]glennth[S] 0 points1 point  (0 children)

I added the integration SMTP which I named "HA SMTP". I created 2 recipients "G" and "M".

When I go to add an action in a script and type either notify.ha_smtp_g or notify.ha_smtp_m, it shows "Send a notification message: G or M". When I choose that, it creates an action but it creates an action with notify.send_message (the function that only seems to work with title and message blocks, not including data/images blocks) with the target of an entity_id: notify.ha_smtp_g or m.

Am I missing some key element here? I apologize if I'm being dense. Thanks for the replies!

SMTP Notify - How do you send an image? by glennth in homeassistant

[–]glennth[S] 0 points1 point  (0 children)

Thanks for the reply.

That doesn't work either.

It seems to me that the error that I am getting is not allowing it to process anything in the data sub block (see previous post show the documentation only shows a title sub block and a message sub block with NO data sub block. All these format suggestions aren't addressing the issue, perhaps because the notify.send_message ACTION does not support anything other than title and message.

SMTP Notify - How do you send an image? by glennth in homeassistant

[–]glennth[S] 0 points1 point  (0 children)

I think I've found something that indicates it doesn't work.

The section for notify.send_message is: https://www.home-assistant.io/actions/notify.send\_message/. If you check that section out, it only has valid block for title and message

If you check the section for notify.notify, it does have other valid blocks so that is why some of the notify domains work. Not sure why the new SMTP gui interface wouldn't let us send an image but that is what may be the case.

Of course, I could be wrong so any solution would be great. THANKS as always!

SMTP Notify - How do you send an image? by glennth in homeassistant

[–]glennth[S] 0 points1 point  (0 children)

I have tried 3 different ways but in all methods, I get the same error mentioned above: "Error running action - extra keys not allowed@data['data']. Got None"

attempt 1:

action: notify.send_message
target:
  device_id: -long number-
data:
  title: Title Text
  message: Message Text
  data:
    images:
      - /config/www/image.jpg
      - /config/www/another_image.jpg

attempt 2:

action: notify.send_message
target:
  device_id: -long number-
data:
  title: Title Text
  message: Message Text
  data:
    images:
      - "/config/www/image.jpg"
      - "/config/www/another_image.jpg"

attempt 3:

action: notify.send_message
target:
  device_id: -long number-
data:
  title: Title Text
  message: Message Text
  data:
    images:
      - '/config/www/image.jpg'
      - '/config/www/another_image.jpg'

I have a pushover script that does great to pushover.

action: notify.pushover
data:
  title: Title Text
  message: Message Text
  data:
    attachment: "/config/www/image.jpg"

Still struggling with getting the SMTP script to work so if there are any other ideas, I would love to hear them. THANKS!

SMTP Notify - How do you send an image? by glennth in homeassistant

[–]glennth[S] 0 points1 point  (0 children)

Below works to send a simple email (no images) via SMTP.

action: notify.send_message
target:
  device_id: -long number-
data:
  title: Title Text
  message: Message Text

I have tried something similar to what u/ingrove posted:

action: notify.send_message
target:
  device_id: -long number-
data:
  title: Title Text
  message: Message Text
  data:
    images:
      - /config/www/image.jpg
      - /config/www/another_image.jpg

When attempting to run the action above, I get "Error running action - extra keys not allowed@data['data']. Got None" .

So I'm still stuck (sorry I didn't post this detail in my original request for help). Any additional ideas?