[SOLVED] Send Image Item with Telegram

Tags: #<Tag:0x00007f2fb17fab88> #<Tag:0x00007f2fb17fa930> #<Tag:0x00007f2fb17fa6b0>


I have a Synology with Surveillancestation installed. It’s great and has an API. I would like to send the latest snapshot image when the doorbell is pressed thru Telegram.

I got my Item & Rule setup so it gets the image in string from the Synology. Its saved in base64 (jpeg) in the Image Item. This works perfect. I can display the image in HABpanel.

Now I want to send this image thru telegram. From what I’ve researched is that you can send an image from URL and from File, but I doesn’t seem to have support from Image Item. (nice feature enhancement)

Is my findings correct? Is there some way to ‘convert’ my Image Item so the Telegram Action can use it?


I have forked the telegram action, and added the image via item myself. It’s working in my lab, will push the code asap.

1 Like

Hi, I use in my OH2.2 the new telegram action from Snapshot (org.openhab.action.telegram-1.12.0-SNAPSHOT.jar)

With this code I send an Image from wunderground weather via Telegram in a rule

    // Images
    var String base64Image0 = weatherunderground_weather_XXX_current_icon.state.toFullString
    sendTelegramPhoto("bot1", base64Image0, "Caption")

Using of …_icon.state.toString doesn’t work but …_icon.state.toFullString

1 Like

Hi @JMahmens, I take this is not a question but an example?

How did you do this?
I can send local files:

sendTelegramPhoto(“OH_Bot”, “”, "Bewegung detektiert!\n Zeitpunkt: " + Dome_Motion.state)

But would prefer to use somthing like:

sendTelegramPhoto("OH_TeleBot", Syn_Tele_Snap.state.toString, "Zeitpunkt: " + Abus_Motion.state)

Where Syn_Tele_Snap is the snapshot (image item).

You need to use ‘.toFullString’ to get the image formatted as base64 string.

sendTelegramPhoto("OH_TeleBot", Syn_Tele_Snap.state.toFullString, "Text")
1 Like

Thanks a lot - I will give it a try!

EDIT: Works, thanks

1 Like