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
69.7k stars 28.85k forks source link

Telegram Bot Notifier detected as "Error" by "Home Assistant Repairs" when used in various Automation's #115610

Open Coolie1101 opened 2 months ago

Coolie1101 commented 2 months ago

The problem

I keep getting the following repair error for multiple automations after automations are reloaded, please note, I have been using this notifier for a few years with no issues, it is currently working as expected, and sending notifications.

Uptime Kuma Notification uses an unknown service
The automation "Uptime Kuma Notification" (automation.uptime_kuma_notification) has an action that calls an unknown service: notify.telegram.

This error prevents the automation from running correctly. Maybe this service is no longer available, or perhaps a typo caused it.

To fix this error, [edit the automation](http://hassos:8123/config/automation/edit/1651758116418) and remove the action that calls this service.

Click on SUBMIT below to confirm you have fixed this automation.

What version of Home Assistant Core has the issue?

2024.4.1

What was the last working version of Home Assistant Core?

2024.3.3

What type of installation are you running?

Home Assistant OS

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

telegram_bot:
  - platform: polling
    api_key: !secret telegram_api_key
    allowed_chat_ids:
      - !secret telegram_chat_id_me
    parse_mode: html

notify:
  - platform: telegram
    chat_id: !secret telegram_chat_id_me
    name: Telegram

action:
  - service: notify.telegram
    data:
      message: >-
        {{ trigger.to_state.attributes.friendly_name }} is now {{ 'Online' if
        trigger.to_state.state == 'up' }} {{ 'Offline' if trigger.to_state.state
        == 'down' }} {{ 'Paused' if trigger.to_state.state == 'pause' }} {{
        'Unknown' if trigger.to_state.state == 'unknown' }}

Anything in the logs that might be useful for us?

No entries in log pertaining to this error.

Additional information

Most recent notification:

USI GATEWAY is now Online

Previously reported this error as "Home Assistant Repairs" issue #115566, but was told it may be an issue with the Telegram integration itself.

home-assistant[bot] commented 2 months ago

telegram_bot documentation telegram_bot source

genebean commented 2 months ago

This sounds similar to my issue lately: it keeps showing as broken.

Logger: homeassistant.components.telegram_bot
Source: components/telegram_bot/__init__.py:376
integration: telegram_bot (documentation, issues)
First occurred: 12:13:11 PM (1 occurrences)
Last logged: 12:13:11 PM

Error setting up platform webhooks
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 373, 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 122, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/auto.py", line 30, in connect_tcp
    return await self._backend.connect_tcp(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 112, in connect_tcp
    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 1574, 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 1661, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1689, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1763, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 372, 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 86, 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 376, 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 495, in initialize
    await self.bot.initialize()
  File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 767, in initialize
    await self.get_me()
  File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 541, in decorator
    result = await func(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 902, in get_me
    result = await self._post(
             ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 629, in _post
    return await self._do_post(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 657, in _do_post
    return await request.post(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 200, in post
    result = await self._request_wrapper(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 340, in _request_wrapper
    raise exc
  File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 330, 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
dedors commented 1 week ago

Seems like I got the same issue. Sometimes it works, sometimes not.

Have you found any fix yet?