Re-send telgram notification on failure

Hey, guys!

I have an automation that sends frigate videos to telegram. Everything is going fine except sometimes I’m experiencing connection problems or timeouts like this:

2023-11-05 10:42:03.095 ERROR (SyncWorker_3) [homeassistant.components.telegram_bot] Can't send file with kwargs: {'caption': 'Видео события', 'url': '', 'timeout': 240}

I already have timeout of 4 mins, so I’m not sure if it is good idea to increase it further, also connection problems may occur from time to time, since this is a not a small file.

My idea: since telegram integration does not allow re-sending itself, is it possible to detect failure on HA automation level and retry it? Ideally it would be cool if I could set max retry attempts. Thanks

Here is my setup:

service: telegram_bot.send_video
  caption: Video
  url: >-{{trigger.payload_json["after"]["id"]}}/clip.mp4
    - chat_id
  timeout: 240
alias: Send video
1 Like