Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Config Support]: How to pass images (snapshot/thumbnail) to other notification types (namely SMTP) #50

Open
jamesb2147 opened this issue Jun 14, 2023 · 16 comments
Labels
Awaiting Response Further information is requested enhancement New feature or request

Comments

@jamesb2147
Copy link

Describe the problem you are having or the outcome you are trying to achieve.

I am attempting to pass the image as an attachment to an already-configured SMTP integration setup as notify.email. It appears that all the Frigate integration seems to work fine, like the events trigger and we can see in the trace timeline that it's generating a link to an image.

Overall for email, text seems to work fine, for what it's worth, as I can control both the Subject and Body. It's just that the image attachment part doesn't come through.

Version

0.12.0.1

Automation config file

alias: Frigate Notifications (0.12.0.1)
description: ""
use_blueprint:
  path: SgtBatten/Stable.yaml
  input:
    camera: camera.back_porch
    notify_group: notify.email
    title: Person sighted
    message: >-
      A {{ label }} {{ 'is loitering' if loitering else 'was detected' }} on the
      {{ camera_name }} camera{{ ' in the ' + entered_zones if entered_zones
      else '.'}}
    attachment: snapshot
    debug: true

Frigate Config

No response

Any other information that may be helpful

Here's some trace info from a DEBUG level event where you can see some of the required info coming through:

Frigate Notification () DEBUG: Info: fps: 5, frigate event id: 1686784172.22988-elye99, object (formatted): person (Person), Config: camera(formatted): back_porch(Back Porch), Base URL: , critical: False, alert once: False, Update Thumbnails: False, Target: group (input/formatted): notify.email/email, cooldown: 30s, loiter timer: 0s, color: steelblue, sound: default, Title: Person sighted, Message: A Person was detected on the Back Porch camera., tap_action: /api/frigate/notifications/1686784172.22988-elye99/back_porch/clip.mp4, button 1 Text/URL: View Clip (/api/frigate/notifications/1686784172.22988-elye99/back_porch/clip.mp4), button 2 Text/URL: View Snapshot (/api/frigate/notifications/1686784172.22988-elye99/snapshot.jpg), button 3 Text/URL: Silence New Notifications (silence-back_porch), icon: mdi:home-assistant tv: False, tv_position: center, tv_size: large, tv_duration: 10, tv_transparency: 0%, tv_interrupt: False, Filters: Zones: zone filter toggle on: False, Multi Zone toggle on: False, Required zones: [], Entered Zones: [], Zone Filter TEST: PASS, Required objects TEST: Input: , TEST: PASS presence entity (not home): Entity: TEST: PASS, disabled times: [], State Filter: state filter toggle on: False, state filter entity: , required states: [], State Filter TEST: PASS,

@jamesb2147
Copy link
Author

LMK if you need the full automation config or anything. Here's the SMTP config, in case it helps:

notify:
  - name: "email"
    platform: smtp
    server: "smtp.mailgun.org"
    port: 587
    timeout: 15
    sender: "postmaster@mg.foobar.com"
    encryption: starttls
    username: "postmaster@mg.foobar.com"
    password: "foo-bar"
    recipient:
      - "foo-bar@googlegroups.com"
    sender_name: "Home Assistant"

@SgtBatten
Copy link
Owner

Can you give an example of how you would send an image link if not using the blueprint

@jamesb2147
Copy link
Author

Per the docs ( https://www.home-assistant.io/integrations/smtp ) and a quick test in the dev tools, you set it in the data section as "images".

image

@SgtBatten
Copy link
Owner

SgtBatten commented Jun 17, 2023

Okay so we probably just need to add a images line to the data block in each notify section 6 or 8 places or something. Should be simple. If you have a moment so do a pull request that would be great. Otherwise I'll get to it when I can

@SgtBatten SgtBatten added the enhancement New feature or request label Jul 1, 2023
@SgtBatten
Copy link
Owner

@SgtBatten
Copy link
Owner

@jamesb2147 any word?

@jamesb2147
Copy link
Author

Just put it into testing. Should be able to get back to you this week.

@jamesb2147
Copy link
Author

Unfortunately, that doesn't seem to have made the images available. On the web, I don't see any indication of a picture in the email or attachment, but on mobile I get a "broken image" icon in the Gmail app. Looking at the "original message" on the web, I do spot it trying to do something:
image
Not sure how/where that's breaking though. You're confident the URL is valid?

@SgtBatten
Copy link
Owner

Two thoughts. Try with attachment set to thumbnail instead.

If no good, try the latest version on the smtp branch where i have added a baseurl to the url.

The url is the same as we use for all other notifications, so it is valid, but maybe not compatible with smtp.

@SgtBatten
Copy link
Owner

any luck @jamesb2147

@SgtBatten SgtBatten added the Awaiting Response Further information is requested label Aug 24, 2023
@sm0keKings
Copy link

Hi SgtBatten. I was reading this thread as I would like to use your blueprint to notify by email. Have you had any progress? When I look at your beta it only has Notification to Mobile Device and Android TV / Group. Thanks

@SgtBatten
Copy link
Owner

The SMTP things are win a seperate branch to keep them seperate during testing. Did you want to try it?

@sm0keKings
Copy link

The SMTP things are win a seperate branch to keep them seperate during testing. Did you want to try it?

Yes please i would love too!

@SgtBatten
Copy link
Owner

Sorry I don't need to do anything, it's just there, you need to change the branch to SMTP, or click this link https://github.com/SgtBatten/HA_blueprints/tree/smtp

You'll need to manually copy the blueprint into home assistant

@sm0keKings
Copy link

Sorry I don't need to do anything, it's just there, you need to change the branch to SMTP, or click this link https://github.com/SgtBatten/HA_blueprints/tree/smtp

You'll need to manually copy the blueprint into home assistant

Got it working! Thanks heaps for your help.

@SgtBatten
Copy link
Owner

Please let me know how it works for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Response Further information is requested enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants