core
core copied to clipboard
Parsing bug in integration for telegram_bot
The problem
When sending messages using Telegram_bot underscores in the text is enterpreted as markdown tags even if no parser mode has been selected. If the message contains unmatched tags an error similar to this is logged: "Error sending message: Can't parse entities: can't find end of the entity starting at byte offset 207. Args: (294154381,... "
If parsing mode HTML is selected and unmatched HTML-tags are found a more reasonable error is logged : "Error sending message: Can't parse entities: can't find end tag corresponding to start tag b. Args: (294154381... "
I detected this when using the blueprint Tahutipai/ zigbee_zwave_notify_when_battery_devices_have_fallen_offline.yaml (https://gist.github.com/Tahutipai/971bf0e07e50ce6190e0dacd73262e2e) that sends a list of devices as message - and it makes it hard to always make it so it has matching tags ;)
(Note that the Telegram_bot integration docs does not mention that text is always parsed as markdown if no parse mode has been set)
What version of Home Assistant Core has the issue?
core-2024.1.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
Telegram_Bot
Link to integration documentation on our website
https://www.home-assistant.io/integrations/telegram_bot
Diagnostics information
No response
Example YAML snippet
service: telegram_bot.send_message
data:
message: <b>X_02
title: Message from HA
Anything in the logs that might be useful for us?
No response
Additional information
No response
The default parser is markdown service-wide. I didn't want to change that default, but have added an option for sending plain text messages to the parsers.