Pushing Images with Pushover 3.0

mine looks like this:
- id: Bezoeker
alias: Bezoeker
initial_state: True
trigger:
platform: state
entity_id: binary_sensor.voordeur_line_crossing_2
to: ‘on’
action:
- service: notify.pushover_ha
data_template:
message: ‘(voordeur) Bezoeker om {{now().strftime("%H:%M %d-%m-%Y")}}’
data:
title: “Home Assistant”
data:
priority: 0
sound: intermission
file:
url: http://ipaddress:port/ISAPI/Streaming/channels/1/picture?
authentication: digest
username: !secret hikvision_user
password: !secret hikvision_password

Thank you so much, it works now.
Although, it shows the live feed which, in my opinion, isn’t really what I need since ideally, I would need to image from when the even occurred…
Any way to push only the image of the event from when it occurred?

Actually, it worked the first time then without changing anything, got this error for the URL image:
Received status=401 while trying to download http://192.168.1.149:65006/ISAPI/Streaming/channels/1/picture?

That’s a issue I am running into also (since 5 days or so). I found that when I use basic authentication on my camera it works again (Hikvision).

I am also building a setup at the office and we use Axis camera’s there. The problem is accessing the URL works when using basic authentication (set via the axis manager) but then HA can’t find the camera’s. I still did not solve that (spent almost the whole day yesterday on his)

I tried using basic (changed ion NVR and in automation); same issue…

I worked around it, this code works for me (just the action piece)

action:
- service: camera.snapshot
  data:
    entity_id: camera.voordeur
    filename: 'tmp/voordeur.jpg'
- service: notify.pushover_ha
  data_template:
    message: 'Bezoeker om {{now().strftime("%H:%M %d-%m-%Y")}}'
  data:
    title: "Whatever"
    data:
      priority: 0
      sound: intermission
      file:
        path: 'tmp/voordeur.jpg'

this seems perfect, although, I’m getting
Can't write tmp/ext_cote_maison.jpg, no access to path!

after some reading, I finally got it to work :slightly_smiling_face:

I had to whitelist tmp:

  whitelist_external_dirs:
    - /tmp  

and reboot the NUC completely

my automation:

- id: '1522174458955'
  alias: Notification "line crossing" entrée
  trigger:
  - entity_id: binary_sensor.sfnetwork_nvr_line_crossing_4
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: camera.ext_entree_maison
      filename: /tmp/snapshot_ext_entree_maison.jpg
    service: camera.snapshot
  - data:
      data:
        file:
          path: /tmp/snapshot_ext_entree_maison.jpg
        priority: 0
        sound: incoming
      message: Intrusion à l'entrée de la maison!!!
      title: Home Assistant - Cam entrée maison
    service: notify.pushover

FINALLY!!!
thanks so much for your help!!! hope it help other users.

I wonder if you guys could help, I can’t get past the folder whitelist issue. I’m using Homeassitant on Windows and it downloads a JPG image from my netatmo camera to c:\homeassistant\downloads\last.jpg this works fine but when it comes to sending the JPG via Pushover I get the error ‘downloads\last.jpg is not secure to load data from!’ even though the folder is whitelisted. I’m sure it’s probably related to the path syntax but I’ve tried forward and backward slashes and even tried with the JPG being located in the config folder but still no luck

Automations.yaml:

  • id: ‘1535480687632’
    alias: Monitor for animals in back garden
    trigger:
    • entity_id: binary_sensor.back_outdoor_animal
      from: ‘off’
      platform: state
      to: ‘on’
      action:
    • data:
      filename: last.jpg
      overwrite: true
      url: http://XXXX/live/snapshot_720.jpg
      service: downloader.download_file
    • data:
      data:
      file:
      path: downloads\last.jpg
      priority: -1
      sound: alien
      message: Animals in back garden
      title: Back garden monitoring
      service: notify.notify
      hide_entity: false
      initial_state: ‘off’

Configuration.yaml:

  whitelist_external_dirs:
    - downloads

Eventually managed to fix myself by using the full path rather than a relative one:

Automation:

  • id: ‘1535480687632’
    alias: Monitor for animals in back garden
    trigger:
    • entity_id: binary_sensor.back_outdoor_animal
      from: ‘off’
      platform: state
      to: ‘on’
      action:
    • data:
      filename: last.jpg
      overwrite: true
      url: http://XXXX/live/snapshot_720.jpg
      service: downloader.download_file
    • data:
      data:
      file:
      path: c:/Homeassistant/downloads/last.jpg
      priority: -1
      sound: alien
      message: Animals in back garden
      title: Back garden monitoring
      service: notify.notify
      hide_entity: false
      initial_state: ‘off’

Config:

  whitelist_external_dirs:
    - c:\Homeassistant\downloads

Hi folks,
still doesn’t work for me. Beginner here, so there might something basic be missing. What I have done:

  • set up pushover -> works!
  • loaded pushover.py from @brkr19 (getting You are using a custom component for notify.pushover which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant. )
  • loading camera images into hass.io via still_image_url generally works

I just can’t get the code to run. Here it is:

- alias: alarm_trigger
  trigger:
  - platform: state
    entity_id: 'binary_sensor.fibaro_system_fgms001zw5_motion_sensor_sensor'
    to: 'on'
  action:
  - service: notify.pushover_notifier
    data:
      message: "motion detected"
      title: "Alarm!"
      data:
        file:
          url: http://USER:PASSWORD@IP:80/image/jpeg.cgi

Leaving out the last three lines works like charm. Adding these lines however gives me the following error message:
attachment: invalid message parameter
using attachment instead of file brings:
Could not send notification: send_message() got multiple values for keyword argument 'attachment'

Since working with the url directly, I am not facing this “whitelist issue”, right? If the jpg is downloaded in the python script, I can’t see where and therefore can’t add anything to the whitelist.
Can anyone please point me in the right direction? Thanks!

EDIT: I just found out that deleting the last three lines doesn’t work with @brkr19 's script, getting the same attachment: invalid message parameter error as before …

It looks like your spacing is off try

- alias: alarm_trigger
  trigger:
    - platform: state
      entity_id: 'binary_sensor.fibaro_system_fgms001zw5_motion_sensor_sensor'
      to: 'on'
  action:
    - service: notify.pushover_notifier
      data:
        message: "motion detected"
        title: "Alarm!"
        data:
          file:
            url: http://USER:PASSWORD@IP:80/image/jpeg.cgi

Thanks for the hint. Spacing already drives me nuts in yaml files.
It doesn’t change anything though and all my automations use the spacing as I posted above and work well.

I just got this working, great work! I’m surprised it still hasn’t been merged and we have to use the custom code, do they keep denying your PR’s?

Just got this working on my hass instance. @brkr19 - any input on getting this merged into the mainline?

I’d love to get it merged, but my last two pull requests failed. The first time, they wanted it done differently (fine), but the last time, it just died on the vine. I’ll probably try again soon though when I get more time.

3 Likes

I have the following automation:

  • alias: New file alert
    trigger:
    platform: event
    event_type: folder_watcher
    event_data:
    event_type: created
    action:
    service: notify.pushover
    data_template:
    title: New image captured!
    message: “Created {{ trigger.event.data.file }} in {{ trigger.event.data.folder }}”
    file:
    url: http://192.168.1.163:8123/local/people5.jpg

The following error appears in my logs:

Invalid service data for notify.pushover: extra keys not allowed @ data[‘file’]. Got {‘url’: ‘http://192.168.1.163:8123/local/people5.jpg’}

Any assistance will be appreciated.

I have been trying to get this to work but I get the following error when I try to use the file parameter:

file: invalid message parameter

Is there something I am missing?

Now I am not running latest Home assistant, but 0.82.1. For that version, this isn’t merged. I assume it’s still not merged. If you want to use it you need to install it as a custom component.

$ ls custom_components/notify/
pushover.py  __pycache__

I have put the pushover.py file into custom_components/notify/ however it doesn’t seem to be loading in Home Assistant. And when I do this I lose all of my notify components in Home Assistant.

If the component loads successfully then you will see a relevant message about custom components in the log. Do you have such a message?

What version of HomeAssistant are you running and on what platform?
How did you create the pushover.py file?
Does the directory and file have the right access permissions?

I’m using the custom component with 0.86.4

EDIT
I’ve just been patching my server, and this is the message you should see in the logs on start:

You are using a custom component for notify.pushover which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.