Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106694

Camera service call can't use template entity

$
0
0

Hoping someone can help me out. Been trying this for 2 days now without any result.
I’m trying to make a script that makes a snapshot / recording of a camera with 2 parameters: Record or snapshot & camera entity.

No matter what I do the script seems to fail when I call the camera service.
This is my full script:

alias: Camera to telegram
sequence:
  - variables:
      file_path: >-
        /media/snapshots/{{camera_entity}}_{{now().strftime("%Y%m%d-%H%M%S")}}{{'jpg'
        if record_or_snapshot == 'snapshot' else 'mp4'}}
  - choose:
      - conditions:
          - condition: template
            value_template: "{{record_or_snapshot == 'snapshot'}}"
            alias: If snapshot
        sequence:
          - service: camera.snapshot
            metadata: {}
            data:
              filename: "{{file_path}}"
            target:
              entity_id: "{{camera_entity}}"
      - conditions:
          - condition: template
            value_template: "{{record_or_snapshot == 'record'}}"
            alias: If record
        sequence:
          - service: camera.record
            metadata: {}
            data_template:
              filename: "{{file_path}}"
              duration: 30
              lookback: 0
              entity_id: "{{camera_entity}}"
  - service: telegram_bot.send_video
    data:
      authentication: digest
      file: "{{file_path}}"
    alias: Send recording to telegram group
  - service: delete.file
    data:
      file: "{{file_path}}"
      no_warn: true
    alias: Delete recording
fields:
  camera_entity:
    selector:
      target: {}
    name: Camera Entity
    required: true
    default:
      entity_id:
        - camera.driveway_main
        - camera.front_door_main
  record_or_snapshot:
    selector:
      select:
        options:
          - snapshot
          - record
    name: Record or snapshot
    required: true
mode: parallel
icon: mdi:record-rec
max: 10

When I call the script I get the following error:

Can someone please tell me how I can use a template target entity?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106694

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>