New Telegram Binding - Tester and Feedback welcome

I configured thing in PaperUI, because didn’t found syntax for textual configuration at the binding site.

But would be interested too :wink:

Thing telegram:telegramBot:gbot "Telegram" @ "Internet" [chatIds="xxxxx", botToken="yyyyy", parseMode="Markdown"]

and

String      Telegram_MessageText    "Last Message Text [%s]"                                                    { channel = "telegram:telegramBot:gbot:lastMessageText" }   
DateTime    Telegram_MessageDate    "Last Message Date [%1$td.%1$tm.%1$tY, %1$tH:%1$tM]"                        { channel = "telegram:telegramBot:gbot:lastMessageDate" }   
String      Telegram_MessageName    "Last Message Name [%s]"                                                    { channel = "telegram:telegramBot:gbot:lastMessageName" }   
String      Telegram_MessageUser    "lastMessageUsername [%s]"                                                  { channel = "telegram:telegramBot:gbot:lastMessageUsername" }   
String      Telegram_ChatID         "Chat ID [%s]"                                                              { channel = "telegram:telegramBot:gbot:chatId" }    
String      Telegram_ReplyID        "Reply ID [%s]"                                                             { channel = "telegram:telegramBot:gbot:replyId" }
1 Like

Many thanks @Olymp - will give it a try in the afternoon :slightly_smiling_face:!

KR,
Chris

With more than one chat Id: Komma separated?

For me this worked with multiple chat Ids:

Thing telegram:telegramBot:bot1 "Telegram Bot" [ botToken="token", chatIds="123","456", parseMode="Markdown" ]

2 Likes

Thanks a lot.

If it works finde, ich hope I will remember to put Example in Binding-Documentation Site :slight_smile:

As far as i understand the binding compared to the action, i can only add one bot, right?
I could use one bot with multiple chatIds but that would send the message to both chats when just using telegramAction.sendTelegram("<message>")
So i need to use the chatId everytime i want to send a message to only one chat.

Is there any smarter way for this?
I already tried to create an val String bot1 = <chatID> but i´m not able to use it in telegramAction.sendTelegram(bot1, "<message>")
It was a lot easier to build a rule with sendTelegram actions compared to the new binding :frowning:

You can use a variable for chat I’d as long value.

 var long NameChatId = 12345L

Then use NameChatId as variable to send

is the L character required after the chatid?

edit: ahh it is.

Is there a way to add a port to the image URL?
I always get the following error message when using an image URL with a port:

2020-02-19 22:08:08.310 [WARN ] [binding.telegram.bot.TelegramActions] - Download from http://192.168.178.91:18188/ipcamera.jpg failed with exception: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: bad response on HttpConnectionOverHTTP@b2d0d8::SocketChannelEndPoint@a92176{/192.168.178.91:18188<->/192.168.178.91:40426,OPEN,fill=-,flush=-,to=15/0}{io=0/0,kio=0,kro=1}->HttpConnectionOverHTTP@b2d0d8(l:/192.168.178.91:40426 <-> r:/192.168.178.91:18188,closed=false)=>HttpChannelOverHTTP@da3e61(exchange=HttpExchange@1ca6a0e req=TERMINATED/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@19cf9e0(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@bdc574{s=START}],recv=HttpReceiverOverHTTP@129c534(rsp=IDLE,failure=null)[HttpParser{s=CLOSE,0 of -1}]]

I am using the below rule:

rule "Gefrierschrank Timer"
when
    Item ug_tuer_gefrier_Timer received command OFF
then
        val telegramAction = getActions("telegram","telegram:telegramBot:abcd")
        logWarn("Gefrierschrank","Gefrierschrank seit 3 Minuten offen!")
        ug_tuer_gefrier_3min_offen.sendCommand(ON)
        telegramAction.sendTelegramPhoto("http://192.168.178.91:18188/ipcamera.jpg", "Gefrierschrank ist seit 3 min offen")
end

Thank you!

Hi, im using this binding for sending WeatherIcons with Description.
Now I’am wondering that using Markup or Html is not working in this additional Textes.
Is this not working in general from TelegramAPI for sending Photos or is it not implemented.
May someone check this?
Thanks

I updated to the latest version of the binding and now it is working properly.

Thanks guys, this is really cool that telegram binding!

Just started using it and I would like to use a triggeringItem.name when sending the text message.
Is this possible, cause I can´t find this in the binding description.
What would be the correct usage?

like:
val telegramAction = getActions(“telegram”,“telegram:telegramBot:xxxx”)
telegramAction.sendTelegram(“triggeringItem.name”)

Maybe it should be somehow like

telegramAction.sendTelegram("Movement triggered on", triggeringItem.name.toString)

Try this:

telegramAction.sendTelegram("Movement triggered on" + triggeringItem.name.toString)

Just tried this but no success.
The message gets send but the part for triggeringItem.name gets ignored.
Tried also without the+ and without toString, but in all cases no triggeringItem.name

Does the binding support this functionality?

In parallel in the same rule I use the mail binding, here all working perfectly

You only send one line, the syntax I wrote is ok, but seems truggeringItem.name is empty then. Please post full rule

Hi, got it working, must be
telegramAction.sendTelegram(“Movement triggered on %s” triggeringItem.name)

I think such an example could be added to the official description as well, I wasn’t able to understand the current description of the new binding delivering this information.

Hi,
I’m trying to configure the new binging on OH 2.5.2 using Paper UI … but, after editing all attributes (Think ID, Bot token, Chat id and Parse mode) … the blue “Add” button is disabled (!)
What’s my mistake ?
Can anyone post a “telegram.things” file example ?
Thanks.

1 Like

You have to press the enter after you entered the ChatId.

2 Likes

Oh, yes !
Sorry.