home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.32k stars 30.27k forks source link

Telegram is failing to set up #127705

Open tomlut opened 3 days ago

tomlut commented 3 days ago

The problem

This was working until the 2024.10.1 update.

Logger: homeassistant.components.telegram_bot
Source: components/telegram_bot/__init__.py:389
integration: Telegram bot (documentation, issues)
First occurred: 12:53:48 (1 occurrences)
Last logged: 12:53:48

Error setting up platform webhooks
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 72, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 377, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request
    raise exc from None
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request
    response = await connection.handle_async_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
    stream = await self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 154, in _connect
    stream = await stream.start_tls(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 68, in start_tls
    with map_exceptions(exc_map):
  File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/usr/local/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/telegram/request/_httpxrequest.py", line 276, in do_request
    res = await self._client.request(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1585, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1674, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1702, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1739, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1776, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 376, in handle_async_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 89, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/telegram_bot/__init__.py", line 389, in async_setup
    receiver_service = await platform.async_setup_platform(hass, bot, p_config)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/telegram_bot/webhooks.py", line 40, in async_setup_platform
    await pushbot.start_application()
  File "/usr/src/homeassistant/homeassistant/components/telegram_bot/webhooks.py", line 94, in start_application
    await self.application.initialize()
  File "/usr/local/lib/python3.12/site-packages/telegram/ext/_application.py", line 503, in initialize
    await self.bot.initialize()
  File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 777, in initialize
    await self.get_me()
  File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 909, in get_me
    result = await self._post(
             ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 623, in _post
    return await self._do_post(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 652, in _do_post
    result = await request.post(
             ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 201, in post
    result = await self._request_wrapper(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 333, in _request_wrapper
    code, payload = await self.do_request(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/request/_httpxrequest.py", line 293, in do_request
    raise TimedOut from err
telegram.error.TimedOut: Timed out

What version of Home Assistant Core has the issue?

core-2024.10.1

What was the last working version of Home Assistant Core?

core-2024.9.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Telegram

Link to integration documentation on our website

https://www.home-assistant.io/integrations/telegram_webhooks/

Diagnostics information

No response

Example YAML snippet

notify:
- platform: telegram
  name: telegram_system_log
  unique_id: 9926af3b-ef60-4873-b646-e7a8b7b37037
  chat_id: !secret telegram_system_log_chat_group_id

- platform: telegram
  name: telegram_alert
  unique_id: 3e09bf4f-0e45-42ba-9868-b228d62021d0
  chat_id: !secret telegram_alert_chat_group_id

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 days ago

telegram_webhooks documentation telegram_webhooks source