mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Bug fix for Telegram bot integration: fix async_unload_entry error for polling bot (#146277)
* removed reload from update_listener * removed reload from update_listener
This commit is contained in:
parent
1fa55f96f8
commit
0f27d0bf4a
@ -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(
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user