Pushover image support

Tags: #<Tag:0x00007f386bfe4e08>


I’ve been trying to get myself some nice attachments in my pushover messages but whatever i try… adding an attachment to my pushover rules gives me:

Could not process file '/static/Haardmeubel1.jpg': File is not a normal file., will send the message without attachment.

Part of my rule :slight_smile:

sendPushoverMessage(pushoverBuilder("test message").withApiKey("BLABLABLA").withUser("BLABLABLA").withDevice("sm-g960f").withPriority(0).withSound("echo").withAttachment("/static/Haardmeubel1.jpg"))

What am i doing wrong?

see the source code
you get an IOException for some reason.
does the file ‘/static/Haardmeubel1.jpg’ really exist and is it readable by the user, which is running openhab?

Got it… it actually requires the full file path, not just a relative one like i used…

I got it up and running in my Openhab setup using Node-red to handle the rules and inject images from my zoneminder server to finally send out a pushover message with attachment. For those interested…

Proof of working:

A basic description of my rule flow:

  • Openhab item Doorbell receives an update when doorbell is pressed

  • Node Red monitors the Openhab Doorbell item for updates. if an update is registered the state of the update is checked for the ON state.

  • If doorbell state is ON, we rate limit the amount of doorbell presses to 1 every 10 seconds . this allows all Doorbell automation to run correctly and also prevents people from molesting my doorbell.

  • as a result of pressing the doorbell…

  • Node Red plays doorbell.mp3 using Openhabs default audio sink (whole house SONOS)

  • Node Red flashes the alert channel of the Hue lighting through Openhab

  • Node Red writes a log entry in Openhab.log (Doorbell rang @ timestamp)

  • Node Red updates the Missed_doorbell_notification item is use for visual presentation in Habpanel

  • Node Red sets the doorbell notification text (openhab string item vPushover) to" there is someone at the door"

  • Node Red sets the doorbell notification sound (openhab string item vPushoverSound) to" gamelan"

  • Node Red sets the doorbell notification image (openhab string item vPushoverImage) to"/home/openhab/camera.jpg" after grabbing a fresh image from Zoneminder using http request.

  • the nodered.rules files is triggered based upon an update of vPushover and a message is sent through pushover.

The actual Node-red flow:

[{"id":"87f3ff46.cc45","type":"comment","z":"5445dc5f.c79e24","name":"Doorbell pressed - play doorbell sound through SONOS","info":"Test","x":220,"y":40,"wires":[]},{"id":"ed6d3ad0.8fd4e8","type":"openhab2-in","z":"5445dc5f.c79e24","name":"Doorbell","controller":"be8b0821.df18b8","itemname":"Doorbell","x":80,"y":100,"wires":[[],["e8bdfc9f.7fbd9"]]},{"id":"e8bdfc9f.7fbd9","type":"switch","z":"5445dc5f.c79e24","name":"Item Updated","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"ItemStateEvent","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":260,"y":100,"wires":[["1dd131ad.bb0e9e"]]},{"id":"1dd131ad.bb0e9e","type":"switch","z":"5445dc5f.c79e24","name":"Evaluate Doorbell","property":"payload.payload.value","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":100,"wires":[["1e99fe3.f0ae402"]]},{"id":"80308549.790458","type":"change","z":"5445dc5f.c79e24","name":"Send Doorbell.mp3","rules":[{"t":"set","p":"payload","pt":"msg","to":"doorbell.mp3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":100,"wires":[["11fb9b37.f053f5"]]},{"id":"11fb9b37.f053f5","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vSound","controller":"be8b0821.df18b8","itemname":"vSound","topic":"ItemUpdate","payload":"","x":1120,"y":100,"wires":[]},{"id":"1e99fe3.f0ae402","type":"delay","z":"5445dc5f.c79e24","name":"Rate Limite 1msg per 10s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":710,"y":100,"wires":[["80308549.790458","8eeb319f.bd7d8","7f0acf61.b468d","2ea210a4.6f1ef","3ff78d87.074e02"]]},{"id":"68ea1491.60c20c","type":"openhab2-out","z":"5445dc5f.c79e24","name":"gHueAlert","controller":"be8b0821.df18b8","itemname":"gHueAllAlert","topic":"ItemCommand","payload":"","x":1120,"y":140,"wires":[]},{"id":"8eeb319f.bd7d8","type":"change","z":"5445dc5f.c79e24","name":"Send Alert","rules":[{"t":"set","p":"payload","pt":"msg","to":"SELECT","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":140,"wires":[["68ea1491.60c20c"]]},{"id":"7f0acf61.b468d","type":"change","z":"5445dc5f.c79e24","name":"Send ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":200,"wires":[["48a7a77f.53b658"]]},{"id":"48a7a77f.53b658","type":"openhab2-out","z":"5445dc5f.c79e24","name":"HabPanelNotification_Missed_Doorbell","controller":"be8b0821.df18b8","itemname":"HabPanelNotification_Missed_Doorbell","topic":"ItemCommand","payload":"","x":1220,"y":200,"wires":[]},{"id":"2ea210a4.6f1ef","type":"change","z":"5445dc5f.c79e24","name":"Create Log Entry","rules":[{"t":"set","p":"payload","pt":"msg","to":"Doorbell rang","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":260,"wires":[["8b14e806.dc0038"]]},{"id":"8b14e806.dc0038","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vLog","controller":"be8b0821.df18b8","itemname":"vLog","topic":"ItemUpdate","payload":"","x":1110,"y":260,"wires":[]},{"id":"3ff78d87.074e02","type":"http request","z":"5445dc5f.c79e24","name":"Front Door Camera","method":"GET","ret":"bin","url":"","tls":"","x":950,"y":320,"wires":[["c5ec73ee.10da5","d7693e60.83604","abce55af.de82e8","be86d34d.6d8a3"]]},{"id":"c5ec73ee.10da5","type":"file","z":"5445dc5f.c79e24","name":"Save Camera Snapshot","filename":"/home/openhab/camera.jpg","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1230,"y":320,"wires":[]},{"id":"48b55371.89f1bc","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vPushover Image","controller":"be8b0821.df18b8","itemname":"vPushoverImage","topic":"ItemUpdate","payload":"","x":1210,"y":380,"wires":[]},{"id":"d7693e60.83604","type":"change","z":"5445dc5f.c79e24","name":"Set Pushover Image","rules":[{"t":"set","p":"payload","pt":"msg","to":"/home/openhab/camera.jpg","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":380,"wires":[["48b55371.89f1bc"]]},{"id":"abce55af.de82e8","type":"delay","z":"5445dc5f.c79e24","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":920,"y":460,"wires":[["9eb30e6a.5e43"]]},{"id":"9eb30e6a.5e43","type":"change","z":"5445dc5f.c79e24","name":"Set Pushover Image","rules":[{"t":"set","p":"payload","pt":"msg","to":"Er staat iemand aan de deur!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":460,"wires":[["f3459409.054f98","d86b137d.a3827"]]},{"id":"f3459409.054f98","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vPushover","controller":"be8b0821.df18b8","itemname":"vPushover","topic":"ItemUpdate","payload":"","x":1290,"y":460,"wires":[]},{"id":"be86d34d.6d8a3","type":"change","z":"5445dc5f.c79e24","name":"Set Pushover Sound","rules":[{"t":"set","p":"payload","pt":"msg","to":"gamelan","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":420,"wires":[["10637063.a04d7"]]},{"id":"10637063.a04d7","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vPushover Sound","controller":"be8b0821.df18b8","itemname":"vPushoverSound","topic":"ItemUpdate","payload":"","x":1210,"y":420,"wires":[]},{"id":"9825142.280f6e8","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vPushover Image","controller":"be8b0821.df18b8","itemname":"vPushoverImage","topic":"ItemUpdate","payload":"","x":1310,"y":520,"wires":[]},{"id":"bdb00579.d7b048","type":"change","z":"5445dc5f.c79e24","name":"Reset Pushover Image","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":520,"wires":[["9825142.280f6e8"]]},{"id":"d86b137d.a3827","type":"delay","z":"5445dc5f.c79e24","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":920,"y":520,"wires":[["bdb00579.d7b048"]]},{"id":"be8b0821.df18b8","type":"openhab2-controller","z":"","name":"Openhab2 - Prod","protocol":"http","host":"localhost","port":"8080","path":"","username":"","password":""}]

My nodered.rules and item file:

rule "Nodered vPushover"
	Item vPushover received update
	sendPushoverMessage(pushoverBuilder("" + vPushover.state.toString + "").withApiKey("YOURAPIKEYGOESHERE").withUser("YOURUSERKEYGOESHERE").withPriority(0).withSound(""+ vPushoverSound.state.toString +"").withAttachment(""+ vPushoverImage.state.toString +""))
String vNotification	"Notification [%s]"
String vPushover		"Pushover [%s]"
String vSound			"Sound [%s]"
String vSpeech			"Speech [%s]"

String vPushoverImage	"Pushover Image [%s]"
String vPushoverSound	"Pushover Sound [%s]"

Feel free to try it out!

I think the documentation are just a little bit confusing. Wouldn’t it be better to completely remove all the deprecated stuff from the documentation? And also the pushoverBuilder() function isn’t really mentioned anywhere but in the examples section (although the examples make it kinda clear how it works).

I’ve also got a concrete question: Is there any difference between using withEmergencyPriority() and withPriority(3)?

Apart from the abovementioned uncertainties, I could just thank for a nice addon :wink:

Nope. If you are on stable 2.3 and did not update the binding manually to 2.4 this is still the way it works.

Ah… Didn’t realize they were so freshly deprecated :blush:

I use the ipcamera binding to generate an OpenHab image (not a file) - is it possible to send this?
Or does someone know how to convert an OH image to a file for now?

Looks like the Telegram binding has been modified to cater for this (sending an image item, rather than a screen grab) - could possibly ‘borrow’ the code from there and add it to the pushover binding?:

Hi @BulletProofFool1,

Currently it is not possible to send an Image via Pushover directly. There a work-around which downloads the image first and the sends it. See

Thanks for the response,

I have worked around this for now by using the Exec binding to just fire off an ffmpeg script and save the file locally.
It is a little slow (5-10 seconds from trigger to receipt of push notification) but I am able to get a push notification with a picture of whoever is at the front door ion my Apple watch :slight_smile:

foranyone interested, I used the idea from here:


but am using the pushover binding for the actual notification (rather than a standalone script)

I just finished adding some lines to my rule so it would “crop” a picture before pushing thru pushover.
I plan to order the new Apple Watch on Friday and thought it would be nice to only push the camera area I need to see. I wasn’t even sure if the watch would receive the pictures, so thanks for sharing that it is possible.

Here is my rule that I pieced together from different rules I have found:

rule "Front Doorbell Laser"

        Item LaserMQTT changed to ON
        if(Laser_Email.state === ON)    {
        var FrontDoorCamB = "FrontDoorB"+ now.toString ("MM-dd-yyyy_HH-mm-ss") +".jpg"
        var FrontDoorCamA = "FrontDoorA"+ now.toString ("MM-dd-yyyy_HH-mm-ss") +".jpg"
        var doorbellmessage = "Front Door Visit at: "+ now.toString ("MM-dd-yyyy HH:mm:ss") +"\nCamera pictures attached!"
        var sender = "/usr/share/openhab2/pictures/" +FrontDoorCamB
        var final = "/usr/share/openhab2/pictures/" +FrontDoorCamB +"crop.jpg"

              executeCommandLine("wget http://user:password@192.168.x.xx:port/Streaming/Channels/2/picture -O /usr/share/openhab2/pictures/" +FrontDoorCamB)  //Hikvision Camera Path
              executeCommandLine("wget http://user:password@192.168.x.xx:port/Streaming/Channels/1/picture -O /usr/share/openhab2/pictures/" +FrontDoorCamA)

 var attachmentUrlList = newArrayList(
            "file:///usr/share/openhab2/pictures/" + FrontDoorCamA,
            "file:///usr/share/openhab2/pictures/" + FrontDoorCamB)

      sendMail("email@email.com", "Front Door Laser Notice", doorbellmessage, attachmentUrlList)                                                              // email 2 camera pics
      sendPushoverMessage(pushoverBuilder("Front Door Laser Trip").withAttachment(sender))                                                                    // pushover sends CamB pic full
      executeCommandLine("convert -crop 700x500+100+300 " + sender + " " + final + "")                                                                        // crops the picture to var FrontDoor +"crop.jpg"
    Thread::sleep(5000)                                                                                                                                       // wait for crop to complete ; probably a bad idea
      sendMail("email@email.com", "Picture Test Cropped", doorbellmessage, "file:///" +final)                // test email that only sends the cropped pic
      sendPushoverMessage(pushoverBuilder("Front Door Pic Crop").withAttachment(final))    }                                                                  // pushover croped CamB pic send

The rule above uses ImageMagick to crop the picture to a custom size.

1 Like

Nice work.

Sadly I find it can take 10-12 seconds for these to arrive and I have been testing alternative push notification clients.
As a heads up, pushsafer can also send images (though you’ll need to encode them to a base 64 image)

that said,I am still testing this in parallel to verify the service stability.

Without altering the images it takes about 1-2 seconds on my system to get it. But snapshot picture size from my camera is only about 40kB.

mine is pretty fast as well. i’ve not timed it, but just a few seconds. I’m pulling the image from synolgy ss. I do use persistence to grab the image from about 5 seconds prior to the motion notification but other than that this works splendidly and plenty fast enough

1 Like

It seems the majority of the delay occurs between me actually issuing the request to post the image and receiving the notification.
I have tested this by just using a random, tiny locally stored thumbnail

Meanwhile I am seeing almost the same thing: a lot more delays via pushover.

Hi All

My doorbell places images into a folder on OH2, but I cant seem to get them added to my notifications:
No errors are displayed. Any suggestions?

Even using /etc/openhab2/html/latest-vistior.jpg in the message displays the alert with no image.

        Item DoorBird_DoorBell received command ON
        Echo_LivingRoom_TTS.sendCommand('Theres someone at your Front Gate')
        sendBroadcastNotification("Someone at your door")
        logInfo("DoorBird", "DoorBell pressed by Visitor")

        var doorbird = "/etc/openhab2/html/" +"latest-visitor.jpg"
        var t = now
        var cmd = 'wget http://XXX@ -O ' + OPEHNAB_DIR + 'vistors-history/'
        cmd = cmd + t.getYear
        if (t.getMonthOfYear < 10) cmd = cmd + '0'
        cmd = cmd + t.getMonthOfYear
        if (t.getDayOfMonth < 10) cmd = cmd + '0'
        cmd = cmd + t.getDayOfMonth
        if (t.getHourOfDay < 10) cmd = cmd + '0'
        cmd = cmd + t.getHourOfDay
        if (t.getMinuteOfHour < 10) cmd = cmd + '0'
        cmd = cmd + t.getMinuteOfHour
        if (t.getSecondOfMinute < 10) cmd = cmd + '0'
        cmd = cmd + t.getSecondOfMinute
        cmd = cmd + '.jpg'

        if(vTimeOfDay.state != "DAY") {

       executeCommandLine('wget http://XXX@ -O ' + OPEHNAB_DIR + 'html/latest-visitor.jpg')
sendPushoverMessage(pushoverBuilder("test message").withApiKey("XXXX").withUser("XXX").withAttachment(doorbird))

Is the message being transmitted at all? Is it just missing the binary attachment?

How is doorbird sending images to your openhab html directory? Assuming the pathing is correct, I would also check permissions to make sure the OH server process has proper read access to the image file. The pushover command appears to be correct.

You can enable debug logging in the pushover binding to verify.

Yes, message is received just fine. Its just the attachment.

The doorbird sends the images fine to OH2, because I reference them in Habpanel with a HTTPS Url, so when i’m not home I can view the images on my habpanel app of the last visitor.

I can read the https url, or retrieve the image from a folder on the OH2 server, however the images are all timestamped and grabbing the latest one may be a bit tricky for me

https://URL/static/latest-visitor.jpg always displays the latest