Pushing Images with Pushover 3.0

Latest API version for Pushover allows to attach images, how can we get this new feature onboard? More info https://updates.pushover.net/post/170043375237/pushing-images-with-pushover-30

@xtianpaiva you hear any updates on this? I’d love to be able to use this in my setup for push image notification on my front doorbell.

Hi, same project here, still waiting, maybe we can have news with the next HA update.

Any more news about this feature? Would like to use it for my doorbell.

Is anyone else already working on this? If not, I figured I’d give it a shot.

1 Like

I have this working locally and have tested it by attaching an image like ‘/local/xyz.png’ (www directory) as well as from a security camera with basic auth. I’m working through cleaning it up and testing the edge cases but will get this submitted as soon as I can.

2 Likes

I would be very interested in this as well, would you like to share the code?

I just submitted a pull request for this (#13748), but you can find my updated code here if you’d like to test it locally: https://github.com/brkr19/home-assistant/blob/dev/homeassistant/components/notify/pushover.py

Edited to fix the repository in the url

1 Like

Great job! What platform do you use? I’m running HA on docker, do you know how I would test it on there?

I’m just learning Docker myself, but I added this to my docker run command to use my local source dir instead: -v /home/brkr19/opt/home-assistant:/usr/src/app (so my local source dir was in ~/opt/home-assistant). There’s probably a better way, but this was what worked for me while doing frequent code changes and testing.

Great, thanks

Hi, @brkr19 It seems that your pull request is now Live. could you update the documentation how we should use it?
i have tried a few things but i didn’t manage to get it working.

{ “message”: “Test plugin”,
“filename”: { “url”:“http://www.gbsun.de/gbpics/berge/berge106.jpg
} }

{ “message”: “Test plugin”,
“attachment”: { “url”:“http://www.gbsun.de/gbpics/berge/berge106.jpg
} }

Hmm, that’s strange - last I saw, it was rejected due to the desire to continue using the third-party library instead of the APIs directly. I actually had a PR for the documentation too, but then had to roll that back.

Here’s an example in case it is actually live though:

- alias: Garage motion detected
  trigger:
    platform: state
    entity_id: sensor.garage_motion
    from: '0'
    to: '1'
  condition:
    - condition: state
      entity_id: input_boolean.security_armed
      state: 'on'
  action:
    - service: notify.pushover
      data_template:
        message: "Security system: Motion in Garage!"
      data:
        title: "Home Assistant"
        data:
          priority: 1
          sound: siren
          file:
            url: !secret cam_garage_latest_url
            auth: basic
            username: !secret cam_garage_username
            password: !secret cam_garage_password
1 Like

did your code every get rolled in home assistant to support images?

looks like the 3rd party library supports it, I’m no developer though
https://pushover.net/faq#library-python

Alternatively, the 3rd party pushnotify Python package written by Jeffrey Goettsch, the pushover Python 3 package written by Wyatt Johnson, and the Chump Python package written by Karan Lyons are available.

To send an image attachment, the 3rd party Requests library can be used. For example, to send the file “your_image.jpg”:

import requests
r = requests.post(“https://api.pushover.net/1/messages.json”, data = {
“token”: “APP_TOKEN”,
“user”: “USER_KEY”,
“message”: “hello world”
},
files = {
“attachment”: (“image.jpg”, open(“your_image.jpg”, “rb”), “image/jpeg”)
})
print(r.text)

I just updated my code here: 6f354e6. I’ll be testing it and creating a new PR soon, but in the meantime, feel free to grab this code for now.

2 Likes

How can I modify original pushover.py?

It’s best not to edit the original files. I used the custom_components method described here; https://community.home-assistant.io/t/editing-component-files-in-hassio/24273
So I took the new pushover.py from @brkr19 and placed it in config/custom_components/notify
Works like a charm (reboot ofcourse) really happy, thanks a lot @brkr19

2 Likes

Using this a custom component worked really well. Thanks for the tip

I’m trying to have my camera image sent to Pushover but still, with the custom component, have issues.
Could you share you automation lines so I can compare?
thanks

nobody can help?