I directly installed the binding via PaperUI on Snapshot #1745
Ok… But with telegramAction.sendTelegramAnswer (if i click the buttons) the lastMessageUsername received a update… thats why i was wondering that the telegramAction.sendTelegramQuery does not update that username.
yes… all users i tested with, have a tg username set…
yeah, lastMessageName gets updated… lastMessageUsername not. and both only in case its not from the bot itself.
@ZzetT
It seems that formatting doesn’t work in this Lib. I have a simple message with no variables just a pure string, I have added * around some words and it doesn’t get bold when sent, it just sends it through with the asterisks in it.
This is an error message that neither comes from the binding nor from the library itself. It’s a message from the Telegram API.
However, I’m quite sure what the problem is. The library passes the URL directly to the Telegram server which then cannot access the image because you are using an URL from your local network.
Question: Don’t you have the image as a local file? In that case you could pass it as a “file://” pointing to the folder of your hard drive.
I’ll think about it. On one hand, if the image is available from a public URL, then this mechanism is quite memory efficient (otherwise we would download the image first and then send it), but I agree that this will not work for network local URLs.
Makes perfect sense. This also explains why the OH1 Telegram binding works. I took a quick look at the OH1 binding code. The OH1 binding gets the image, then posts the image to the Telegram API.
I’ll try converting to the file:// protocol. Not as flexible, of course, as I’ll need to update the path if I ever change the physical location of openHAB in my filesystem (admittedly, very unlikely ).
If this limitation was mentioned in the docs, I missed it. If it’s not in the docs, it probably should be.
Hey guys,
I’m using the OH1 action as well to send pictures from my IP-webcams using a snapshot url the webcam webgui offers.
Back then I played with curling images first and store them temporarily, but it was not as effective as the directly grabbed image from the link.
I would really love to have this feature also available in the new binding.
Thanks for your efforts so far. Happy to help with testing this feature.
Hey there,
I started playing with the binding as well. It went online right away and thing stays online as well.
I removed the old action but do receive the same error as mentioned above.
Rule 'Send telegram with Fixed Message': Instance is not an TelegramActions class.
Here are some details about my system.
OH 2.5.0M4. System restarted and rebooted.
openhab> bundle:list |grep -i telegram
284 x Active x 80 x 2.5.0.201911052119 x openHAB Add-ons :: Bundles :: Telegram Binding
openhab> things list |grep telegr
telegram:telegramBot:a1f09123 (Type=Thing, Status=ONLINE, Label=HausAUTObot, Bridge=null)
The test rule is a copy&paste from the README.
rule "Send telegram with Fixed Message"
when
Item test_switch changed
then
logInfo(filename, "Telegram rule executed")
val telegramAction = getActions("telegram","telegram:telegramBot:1f09123")
telegramAction.sendTelegram("item Foo changed")
end
Any idea to fix this would be appreciated.
Thanks much Sebastian
Shame on me. Thanks Alex.
After fixing the typo the test message get through. Even though binding spits an error:
2019-11-15 22:34:32.622 [INFO ] [marthome.model.script.telegram.rules] - Telegram rule executed
2019-11-15 22:34:33.047 [WARN ] [binding.telegram.bot.TelegramActions] - Failed to send telegram message: Bad Request: group chat was upgraded to a supergroup chat
I can’t give much support for this specific error message, because it comes directly from the Telegram Server. You can try to google it to find more information.
When trying to send to a group chat where ID starts with a minus, the message is not delivered right now. Error message is:
2019-11-15 22:44:29.680 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Send telegram with Fixed Message': An error occurred during the script execution: Could not invoke method: org.openhab.binding.telegram.bot.TelegramActions.sendTelegram(org.eclipse.smarthome.core.thing.binding.ThingActions,java.lang.Long,java.lang.String,java.lang.Object[]) on instance: null
My bot is admin of the group.
Then I tried get_id bot to confirm the group chat ID and received a different ID, but also starting with minus. But this time the group chat ID was not 9 numbers, but 13.
2019-11-15 22:52:03.052 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Send telegram with Fixed Message': An error occurred during the script execution: Integer literal is out of range: 1001315583123
Dont know if this can be done easily… but wouldn’t it be better to let the binding convert from chat ID to the long value… maybe easier for most of the users? wdyt?
This is something related to the OH environment/rule engine which is based on Java.
Having a method which takes an Integer (where no “L” is required) and converts to a Long doesn’t work, because then the number is already casted to 32 bit and the information is lost. Having a method that takes the chat Id as a String is also not so easy because 1. everbody would need to adapt their existing rules 2. some APIs would become ambiguous, because currently you can call sendTelegram() with two Strings (message + format) but if it is also chat id (as String) + message, then we would need to give the API another suffix to make it unambiguous again.
Running openhab 2.5~M5 on Proxmox VE 5.4 Debian 9 container. All the files are there and permissions are fine. I’ve restarted a few times and cleared the cache to be sure but nothing.
Edit: Downloaded latest bundle from jfrog and dropped into addons folder and everything seems to work. Must be something with karaf.