openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.59k forks source link

[pushover] Request ability to attach images from OpenHAB items #17461

Closed Dave-Baldwin closed 1 month ago

Dave-Baldwin commented 1 month ago

It would be fantastic if this binding could have an alternate method to send an Attachment which would take an OpenHAB image item and send its content as an attachment.

Use case would be images that arrive in OpenHAB via MQTT, i.e. from Frigate, that would be suitable to send in Pushover notifications. Converting image item data to a file, saving to filesystem, and then attaching the file is cumbersome and not straightforward for us 'dummy' users.

jlaur commented 1 month ago

@Dave-Baldwin - I think you can already do that? See: https://www.openhab.org/addons/bindings/pushover/#full-example

This example:

// in case you want to send the content of an Image Item (RawType)
actions.sendAttachmentMessage("Hello World!", "openHAB", myImageItem.state.toFullString, null)
Dave-Baldwin commented 1 month ago

Cool, thanks, I see it now and it works great for me. I think way back when I started using the binding, this example was not in the demo.rules section.

I would recommend that the writeup for the sendAttachmentMessage method be enhanced to specifically call out that the content of an Image item can be used; IMHO the tech-speak in this section does not make it super clear that this use case is possible.

Suggestion:

sendAttachmentMessage(String message, @Nullable String title, String attachment, @Nullable String contentType) - This method is used to send a message with an attachment. It takes a local path or URL to the attachment (parameter attachment mandatory). Additionally you can pass a data URI scheme to this parameter. The content of an Image-type item is also accepted (see demo.rules example). Optionally pass a contentTypeto define the content-type of the attachment (default: image/jpeg or guessed from image data).

jlaur commented 1 month ago

@Dave-Baldwin - would you like to create a pull request adding that? 🙂

You'd need to go to the latest version of the documentation page: https://next.openhab.org/addons/bindings/pushover/. At the bottom of the page there's a link: Edit this page on GitHub. You can now make the change and create a pull request to be reviewed and merged.

Dave-Baldwin commented 1 month ago

Done

On Tue, Oct 1, 2024, 5:02 PM Jacob Laursen @.***> wrote:

@Dave-Baldwin https://github.com/Dave-Baldwin - would you like to create a pull request adding that? 🙂

You'd need to go to the latest version of the documentation page: https://next.openhab.org/addons/bindings/pushover/. At the bottom of the page there's a link: Edit this page on GitHub https://github.com/openhab/openhab-addons/edit/main/bundles/org.openhab.binding.pushover/README.md. You can now make the change and create a pull request to be reviewed and merged.

— Reply to this email directly, view it on GitHub https://github.com/openhab/openhab-addons/issues/17461#issuecomment-2387069703, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOMQYOX3GSV4GUBMLBEUX7DZZMEWXAVCNFSM6AAAAABOWYXB3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBXGA3DSNZQGM . You are receiving this because you were mentioned.Message ID: @.***>