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

local image doesn't appear to work #1

Open
zombiehoffa opened this issue Jul 24, 2023 · 7 comments
Open

local image doesn't appear to work #1

zombiehoffa opened this issue Jul 24, 2023 · 7 comments

Comments

@zombiehoffa
Copy link

Can you provide an example of how to use this with local images? I'm trying to replace telegram for notification but I have a subset of notifications that include pictures from my security cameras and I kind of need those to function to consider getting rid of telegram. I have had no luck getting it to work on my own.

@ivanmihov
Copy link
Owner

I usually do it this way:

Take snapshot from the camera:

service: camera.snapshot
data:
  filename: "/config/www/tmp/snapshots/FILE_NAME.jpg"
target:
  entity_id: camera.CAMERA_ENTITY

Send the notification:

service: notify.ivan
data:
  title: Notification Title
  message: Notification Message
  data:
    image: "https://HOMEASSISTANT_URL/local/tmp/snapshots/FILE_NAME.jpg"

Note that you might want to have something random for the FILE_NAME if your Home Assistant is publicly exposed and delete the image at some point.

@zombiehoffa
Copy link
Author

I ended up using the shell command tp do this with curl so i could direct atta h the image (my homeassistant is not web exposed so url will break on any ntfy endpoint not on my home network or overlay vpn network sadly.) I can poat an example tomorrow if wanted.

@dimatx
Copy link

dimatx commented Jul 27, 2023

I'm also trying to accomplish the same... Trying it with the payload below, but have the same issue as my Frigate is not exposed to the internet. Furthermore, it seems like ntfy PWA app will only render an image that's directly attached. (While the push notification seems to show it as it should... ) Have you found a working solution to get the image to show in the web app / PWA, @zombiehoffa? @ivanmihov - do you think it would make sense for your integration to fetch the image, and directly include it in the message?

service: notify.ntfy
data:
  title: " Garage bay 1"
  data:
    priority: 2
    topic: security
    image: https://frigate.internalhost.com/api/garage/latest.jpg
    tags:
      - information_source
  message: is closed 

image
image

@zombiehoffa
Copy link
Author

@dimatx
This is what I ended up doing:
shell_command:
ntfy_put: >
curl
--header 'Priority: {{ priority }}'
--header 'Filename: {{ filename }}'
--header 'Authorization: Bearer tk_secretkeyhere'
--upload-file '{{ file }}'
--url 'https://ntfy.sh/{{ topic }}'

You call the above in your automations with something like this (choose edit in yaml):
service: shell_command.ntfy_put
alias: Sendit
data:
priority: 3
topic: homeassistant
filename: yourpicture.jpg
file: /path/to/yourpicture.jpg

@dimatx
Copy link

dimatx commented Jul 31, 2023

Thanks @zombiehoffa. Unfortunately my image that I need to attach isn't local to HA, so I'm hoping this PR will address things for me: binwiederhier/ntfy#820

@titof2375
Copy link

hello, I have the same problem listed above, my images are in the media folder now,
/media/local/camera/snapshot_CamDevant.jpg
image1
and when I type the address in my search bar

@dinki
Copy link

dinki commented Sep 2, 2023

Here to join in the chorus of requests to allow for including images stored local. My use case is the same: take snapshot from doorbell camera when doorbell button is pressed and then send that snapshot file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants