openhab / openhab-jruby

A Helper Library for Writing openHAB Automations in Ruby
https://www.openhab.org/addons/automation/jrubyscripting/
Eclipse Public License 2.0
5 stars 5 forks source link

Notification: support Image item as attachment #315

Closed jimtng closed 1 month ago

jimtng commented 1 month ago

Notification attachment can refer to an image using the format item:MyImageItem

This PR accepts an Item as attachment and simply converts it to the above string

items.build { image_item MyImageItem }
MyImageItem.update_from_file("/tmp/camera_snapshot.jpg")
Notification.send("msg", attachment: MyImageItem)

# Or alternatively, before this PR:
Notification.send("msg", attachment: "item:MyImageItem")