diff --git a/homeassistant/components/telegram_bot/__init__.py b/homeassistant/components/telegram_bot/__init__.py index d4e3e2afd07..655dfb7a260 100644 --- a/homeassistant/components/telegram_bot/__init__.py +++ b/homeassistant/components/telegram_bot/__init__.py @@ -447,7 +447,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: TelegramBotConfigEntry) async def update_listener(hass: HomeAssistant, entry: TelegramBotConfigEntry) -> None: """Handle options update.""" - await hass.config_entries.async_reload(entry.entry_id) + entry.runtime_data.parse_mode = entry.options[ATTR_PARSER] async def async_unload_entry( diff --git a/homeassistant/components/telegram_bot/bot.py b/homeassistant/components/telegram_bot/bot.py index 1c8684f9a4e..35f4a6475d1 100644 --- a/homeassistant/components/telegram_bot/bot.py +++ b/homeassistant/components/telegram_bot/bot.py @@ -238,7 +238,7 @@ class TelegramNotificationService: PARSER_MD2: ParseMode.MARKDOWN_V2, PARSER_PLAIN_TEXT: None, } - self._parse_mode = self._parsers.get(parser) + self.parse_mode = self._parsers.get(parser) self.bot = bot self.hass = hass self._last_message_id: dict[int, int] = {} @@ -350,7 +350,7 @@ class TelegramNotificationService: # Defaults params = { - ATTR_PARSER: self._parse_mode, + ATTR_PARSER: self.parse_mode, ATTR_DISABLE_NOTIF: False, ATTR_DISABLE_WEB_PREV: None, ATTR_REPLY_TO_MSGID: None, @@ -362,7 +362,7 @@ class TelegramNotificationService: if data is not None: if ATTR_PARSER in data: params[ATTR_PARSER] = self._parsers.get( - data[ATTR_PARSER], self._parse_mode + data[ATTR_PARSER], self.parse_mode ) if ATTR_TIMEOUT in data: params[ATTR_TIMEOUT] = data[ATTR_TIMEOUT] diff --git a/homeassistant/components/telegram_bot/polling.py b/homeassistant/components/telegram_bot/polling.py index f6435c16d82..f9e69080939 100644 --- a/homeassistant/components/telegram_bot/polling.py +++ b/homeassistant/components/telegram_bot/polling.py @@ -19,7 +19,7 @@ async def async_setup_platform( """Set up the Telegram polling platform.""" pollbot = PollBot(hass, bot, config) - config.async_create_task(hass, pollbot.start_polling(), "polling telegram bot") + await pollbot.start_polling() return pollbot