New Telegram Action

Is there a way to set an interval? I have a humidity sensor which is updated almost every minute. And if it is below threshold set in rule each time i get a message. I would like to receive it only once in half an hour

You can probably manage it within the rules. I am not sure but it is reasonable you can do that.
In general a threshold is useful with telegram and other push systems (I implemented it for example in the logback telegram connector, https://github.com/paolodenti/telegram-logback) but I did not implement it here because you have all the power of rules at you disposal.

Agreed - this should be outside here!

@moskovskiy82 you also need to worry about a de-bounce solution. What you could do is have an item which stores the last time an alert was sent and whenever the humidity sensor changes check to see if the new item’s datetime is older than an hour ago.

Hi,

today I start testing telegram and got this error:

2016-04-05 17:56:38.771 [WARN ] [o.a.telegram.internal.Telegram] - Method failed: HTTP/1.1 302 Moved Temporarily

my config should be ok:

telegram:bots=openhab_bot
telegram:openhab_bot.chatId=123456789
telegram:openhab_bot.token=xxxxxxxxxxxxxxxxxxxxxxxx

rule:


sendTelegram(“openhab_bot”, “Motion 1”)

Is this only a temporarily problem or does they change the API or something else? Does anybody other get this error?

BR
–Manuel

According to RFC 2616, entity enclosing requests cannot be redirected without user intervention. The Telegram API is being POSTed to (an entity enclosing request), so the code underlying the Telegram action is not automatically following the 302 redirect.

I worked around a similar situation in the Nest binding, so the Telegram action may need a code change to handle 302 responses from HTTP POST methods. @paolo_denti, what do you think?

Sorry for the late reply, I will have a look as soon as possible

Any Updates? I still can’t use the plugin :frowning:
Does nobody else have this problem or is nobody else using this plugin?

Hi, I use it a lot and I don’t have any problem.
I’m using oh 1.8.1

Same for me. I do not find any problem.
If you have some additional information please let me know but the telegram api is clear and no 302 http code can happen.

I’m using openhab 1.8.2 with org.openhab.action.telegram-1.8.2.jar. Nothing spezial. My config:

telegram:bots=openhab_bot
telegram:openhab_bot.chatId=123456789
telegram:openhab_bot.token=xxxxxxxxxxxxxxxxxxxxxxxx

rule:


sendTelegram(“openhab_bot”, “Motion 1”)

Bot seem to be ok, I can add him with my smartphone

try to do a manual telegram api invocation using curl from command line in the openhab server and post the result

curl --data chat_id=<your chat id> --data-urlencode "text=Hello" "https://api.telegram.org/bot<your bot token>/sendMessage"

hello, can anybody help me with "Bot ‘bot1’ not defined, action skipped .

thanks for the curl tip. I figured out that it was my fault. I had a wrong token so I got this reply from the telegram API:

curl --data chat_id=123456 --data-urlencode “text=Hello” “https://api.telegram.org/botWRONGTOKEN/sendMessage

302 Found

302 Found


nginx/1.9.1

Not the best error for a wrong token …

1 Like

Hi,

I keep getting the following error when I try to send a message to telegram from an OpenHab rule.

2016-05-05 19:46:27.983 [ERROR] [o.a.telegram.internal.Telegram] - Fatal transport error: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

I have to correct config in place , tested the chatid and token from the openhab server with curl and i can send a message without any problem.

rule:
sendTelegram(“bot1”, “test message”)

OpenHab 1.8.2
telegram binding 1.8.2

UPDATE:
had to add the telegram ssl cert as a trusted cert in the java keystore

found this guide , its in french but used google translate:
http://blog.nouveauxterritoires.fr/fr/2013/11/21/gestion-des-certificats-ssl-avec-java/

When sending special Charaters via telegram, i do not get any error message, but on the client side the “Umlaut” / Special Character (ä,ö,ü) is displayed as a ? (Questionmark)
Escaping the special character will not solve the issue: (i.e : \u00c4 instead of “Ä”)

Any hint?

instead of “sendTelegram” will there be a “receiveTelegram” ?
I configured a few shortcuts for my bot, for example /leavehome.
When this message will be received, i want to get the corresponding rule to be executed.

I added some sendTelegram actions to my rules, after that I got the following errors seriously filling the log:

  • [ERROR] [x.x.scoping.XbaseScopeProvider] - error during scoping
  • [ERROR] [e.x.l.lazy.LazyLinkingResource] - resolution of uriFragment ‘xtextLink_::0.1.0.0::1::/0’ failed.

Also the rules were no longer executed.
After commenting the sendTelegram actions and deleting the sendTelegram addon, the rules worked again and no more errors.
I’m using OpenHAB 1.8.3, also Telegram action 1.8.3 on a RPi with Zwave, email and GPIO.

I don’t understand it, because it was working, including the sendTelegram actions. I don’t recall, but could it be the problem arises after upgrading to 1.8.3 from 1.8.2 ?

Any suggestions on what could be the cause of this?

I can only add that there were no code changes to the Telegram action JAR itself between 1.8.2 and 1.8.3.

It may be that there is a well hidden syntax error in your rules when they contain the sendTelegram calls. Does the openHAB Designer have any red marks showing when the rules are such that they generate these log errors?

Top suggestion Watou,
I used OpenHAB Admin voor Rule maintenance, OpenHAB Designer is better.
It pointed out 2 errors, after fixing it and activating the Telegram Action again, I had no errors!
Great, Thanks :slight_smile:

1 Like

Hey,
I just migrated from yowsup-cli (Whatsapp) to Telegram and I love it. Awsome job. I was just wondering if it would be possible to send messages to the bot and the bot will reply. e.g.
you send: temperature groundfloor
bot reply: 23,2 degrees celsius
or
you send: status front-door
bot reply: front-door CLOSED

I found a interesting link on the domoticzs homeautomation wiki page which descibes exactly that feature.

Any ideas or plans to implement such functionality?
Thanks

Edit: Just saw telegram-cli which seems to implement a deamon listening for inbound commands.

1 Like