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
71.09k stars 29.75k forks source link

Error sending messages from Telegram bot #122876

Open riopedre opened 1 month ago

riopedre commented 1 month ago

The problem

Some of the messages I send to Telegram using Telegram bot are missing in a random way. I was using notify service. Changed to telegram_bot.send_message service but it fails the same. I have updated to last core version with the same result.

What version of Home Assistant Core has the issue?

core-2024.7.4

What was the last working version of Home Assistant Core?

No response

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_one
      - !secret telegram_chat_id_two

notify:
  - name: telegram_one
    platform: telegram
    chat_id: !secret telegram_chat_id_one
  - name: telegram_two
    platform: telegram                          
    chat_id: !secret telegram_chat_id_two

Anything in the logs that might be useful for us?

Registrador: homeassistant.components.telegram_bot
Fuente: components/telegram_bot/__init__.py:717
integración: Telegram bot (documentación, problemas)
Ocurrió por primera vez: 20:34:05 (2 ocurrencias)
Último inicio de sesión: 20:34:10

Error sending message: Timed out. Args: (Id_one, 'Subiendo la persiana izquierda de la terraza...'), kwargs: {'parse_mode': <ParseMode.MARKDOWN>, 'disable_web_page_preview': None, 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': 60, 'message_thread_id': None}
Error sending message: Timed out. Args: (Id_two, 'Subiendo la persiana izquierda de la terraza...'), kwargs: {'parse_mode': <ParseMode.MARKDOWN>, 'disable_web_page_preview': None, 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': None, 'message_thread_id': None}

Additional information

I'm using a script that send the same message to two different people with different chat_id according to the state of two helpers that enable the sending of the message. In one of the chats I've added 'timeout: 60'. I think that when a message fails, is in both chats but I'm not sure about that.

home-assistant[bot] commented 1 month ago

telegram_bot documentation telegram_bot source

riopedre commented 1 month ago

I have made a new telegram bot two days ago, and changed telegram api key to use new bot. Today I've lost one message. "Error sending message: Timed out" again

titovskiy commented 3 weeks ago

have same problem (ha 2024.8.1)

Error sending message: Timed out. Args: (XXXX, 'HA запущен'), kwargs: {'parse_mode': <ParseMode.MARKDOWN>, 'disable_web_page_preview': None, 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': None, 'message_thread_id': None}

paule1120 commented 3 weeks ago

Hello, same error . Sometimes after a restart it works better and sometimes nothing happens

`Logger: homeassistant.components.telegram_bot Quelle: components/telegram_bot/init.py:717 Integration: Telegram bot (Dokumentation, Probleme) Erstmals aufgetreten: 17. August 2024 um 21:08:50 (4 Vorkommnisse) Zuletzt protokolliert: 16:42:20

Error sending message: Timed out. Args: (TG id, 'Das Fenster im Bad ist seit 10min offen! 23.8°C / 72.4%'), kwargs: {'parse_mode': , 'disable_web_page_preview': None, 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': None, 'message_thread_id': None} Error sending message: Timed out. Args: (TG id7, 'Das Fenster im Bad ist seit 10min offen! 22.3°C / 76.4%'), kwargs: {'parse_mode': , 'disable_web_page_preview': None, 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': None, 'message_thread_id': None} Error sending message: Timed out. Args: (TG id, 'Das Fenster im Bad ist seit 10min offen! 22.6°C / 73.5%'), kwargs: {'parse_mode': , 'disable_web_page_preview': None, 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': None, 'message_thread_id': None} Error sending message: Timed out. Args: (TG id, 'Die Außentemperatur beträgt zur Zeit 19.0 °C / Garten: 18.4°C / Hof: 18.4 °C'), kwargs: {'parse_mode': , 'disable_web_page_preview': None, 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': None, 'message_thread_id': None}`

dadada3000 commented 3 weeks ago

Same thing Error sending message: Timed out.

sejtam commented 2 weeks ago

same here (with 2024.8.2) . one test message worked, after that nothing

2024-08-20 09:58:41.952 ERROR (MainThread) [homeassistant.components.telegram_bot] Error sending message: Timed out. Args: (-4....1, 'test2'), kwargs: {'parse_mode': <ParseMode.MARKDOWN>, 'disable_web_page_preview': None, 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': None, 'message_thread_id': None}

riopedre commented 2 weeks ago

Approximately 90% of my automations are in Node Red. Until now Telegram notifications were done by calling a Home Assistant script. Last Sunday, I changed these notifications to Node Red directly using nodes from the 'node-red-contrib-telegrambot' palette. Since that moment and after four days, I have not missed any Telegram notifications. I think this indicates that there is a problem with the Home Assistant Telegram_bot integration. Perhaps a library that this integration depends on has recently changed and this error is a side effect. Who knows

aquashrimps commented 2 weeks ago

the exact same error occurs when sending service messages. At the same time, no such error occurred before the update (2024.6.1 for sure). `homeassistant.components.telegram_bot Source: components/telegram_bot/init.py:717 Integration: Telegram bot (Documentation, problems)

Error sending message: Timed out. Args: (1087794605, '🌍 san xxxxxxxxxxxxxxx'), kwargs: {'parse_mode': , 'disable_web_page_preview': None, 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': None, 'message_thread_id': None}`

Core 2024.8.3 Supervisor 2024.08.0 Operating System 13.1