Hey Everyone,
I've been chatting with @dceejay in the General discussion about adding image support to the standard NR Pushover node.
I've prepared and published an experimental version that supports image attachments on my github page. It includes instructions for installing it, and removing it without disrupting your existing flows. Of course, you should always backup just in case.
You can attach an image to your msg by providing a path to an image file, or supplying the image as a Buffer object. The buffer can be base64 encoded or binary - the node will sort it out.
If you are interested in having image support, you can install this version and it will work with all your existing nodes. Removing it as per the instructions will replace it with the standard node-red version.
I'm using it with my Foscam cameras to send a screenshot when motion is detected. So far, working very well.
Any issues, please report them on the github issues page.
The reason I'm putting this out to the community for testing and feedback is that there are no existing test scripts for the pushover node. It appears to be one created early in node-red's lifetime. So I'm putting it out this way first for community testing before issuing a PR.
If there aren't any issues, then I'll submit a PR to the node-red-nodes repository for inclusion in a future NR release.
Damo.
1 Like
Hi All,
Just a quick follow up to this post to advise the image support has been merged into the official node red pushover node.
If you installed the experimental version, there are instructions for its removal and replacement with the official version.
Damo.
1 Like
Thanks for adding this - works for my cheerlights pushover feed to my phone
Hey Simon,
Glad someone finds it useful.
Cheers,
Damo,
New user to NR here (and loving it!)
My installation of node-red-node-pushover (v 0.0.17) does not appear to have a field to enter the path to the attachment (an image file capture from a camera). I'm not sure how to attach the image to the notification and any help is gratefully received!
Hi,
as per the info box on the for this node
it shows that the image must be in the msg property called attachment - either as a binary buffer (straight from the camera) - or as a filename (with full path).
Thanks for replying. I'm still finding (groping?) my way around node-red I'm afraid.
I'm guessing I should use a change node to set msg.attachments to msg.payload and then send that to the pushover node?
So I then need to include the image as part of the payload (I understand I'll need to first capture the image and then save it to a file).
To help me move forward how can I set the message payload to just reference a static image file?
You could simply do it like in the picture below:
Then you just have to copy an image to that folder (/home/pi/Pictures) and it will be read and the buffer will be moved to msg.attachment
[{"id":"e20aeda4.1f45e","type":"file in","z":"a4d7c0e0.63723","name":"","filename":"","format":"","chunk":false,"sendError":false,"x":420,"y":140,"wires":[["c304afbf.e3684"]]},{"id":"ba46b7f1.64d7d8","type":"watch","z":"a4d7c0e0.63723","name":"","files":"/home/pi/Pictures","recursive":"","x":200,"y":140,"wires":[["e20aeda4.1f45e"]]},{"id":"c304afbf.e3684","type":"change","z":"a4d7c0e0.63723","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"attachment","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":140,"wires":[[]]}]
1 Like
So far so good, I'm able to successfully send a test image to my phone, however it's also sending a heap of buffer data as well.
On my phone app I get the message {"type":"Buffer":"data"; [with a whole bunch of numbers, followed by the image itself. Is there a way to remove this unwanted string of numbers?
did you then also set the payload to something new ... like "Hello - here is a picture" ?
1 Like
Aaah, no. Now it all works fine! Thank you!
However I wouldn't also mind understanding how setting a payload message removed all those numbers?
well I'm guessing that payload still contained the original image... maybe you set msg attachment rather than move payload to it ?
1 Like
Oops, I did indeed do that, despite @krambriw telling me to use move instead of set. I'll have a try of that a bit later.
Once again, thanks!
For completeness I tried "move msg.payload to msg.attachment" (per @krambriw's post above) instead of "set msg.payload to msg.attachment" and got the following error message
TypeError: Cannot read property 'toString' of undefined
Now guessing, when you move the payload,,,,means the msg you send will have no payload. If the next node is expecting a payload, well??? Add debug nodes after each node and inspect the complete msg, then you can trace better where and what goes wrong
Share your flow so we can see what is wrong, I don't use the pushover myself
Indeed - it does indeed fail to handle a missing msg.payload... will fix.
@dceejay It would be great if emergency priority messages would also be supported. This would require adding parameters retry
, expire
and callback
and tag
. retry
and expire
would need to be mandatory if emergency priority (2
) is set.
This is in my opinion one of the greatest features of Pushover when compared to other similar services.
I quickly skimmed the code of pushover-notifications used by the node. Although these API parameters are not listed in the documentation, the module seems to pass the msg
forward as is.
If I find time to prototype this at some point and find it working, would a PR be welcome?
Yes, a PR would be welcome.
1 Like