New Telegram Action

(Paolo Denti) #1

Hi,
a new Telegram Action is now available. It allows sending messages to chats in Telegram (https://telegram.org)

Documentation is available in the wiki page

1 Like

[Feature Request] Threema action addon
(Jens Bruckmann) #2

Hi,

I have implemented and tested the action. It works great but I would like to report a bug:
When I have a German Umlaut in the message I want to send, the message won’t be delivered with an error in the log

2015-12-10 19:05:43.521 [WARN ] [o.a.telegram.internal.Telegram] - Method failed: HTTP/1.1 400 Bad Request

Best regards,
Jens

1 Like

(John Cocula) #3

Te API says it needs UTF-8 encoding. Perhaps something needs to be added to the HTTP request header?

0 Likes

(Paolo Denti) #4

Hi Jens,
I will address the issue as soon as possible. I guess the problem will appear with every “extended” unicode character.

0 Likes

(Paolo Denti) #5

A fix has been posted: https://github.com/openhab/openhab/pull/3533

rule "Send telegram with Fixed Message"
when
    Item Light_FF_Bed_Ceiling changed
then
    sendTelegram("bot1", "item Light_FF_Bed_Ceiling with umlaut Ä changed")
end

0 Likes

(Hakan Tandogan) #6

And merged, should be in tonight’s jenkins build. Could you please retest with the next build?

0 Likes

(E. Gerland) #7

I would love to test it.
Where can I find the ready to use addon?
Thanks.

0 Likes

(Paolo Denti) #8

You should download the addons bundle. It is a zip file containing the telegram action.

  1. Put the telegram jar in the “addons” folder
  2. Configure the openhab cfg
  3. start openhab
0 Likes

(E. Gerland) #9

Hi Paolo,
I have configured openhab.cfg and created a rule according to the wiki.
I have struggled finding the right zip (I am running 1.7.1, which does not contain telegram in the addons.zip).
Anyway, I found it in 1.8.0 and checked it out.
By the way, my “chat” ID is the same like my “from” ID on https://api.telegram.org/bot
Is this always the case?
And I get an error in the openhab.log:
[o.a.telegram.internal.Telegram] - Method failed: HTTP/1.1 400 Bad Request

In general my confusion is related to “botname” “botusername” (I have chosen both to be the same ;-). Which one to define in openhab.cfg.
Furthermore the botusername in my telegram App (iPhone) is named “@MYBOTUSERNAME”.
So what is the right one to choose?

0 Likes

(Paolo Denti) #10

Apart from the correct addon version, 1.7, 1.8, … (about which I cannot help you, telegram action is just included in 1.8 and later …) you should just follow the instruction written here: https://github.com/openhab/openhab/wiki/Actions#telegram-action
Just follow step by step in order to get your token and chatId, it is very easy to get the telegram token and chatId

The bot name in the openhab.cfg can be any name. And that will be used as first parameter for the sendTelegram method.

0 Likes

(E. Gerland) #11

Thanks for your quick response.
Actually I followed the step by step thoroughly and I got the token and chatID.

So you mean, just adding the org.openhab.action.telegram-1.8.0-SNAPSHOT.jar to my distribution-1.7.1 will not work?

0 Likes

(Paolo Denti) #12

About using telegram addon on 1.7 I do not have a certain answer. I think it should work but it was developed and tested on 1.8.
Probably @hakan or @watou can give you a better answer about general compatibility issues with addons.

0 Likes

(E. Gerland) #13

Thanks - let’s see what @hakan or @watou suggest.
:smile:

0 Likes

(Hakan Tandogan) #14

Honestly, I would be very very surprised if this did work. But then again, I have seen stranger things :smile:

If you want to experiment with the daily builds, please download the 1.8.0-SNAPSHOT archive from https://openhab.ci.cloudbees.com/job/openHAB/

If not, @teichsta proposed a tentative schedule for the 1.8.0 release, please read about it at his posting at Upcoming 1.8 Release

0 Likes

(E. Gerland) #15

Hi Hakan,

I would like to test the snapshot, but I am afraid, that I mess my system up completely. :wink:
Before I start trying, I need to clone my micro SD.
Thanks for your help.
I will also check out the official release discussion.

0 Likes

(John Cocula) #16

I don’t know why placing org.openhab.action.telegram-1.8.0-SNAPSHOT.jar in your openHAB 1.7.1 runtime’s addons folder would be a problem. It ought to work under usual circumstances. Your openHAB Designer from 1.7.1 won’t consider it a valid action, but you can ignore that complaint in Designer.

0 Likes

(E. Gerland) #17

OH Designer is not the problem (currently I use 1.8. designer as well and it recognizes the “sendTelegram” action).

However after Telegram bot configuration I get the following message in openhab.log.
[o.a.telegram.internal.Telegram] - Method failed: HTTP/1.1 400 Bad Request

Any idea?

0 Likes

(Paolo Denti) #18

probably wrong chatid or token, hard to say without additional information.
how do you call sendTelegram? by a rule? can you post the rule?

0 Likes

(GianL) #19

Same here,
[o.a.telegram.internal.Telegram] - Method failed: HTTP/1.1 400 Bad Request

My rule:

rule “Send telegram with Formatted Message”
when
Item TemperaturaEnergy changed
then
sendTelegram(“bot1”, “prova prova”)
end

0 Likes

(walter) #20

Are you sure that configuration is correct? Here all is working fine.

0 Likes