Camera Snapshot to Telegram not working

I am trying to send myself een screenshot or more than one when motion sensor is triggered. The screen is being taken and stored on the HASS local drive. But how do name the filename in the Telegram part?

The receiving a Telegram part work with other automations. Just not in this one.

Trace just tells me after the screenshot “unknown”.

Side question: if i would only want to send a Telegram with screenshot when human detected i will need a Coral thing right?

Any ideas?

alias: Snapshot - Voordeur
description: ""
trigger:
  - type: motion
    platform: device
    device_id: 32496862d964d150da13963ddc0d5b77
    entity_id: bb8870e05d36e60c94a3c462a9a0c2a3
    domain: binary_sensor
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: camera.snapshot
    data:
      filename: >-
        /media/snapshots/voordeur/voordeur_{{ now().strftime("%Y%m%d-%H%M%S")
        }}.jpg
    target:
      device_id: 450715b3ac1f0bbe24951a652a02f7fb
  - service: notify.telegram_bericht_nick
    data:
      message: Bezoeker voordeur
      title: Iemand aan de deur
      data:
        photo:
          - file: >-
              /media/snapshots/voordeur/voordeur_{{
              now().strftime("%Y%m%d-%H%M%S") }}.jpg
            capture: Snapshoot
  - repeat:
      until:
        - type: is_no_motion
          condition: device
          device_id: 32496862d964d150da13963ddc0d5b77
          entity_id: bb8870e05d36e60c94a3c462a9a0c2a3
          domain: binary_sensor
      sequence: []
mode: single

What is this?

  - repeat:
      until:
        - type: is_no_motion
          condition: device
          device_id: 32496862d964d150da13963ddc0d5b77
          entity_id: bb8870e05d36e60c94a3c462a9a0c2a3
          domain: binary_sensor
      sequence: []

It is going to loop extremely fast (as there are no actions or delays in the loop) and consume a lot of cpu and memory.

I tried to make it send pictures for as long as the motion sensor detects motion. I did think about using a 2 sec delay.

I am also trying to use my ring camera to take the picture from. But that image is black and white. The ring camera entity is not a the live feed i think. But i am not seeing the live feed entity.

You actions are not in the repeat loop. You need to do this:

alias: Snapshot - Voordeur
description: ""
trigger:
  - type: motion
    platform: device
    device_id: 32496862d964d150da13963ddc0d5b77
    entity_id: bb8870e05d36e60c94a3c462a9a0c2a3
    domain: binary_sensor
condition: []
action:
  - repeat:
      until:
        - condition: or
          conditions:
            - type: is_no_motion
              condition: device
              device_id: 32496862d964d150da13963ddc0d5b77
              entity_id: bb8870e05d36e60c94a3c462a9a0c2a3
              domain: binary_sensor
            - condition: template # you do not want this to go forever if something goes wrong. So set a maximum number of loops. Like 30
              value_template: "{{ repeat.index > 30 }}"
      sequence:
        - delay:
            hours: 0
            minutes: 0
            seconds: 5
            milliseconds: 0
        - service: camera.snapshot
          data:
            filename: >-
              /media/snapshots/voordeur/voordeur_{{ now().strftime("%Y%m%d-%H%M%S")
              }}.jpg
          target:
            device_id: 450715b3ac1f0bbe24951a652a02f7fb
        - service: notify.telegram_bericht_nick
          data:
            message: Bezoeker voordeur
            title: Iemand aan de deur
            data:
              photo:
                - file: >-
                    /media/snapshots/voordeur/voordeur_{{
                    now().strftime("%Y%m%d-%H%M%S") }}.jpg
                  capture: Snapshoot
mode: restart

You also don’t want to spam telegram. One message every 5 seconds is on the upper side of reasonable.

If spamming TG is not wise, could we change it to 3 picture, one every seconde and then stop (after the ring dong press)? So not based on the motion sensor.

And do you know what the entity to use is to use the ring cam for instead of my dahua cam?

Many thanks so far!

EDIT: Could use the stop template part. Right?