Need help with telegram action

I did all the config, got the http token, the chat id, i changed the openhab.cnf but when i try so sendTelegram i get an error that Bot is not defined. But i did config all 3 lines per Bot .

telegram:bots=bot1,bot2
telegram:bot1.chatId=22334455
telegram:bot1.token=xxxxxxxxxxx

I added my bot name where bot1 was and added token and id. But i still get that error everytime and i have no idea why, can someone help? Do you need some more info?

Don’t you mean “openhab.cfg”?

Did you install the Telegram action JAR? What is the specific error?

@watou the error is Bot myBotName not defiend, but i added the bot config into the cfg file. The Jar is installed, i use runtime and addon version 1.8.

Is the bot name free to choose or must it be the botname in telegram? At the moment i tried both, just to know for myself.

I don’t use the Telegram action, but maybe the action author is on the forum to answer?

The bot name is not important.
Can you post configuration/rule and logs?

From CFG FIle
telegram:bots=skycryerBot
telegram:skycryerBot.chatId=xxxxxxx
telegram:skycryerBot.token=xxxxxxx

My Rule
rule "Send telegram with Fixed Message"
when
Item telegramTest received command
then
sendTelegram(“skycryerBot”,“item Foo changed”)
end

Log
2016-01-28 12:24:43.574 [ERROR] [o.a.telegram.internal.Telegram] - Bot ‘skycryerBot’ not defined, action skipped

I can’t see any error


Do you have restarted Openhab?
Then please attention that token format is XXXXXX:XXXXXXXXXXXXXXX you need to put all also before :

Yes sorry i have this Token Format, and Openhab has been restarted.

I’m using telegram action, it’s very easy and works fine. I don’t understand the problem.

Try to change name from skycyerBot to bot1, so it’s like mine


hello, i have same problem 2016-01-28 12:24:43.574 [ERROR] [o.a.telegram.internal.Telegram] - Bot ‘openhab’ not defined, action skipped . Did you solve that , please help)) THANKS

Hi I also have the same error running OH2 and and user Id and token is right what else can be the problem with this error?

14:29:58.793 [ERROR] [ab.action.telegram.internal.Telegram] - Bot 'bot1' not defined, action skipped

Thanks

Francois

Please check configuration and token.
Do attention on space at the end of token, you can’t have it!

Hi Walter I check and I don’t have any space at the end of the token. and I still are getting the error. I know that the token and chat id is working. The only place where you configure the telegram in OH2 is on conf\services is this right?

Hi, I don’t use OH 2. I use it with 1.8 version.

I’m sure 100% that your problem is in configuration part.

I got another question concerning telegram.
If i want to publish a formatted number item (from an openhab number item, not a constant like in the example)
Example:
sendTelegram("bot1", "item Foo changed to %s and number is %.1f", Foo.state.toString, 23.56)

My action:
sendTelegram("bot1", "Power consumption: %s kWh", Consumption_Total.state.toString)

This prints the number item with all digits.
(3.77905712000000004735511538456194102764129638671875 for example
)
But I want to format the output as %.2f.

I don’t know if the sendTelegram action supports the %s type formatting. You should try

sendTelegram ("bot1", String::format("item Foo changed to %.2f and number is %.1f", (Foo.state as DecimalType), 23.56)
1 Like

Thanks Rich,
that was a good hint.
I tried a few ways and finally found a working one:

sendTelegram("bot1", "Heutiger Stromverbrauch: %.2f kWh", (Consumption_Total.state as DecimalType).floatValue)

I am using the String Format in another command:

sendTelegramPhoto("bot1", "http://localhost/graph.png", String::format("Power consumption: %.3f kWh", (Consumption_Today2.state as DecimalType).floatValue))

I solved this problem

[ERROR] [o.a.telegram.internal.Telegram] - Bot 'bot1' not defined, action skipped

I removed the spaces at the beginning of the lines from
openhab.cfg

telegram:bots=bot1
telegram:bot1.chatId=xxxxxxxx
telegram:bot1.token=yyyyyyyy
1 Like

I had the same problem.
I solved the issue even if I do not know why it worked:

  1. Let’s delete the telegram.cfg file previous created in the directory
 /etc/openhab2/services
  1. in the same directory, i created the configuration file as openhab.cfg instead of telegram.cfg. (The error message continued to appear).
  2. I renamed the openhab.cfg file to telegram.cfg with sudo mv openhab.cfg telegram.cfg command.

After this operation in the event.log screen appeared the message

2018-01-10 15: 27: 21.487 [INFO] [egram.internal.TelegramActionService] - Bot Hello_OH loaded from config file.

Hello_OH is my name bot.
Now it works perfectly. :thinking::thinking::thinking: