Examples of Image channels and jpgs?

Hi All,

I’m working on adding support for image snapshots for the Ring binding. I know how to download a JPG from the Ring API - but I’ve never worked with an Image channel.

Wondering if there are any good examples of retrieving a JPG and sending it to an Image channel?

Thanks,

Paul

Whilst I’m at it - the ring binding currently uses jetty for http - and returns a string, I guess I need some sort of binary format….

Edit: I have this working now - GitHub - psmedley/openhab-addons at ring-snapshots

Still needs more testing and cleaning up - particular the upgrade of channels.

I send images via mqtt.
I set up an item as an image type.
I have a script that uses the -f option in mosquitto:

mosquitto_pub -h 192.168.1.164 -t zoneminder/latest -f "$OUTFILEJPG"

I am not sure if it is a “good” example but here is one that I am working on. It may give you some ideas. Or you may see something wrong and give me some ideas..

1 Like

You just have to declare a channel accepting Image as item type then you can update your channel like that for example.

Note that it uses an util method from OH core framework to download the image.

1 Like