Telegram Bot - send GIF on alarm

Hi guys.

I would like to receive a GIF when the alarm is triggered. Problem is that it only sends the video from the motion which occured before the current motion.

When there was an alarm on 14:00 and an alarm on 15:00 i will receive the 14:00 alarm video on 15:00. even when i increase the alarm.

I have 3 solutions in my head :wink:

  1. I would delete the old video with a shell command. Maybe this will work.

  2. I could instead of a delay watch the folder with folder watcher. When there is a new video file it will be send to me no madder if there is an alarm or not.

  3. getting my automation to work :smiley:

automation is in post 2 because the code format does not work in this one :frowning:

- action:
  - data:
      entity_id: 'camera.xiaomi_cam'
      filename: '/tmp/alarmrecord.mp4'
      # stream_source: rtsp://10.1.1.143:554/unicast
      duration: 5
    service: camera.record
  - delay:
      seconds: 7
  - data:
      file: '/tmp/alarmrecord.mp4'
    service: telegram_bot.send_video
  alias: Alarm - Triggered - GIF Bild
  condition: []
  trigger:
  - entity_id: alarm_control_panel.home_alarm
    platform: state
    to: triggered