New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telegram response to bot is truncated #10486
Comments
What you posted in https://discord.com/channels/479389167382691863/490244847568158751/797881187636609035 is concistent with some tool "on the way" cutting off the string at the # character, not too unusual as a delimiter. Did you check the actual MQTT message emanating from Tasmota? |
The "on the way" tool I used, and the screenshot I provided happens to be the official Telegram app (Android). MQTT has nothing to do with my usage of Telegram because, as mentioned above in the "TO REPRODUCE" section, I built Tasmota 9.2.0 with Telegram support and am relying on the builtin support for Telegram in Tasmota for sending a Telegram message directly from the Tasmota console or receiving in my mobile phone a message as a response from Tasmota. |
Findings from discussion here: https://discord.com/channels/479389167382691863/490244847568158751/797897053921345607 It seems the Tasmota command - tmsend test1test1test1test1test1 # test22222222 #test33333333 causes the truncated message test1test1test1test1test1 to be received in Telegram and the command - tmsend test1test1test1test1test1 %23 test22222222%23test33333333 causes tmsend test1test1test1test1test1 # test22222222#test33333333 to be received. In the latter case, the "#" has been URLEncoded in the command, and the message received is the expected message. This leads me to believe that the Telegram API call from the Tasmota Telegram Driver is currently not being URLEncoded, and some special characters in the query parameters of the Telegram API could cause it to lose information or fail. |
Fix telegram response using UrlEncode (#10486)
Thx for providing the needed information. Latest development commit adds UrlEncode to any text send from Tasmota to Telegram. Pls try. BTW Nice rule1 usage!!! |
Closing the issue as it is fixed. :-) |
May I ask which defines have to be added before compiling to get telegram functionality and is there a doc? |
There's no official doc yet, AFAIK. I found this #8619 and then I looked through the source-code to figure it out :) EDIT: here's some documentation: #8619 (comment) |
Thank you very much! Tasmota rocks! |
Do you know if this works in Tasmota32 or how I can find out if it works? I'm new in the Tasmota-Universe and didn't dive deep into it by now |
Yes, it does. A sure way to find out is to flash it on your device and try it. I just did :) Once flashed, you need to setup your telegram token and chat id with two commands (from web-console or MQTT): TmToken <token> // <token> is without the "bot" prefix (didn't work with the prefix) Next, you will have to enable Telegram Send/Receive with the TmState command: TmState <state> // <state> can be 0 to 5
|
Thanks a lot |
Would be nice to have Telegram functionality on tasmota32-webcam builds to send pictures. I found several examples for arduino so it should be possible...where would be the right place to communicate a feature request? |
Feature requests should go to Ideas in Discussions. Thanks. |
Hello , I can send info from tasmota to telegram, but not from telegram to tasmota. |
Which command did you send? You can send Tasmota commands like "Power1 1" |
Yes I tried rule1 , power1 1 but nothing .From Tasmota command tmsend works fine without problems |
Is your ChatId correct? Perhaps Tasmota filters commands from unauthorized (unknown) ChatIDs |
I tried change last numbers of my chatid and still getting messages from Tasmota so maybe is that problem. How can easily get chatid? |
Search for "IDBot" in Telegram and start a conversation with the bot. Type "/getid" to get your ChatID and enter it in Tasmota |
Thank you , so my chatid is correct! 🙄 |
I just saw it. You have to disable ECHO --> {"TmState":{"Send":"ON","Receive":"ON","Echo":"OFF"}} --> TmState 4 |
Hello, my telegram integration stopped working on all tasmota devices two days ago. Before was all fine , i didn't get any update or setting. I'm only one with this problem? |
Any logs? |
I confirm it stopped working.
Is there something else I can try? PS: Using Tasmota 9.3.1.2 |
I printed a part of the response from the call to Telegram API (sendMessage) in the telegram driver, and this is what I got:
Shouldn't this be a JSON instead of HTML ? |
Yes indeed, it should be JSON. Maybe the API requires an additional parameter to force JSON |
The API works if you try the same URL that is being called from Tasmota (https://api.telegram.org/bot[token]/sendMessage?chat_id=[chatId]&text=test), from a browser. So additional parameter doesn't seem to be the issue. |
Maybe the HTML contains some error message indicating a failure before even coming to the API. I've seen such from other web services unable to execute a call I posted. |
I have added a screen-shot of the complete HTML in the issue I raised, here: #12451 |
That indeed looks like a generic message page instead of API output. May be an error on the Telegram end. |
The error should then appear even when calling the Telegram API GET request from the browser. However, it works fine if you hit the URL https://api.telegram.org/bot[token]/sendMessage?chat_id=[chatId]&text=test) from a browser, or even a |
Let's discuss further in issue #12451 |
PROBLEM DESCRIPTION
A clear and concise description of what the problem is.
Tasmota's Telegram response is truncated as viewed in the Telegram mobile app.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:Status 0
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log:TO REPRODUCE
Steps to reproduce the behavior:
After building Tasmota 9.2.0 with Telegram support, set it up with token and chatid, and confirm that messages can be sent both ways.
Setup a simple rule such as "Rule3 on power1#state=1 do power2 on endon".
Now send the message "Rule3" from Telegram (bot) on mobile phone.
See that the response message received in the mobile after a couple seconds is truncated, like -
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen.
The response received should be complete, for example,
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
ADDITIONAL CONTEXT
Add any other context about the problem here.
(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: