Telegram bot rejects all messages like this:
Error sending message: Can't parse entities: can't find end of the entity starting at byte offset 43. Args: (510914350, '*Alarm System status*\nAlarm status is armed_home'), kwargs: {'parse_mode': 'Markdown', 'disable_notification': True, 'disable_web_page_preview': None, 'reply_to_message_id': None, 'reply_markup': <telegram.inline.inlinekeyboardmarkup.InlineKeyboardMarkup object at 0x70013130>, 'timeout': None}
In order to fix this I changed armed_home to armed home. Is this a known bug or limitation?
Have you tried changing parse mode to html?
not yet, I can live with my str replcae “_” with " "…
Qua3952
September 25, 2019, 6:25am
4
If still a concern, I can confirm setting parse_mode to html works but I prefer a utility function like:
def escape_telegrambot_underscore(self, txt):
return txt.replace("_", "\\_")
So I can still make other text bold using an asterisk…
1 Like
henry8866
(henry)
November 18, 2019, 3:06pm
5
I’m having exact same issue. Could anyone help on detail how to fix this? I am using data_template in automation.yaml.
Thanks!
Change the parse_mode to html.
Tomas_RT
(Tomas RT)
September 11, 2021, 6:41pm
7
I have the same problem,
I don’t find any solution, in StackOverFlow, Telegram Docs, Google yet
VangelisP
(VangelisP)
August 25, 2024, 9:26am
8
Although this issue is quite old, I had the same situation today with my Alarmo integration not sending telegram notifications (worked in test mode but not in live mode).
Then after some fiddling, I got this:
action: notify.telegram_bot
data:
message: "Yay! A message from Home Assistant."
data:
parse_mode: html
Please do note the second data attribute where I pass the parse_mode
. I hope it helps someone.
1 Like