SOLVED Pushsafer picture or image

I have been using Pushsafer in Domoticz as it supports images in notifications. I wish to add a camera snapshot to the notification when the doorbell is rang or when someone enters the room. I’ve used this example:

I am using HA on a Linux server in a docker container. I just cannot seem to make it work, the icon and sound data variable work fine, but the picture is not being sent:

  - alias: Send notification on doorbell
    id: Send notification on doorbell
    initial_state: 'on'
    trigger:
    - platform: state
      entity_id: switch.deurbel
      from: 'off'
      to: 'on'
    action:
    - service: switch.turn_off
      entity_id: switch.deurbel
    - service: notify.pushsafer
      data:
        title: "Deurbel"
        message: "Er wordt aangebeld"
        data:
          icon: "1"
          sound: "17"
          picture: {
             path: "/tmp/hal.jpg"
          }

The picture exists in the docker container:

-rwxrwxrwx 1 root root 186834 Jan 13 12:36 hal.jpg

I also tested to create the picture outside of the docker, in the OS. I also tried to add my Zoneminder url like this:

  • alias: Send notification on doorbell
    id: Send notification on doorbell
    initial_state: ‘on’
    trigger:

The url works and is reachable within the container, just nothing is added to the Pushsafer notification.

I’ve tried multiple data options. The ‘attachment’ option works with the native notify.notify service, but these notifications are not archived, so not very useful to me. With notify.pushsafer though, no picture is attached.

- service: notify.pushsafer
  data:
    title: "Deurbel"
    message: "Er wordt aangebeld"
    data:
      icon: "1"
      sound: "17"
      attachment:
        url: "http://www.gbsun.de/gbpics/berge/berge106.jpg"
        content-type: jpg
        hide-thumbnail: false

Ok, seems like that attributes ‘picture1’ and ‘url’ do the trick:

https://github.com/brkr19/home-assistant/blob/dev/homeassistant/components/notify/pushsafer.py

automations.yaml

  - alias: Doorbell send notification
    id: Doorbell send notification
    initial_state: 'on'
    trigger:
    - platform: state
      entity_id: switch.deurbel
      from: 'off'
      to: 'on'
    action:
    - service: switch.turn_off
      entity_id: switch.deurbel
    - service: notify.pushsafer
      data:
        title: "Deurbel"
        message: "Er wordt aangebeld"
        data:
          icon: "1"
          sound: "17"
          picture1:
            url: "https://zoneminder.domain.com/zm/cgi-bin/zms?mode=single&monitor=1&user=XXX&pass=XXX"

The ‘path’ attribute under ‘picture1’ simply doesn’t work for me, maybe it only works in Windows. My Zoneminder server is remotely accessible and now it adds a nice snapshot to my Pushsafer message. When you don’t use Zoneminder, I guess it should be possible to first create a snapshot and publish it via your favourite webserver and add that url to the message.

Hope this helps others :v:

1 Like