Send Picture via Telegram not working

openhabian 2.2.
action-telegram - 1.11.0

docs: https://www.openhab.org/addons/actions/telegram/#examples

Hi,

i want so send a picture via Telegram taken by habpanelviewer tablet.
I have a Image Item. Picture is taken. I can see it on habpanel.

Test Rule sending only text works fine! So there is no Problem with the bot.

But i cant send Pictures.

rule:

rule "Testbild"
when Item Test changed
then     
sendTelegramPhoto("bot", ifirewhz, "Wohnzimmer")
end

Log:

[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Testbild': An error occurred during the script execution: Could not invoke method: org.openhab.action.telegram.internal.Telegram.sendTelegramPhoto(java.lang.String,java.lang.String,java.lang.String) on instance: null

or

rule "Testbild"
when Item Test changed
then     
sendTelegramPhoto("bot", ifirewhz.state.toFullString, "Wohnzimmer")
end

Log:

[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Testbild': unsupported protocol: 'data'

Your second erro indicates that the Telegram action is indeed installed but fails due to the content on the info passed to it.

What is the content of ifirewhz?

Have you tried?

rule "Testbild"
when
    Item Test changed
then     
    sendTelegramPhoto("bot", ifirewhz.state.toString, "Wohnzimmer")
end

ifirewhz is the Image item

Error in the log with rule:

rule "Testbild"
when
    Item Test changed
then     
    sendTelegramPhoto("bot", ifirewhz.state.toString, "Wohnzimmer")
end
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Testbild': Invalid uri 'raw type (image/jpeg): 27083 bytes': incorrect path

From Telegram action:

sendTelegramPhoto(String group, String photoURL, String caption): Sends a Picture via Telegram REST API

Try to pass an URL to an image, not an Image item

Seems as if you can only use an Image item with the latest OH 2.3 version.

Compare the docs https://www.openhab.org/addons/actions/telegram/ and https://docs.openhab.org/v2.2/addons/actions/telegram/readme.html

1 Like

:man_facepalming: thanks all

I see:

sendTelegramPhoto("bot1", "http://www.openhab.org/assets/images/openhab-logo-top.png", "sent from openHAB")