Skip to content

Commit 88feb51

Browse files
authored
Fix Telegram bot proxy URL not initialized when creating a new bot (home-assistant#147707)
1 parent 90cbe27 commit 88feb51

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

homeassistant/components/telegram_bot/config_flow.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ async def async_step_user(
328328

329329
# validate connection to Telegram API
330330
errors: dict[str, str] = {}
331+
user_input[CONF_PROXY_URL] = user_input[SECTION_ADVANCED_SETTINGS].get(
332+
CONF_PROXY_URL
333+
)
331334
bot_name = await self._validate_bot(
332335
user_input, errors, description_placeholders
333336
)
@@ -350,7 +353,9 @@ async def async_step_user(
350353
data={
351354
CONF_PLATFORM: user_input[CONF_PLATFORM],
352355
CONF_API_KEY: user_input[CONF_API_KEY],
353-
CONF_PROXY_URL: user_input["advanced_settings"].get(CONF_PROXY_URL),
356+
CONF_PROXY_URL: user_input[SECTION_ADVANCED_SETTINGS].get(
357+
CONF_PROXY_URL
358+
),
354359
},
355360
options={
356361
# this value may come from yaml import

tests/components/telegram_bot/test_config_flow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ async def test_reconfigure_flow_broadcast(
117117
assert result["type"] is FlowResultType.ABORT
118118
assert result["reason"] == "reconfigure_successful"
119119
assert mock_webhooks_config_entry.data[CONF_PLATFORM] == PLATFORM_BROADCAST
120+
assert mock_webhooks_config_entry.data[CONF_PROXY_URL] == "https://test"
120121

121122

122123
async def test_reconfigure_flow_webhooks(

0 commit comments

Comments
 (0)