Hi!
How do I access entities id in scripts, when target are multiple entities?
One example is my snapshot script, that didn’t work.
What I want is: when my script is executed, the script takes a snapshot for all entities targets using different path’s for filename.
I’m trying this, without success:
alias: Snapshot Camera Garagem
sequence:
- service: camera.snapshot
data:
filename: "/config/www/tmp/snapshot_{{entity_id}}.jpg"
target:
entity_id:
- camera.cam_garagem
- camera.cam_poste_garagem
mode: single
icon: mdi:cctv
I’m getting this error:
Failed to call service script/snapshot_camera_garagem. Error rendering data template: UndefinedError: 'entity_id' is undefined
And this is why I’m tryinf to use template variable entity_id
, but it’s not working (see the filename field):
So my question is: how can I access target id’s inside script actions?
For automations, I know that I can use trigger.entity_id
for source of trigger…but for actions, how do I access?
Tks!