Pushing Images with Pushover 3.0

I use portainer and opened a console session on the home assistant container and ran the command.

1 Like

Your explanation and portainer helped solve the problem. HassOS 2.11 v0.94.4, sending images again working.

1 Like

I just upgraded to 0.95 and it looks like I still need to run the command with this version.

pip3 install --upgrade python-pushover

Anyone know when it will be bundled into the normal releases?

2 Likes

Thank you!! I was pulling my head (I am bald) with this! Thanks for the link, after I installed it on the custom_components folder, I started getting the new messages with pictures attached!
Great!!!

someone running this on hass.io without docker?thanks

I am running hass.io without docker, it works as described above. Logging in via ssh

Am running Pushover on Hass.io ver 0.95.4 without docker. I used Portainer Hassio addon to access the root, and than run the command. And it works !

Powefull App handle with care.

pip3 install --upgrade python-pushover
1 Like

I need install portainer then? Container console is installed by default?

Yes. In the portainer quide you will see how to unhide the Home assistant Container.

Known issues and limitations

By default all Hass.io managed containers are hidden from Portainer. This is recommended since fooling around with Hass.io managed containers can easily lead to a broken system.

Access to these containers can be gained by going into Portainer -> Settings -> Hidden containers. Then delete the listed hidden labels (io.hass.type labels). Only do this if you know what youā€™re doing!

1 Like

right now its working again,thaks a lot everyone for help

it looks like this has been officially added in the next release

Add ability to send attachments in pushover notifications (#24806)

1 Like

Itā€™s been officially added in the 0.96.0 release and itā€™s working! Thanks to the devs. :+1:
:partying_face::partying_face::partying_face::partying_face::partying_face::partying_face:

Note that the new component is not directly compatible with the version that had been floating around before. The new implementation can be called like this from the Developer / Services pane in the UI:

{ 
  "message":"test",
  "title":"Title Here",
  "data":{
    "attachment": "/config/www/snaps/cam5.jpg",
     "html":  "1",
     "sound" : "bike"
  }
}

This new component sniffs at the front of the attachment string for a http prefix to figure out if itā€™s a URL that needs to be retrieved; or if itā€™s just a plain file name. Itā€™s too bad that the documentation doesnā€™t show an example of how to send an attachment, and rather show usage of a url: parameter that just sends along a URL associated with the message, and not an actual image or whatever.

Also note that ā€œattachmentā€ should specify the actual file or URL itself, not another dictionary that specfied ā€œfileā€ or ā€œurlā€ as previously.

3 Likes

As a more complete example for people from the future, Iā€™m using it like this:


- alias: doorbell fired
  initial_state: true
  trigger:
    - platform: state
      entity_id: input_boolean.doorbell_button
      to: 'on'

  action:
    - service: camera.snapshot
      data:
        entity_id: camera.cam5
        filename: "/config/www/snaps/cam5.jpg"

    - service: notify.pushover_louie
      data_template:
        message:  'Doorbell rung at {{ now().strftime("%l:%M:%S %p (%a)") }} <a href="https://example.com/local/snaps/cam5.jpg">cam5</a> <a href="https://example.com/local/snaps/cam6.jpg">cam6</a>'
        title: "HASS"
        data:
          attachment: /config/www/snaps/cam5.jpg
          html: "1"
          sound: "bike"

    - service: camera.snapshot
      data:
        entity_id: camera.cam6
        filename: "/config/www/snaps/cam6.jpg"

Where I send a notification with a grabbed image from one of the cameras at the time the automation fires, and links to two cameras if I want to look at at either/both images later. While my twisted needs here might not apply to your circumstances, I thought a real-life example would be helpful.

As an asideā€¦ whatā€™s interesting is that the camera.snapshot service seems to be synchronous; when the next step in the automationā€™s script is processed, the file has actually been created and saves. So you can reference that file in the pushover notification service call. Iā€™ve found this not to be the case when you tell a ā€œstreamingā€ camera to record, e.g., 15 seconds of video. That seems to kick some parallel activity off and the next action in the script will be invoked. This surprised me; maybe someone else can avoid learning this the hard way.

3 Likes

forgive me for not understanding you very well, do you want to say that the new component mentioned above is not capable of sending images?, just a url like the previous one

@pollinolas, no the new component can send images.

Itā€™s just that thereā€™s only one dictionary key, attachement: thatā€™s used to specify either a file name or a URL. It distinguishes the difference by looking for a leading http string prefix on the attachment: specifiction; if it is present, then it uses it as a URL; otherwise it treats it as a local file name.

Note that the prefix it looks for, http would match either an http://foo.com/ or an https://bar.com/ style URL.

Iā€™ve not actually tried to use it as a URL (since that wasnā€™t necessary for my purposes), just noticed that by inspection of the python code, specifically these lines of code: core/homeassistant/components/pushover/notify.py at a6e3cc6617f76ae50443ac8299276ebb0f83b704 Ā· home-assistant/core Ā· GitHub

If you just try to use your existing configuration, whereby attachment: references either a URL or a file name, youā€™ll get a an unusual error since the attachment wonā€™t be a string, but a dictionary with the older style configuration. This is what led me to look at the code to try to understand what was going on.

2 Likes

working good with native component,thanks to Imamakos for show the example and clarify my doubts

Thank you! I finally upgraded home assistant (a few versions behind) and the custom component stopped working. Glad itā€™s finally official.

Hey, no thanks to me for getting the component in! I just figure out how to make it go; the heavy lifting of working the submission through the process was done by someone else. But I join you in being real happy this has happened!

The thanks should go to https://github.com/kreegahbundolo who submitted the pull request

I have a problem using variables.

So i have an automation that uses camera.snapshot to write filename (this works fine):

filename: /share/yi_snapshot_{{now().strftime('%Y%m%d-%H%M%S')}}.jpg

and then want to use this same image in the notify.pushover using attachment:

attachment: /share/yi_snapshot_{{now().strftime('%Y%m%d-%H%M%S')}}.jpg

This is not working when a {{}} is in the attachment name. Maybe it is then confused by a url or something? Anybody an idea?