New Telegram Binding - Tester and Feedback welcome

Thank you very much! Now I’m starting to get the idea how this binding works!

I will try it now. I just need two, because usually one is used for important messages, like alarm, and the other one is just for testing things and some not that important messages (like a summary at the end of the day, etc…)

@ZzetT
It seems that I got it running! I don’t know what was wrong. I have removed one bot, nothing changed. Restarted openHAB, now it works normally, even when I added back my other bot. Thanks!

One last question. Can I add more than 2 replies to the question?

Great to hear that!

Yes, it’s a variable number of arguments.

Thank you!

Hey @ZzetT
will this binding also work with the latest snapshot of OH?

just asking because there were changes from ESH to OHcore… did someone tested it on the latest snapshots?

Thanks

@ZzetT
I have been running succesfully this binding now.
However I have found some problems:

  • If I want to send multiple messages to multiple bots, it won’t really work and will send it to a random one… (maybe some race condition there?)
  • I have a Telegram Group message with the family in it and also the bot. However it seems that with a group, this will not work (only difference is that the chatId is negative number). It can send messages, but the reply never received by openHAB. I think it have to behave the same way. The first person presses the reply and the bot handles that… or this is supported but I don’t really know how I should use this?

Ps.: Investigating the issue, it seems that the Binding got stuck somewhere. Trying out the previous working bot, it also not working there. Refreshed the binding, now the replies arrives on the 2 bots as well, but now I again get the Instance is not a TelegramActions class error… Got it working again, the problem is this:

  • The binding will not work if I refresh it via Karaf console (if I restart the whole openHAB, it starts
    working again - tested this multiple times). - It will show the not a TelegramActions class error.
  • The binding sometimes however stops updating messages. - This also happens after a few days. The binding can send messages, but never receives one. No log related to this…

I also made some tests:

  • 1 Chat : fully working
  • 1 Group Chat : seems fully working w/o problems as normal chat
  • 2 Chats same botUsername (1 thngs) : working but sending message to both chat always
  • 2 Chats, different botUsername (2 things) : partially working sending message just to the requested chat (not stable) but many errors on logs

It am very interested in having the possibility to send some messages to a Group Chat of the family and some messages just to my Chat. This seems not working properly now.
Let us know if this features will be implemented.
Regards
Lorenzo

Hey @rkrisi and @Foxejoe,
I didn’t reply yet because I’m still struggling a bit with getting all dependencies and features correct so that I can run it again on the latest OH version. I hope you understand that this has highest priority for me at the moment.

Yes, maybe that was related to a long running shutdown in the Telegram library that should be fixed now. But I’ll test it again as soon as I have a working environment.

Yes, I can confirm this. I also see sporadic failures in my event log. It could be related to the version that you have where I rewrote the library using a jetty client. As we decided already, we go back to the original library, I’ll try it out if I get it running again and will have an eye on it.

Yes, I agree. I think we will extend the API a bit so that you can also send it to a specific chat and not to all. Not sure if we should directly use the chat id or if we should try to give each chat id a certain name that is passed to the API then.

Maybe you are right. I only tested it with one thing.

I’ll get back to you!

1 Like

@ZzetT Yes I saw that on GitHub. Not a real big problem for me, because basically the sending works almost every time, so I can live without this for weeks. It’s good to know that you didn’t abandon the work!
Also it is good to know that these are real bugs in the binding and not I messed up something during config.

Thank you!

Sending photo is working with this version? I get an error when I try to send a photo (thought it is the TelegramBots which throws an error during deserialization…

That should indeed work. What is the exact source of the picture? Local file system? Url? Could you post your code, please?

My bad I think. I wanted to send a Chart item from openhab, but that is not actually a picture, but an html img. Do you maybe know how I could send that?

Please check out the readme which contains many examples (at the end) and let me know if there is something unclear or wrong: https://github.com/ZzetT/openhab2-addons/blob/master/bundles/org.openhab.binding.telegram/README.md

Yes thanks I saw that, this is where I got the intial setup :slight_smile: My problem or question is aimed at, does someone know how I could get an actual picture of a Chart item from openHAB, because I haven’t found solution for this. That’s why I think I couldn’t send it (because it is not a primitive picture format (like png, jpg, etc…).

@ZzetT
One more question: does the functions have some return value? If I remember correctly I used the return value to detect (boolean) if the message is sent successfully or not. Can I use it like this in this version also?
I see sometimes an error which seems to be a temporary API error, because seconds later it works as it should…

Hey, tried to add as thing but it fails on the input field “chatId” if I type the known chat id, the save butten won’t get enabled. discovery of known chats also doesn’t work. Seems that the binding doesn’t get a result from my bot. Bot is still active (have tried by using: sendTelegram(…,…)). Any idea what goes wrong?

Edit: Adding the thing manually via .things file works for me. Receiving messages works great so far :slight_smile: But I also have issues when trying to send messages via the new actions. Getting the same error as someone mentioned before: Instance is not an TelegramActions class.

1 Like

You probably have still installed the old binding or an older version of the new one.
Regards
Lorenzo

Where can I find the latest Version of the Binding? A static link would be cool

1 Like

Agree. I’m on OH 2.5 (upgrading since 2.1) and am having issues with the binding at the moment, as no messages are being sent out. Where can I download the latest binding version?

Hello,

I’ve this working now but how can I convert the old syntax into a working one. With the state of an item.

sendTelegram("jeroen", "Oh je, %s staat nog steeds niet aan straat!", Abfall12.toString)