diff --git a/source/_integrations/camera.markdown b/source/_integrations/camera.markdown index 7467a440339..85caa1c4dc2 100644 --- a/source/_integrations/camera.markdown +++ b/source/_integrations/camera.markdown @@ -91,7 +91,7 @@ Both `duration` and `lookback` options are suggestions, but should be consistent | Data attribute | Optional | Description | | -------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `entity_id` | no | Name(s) of entities to create a snapshot from, e.g., `camera.living_room_camera`. | -| `filename` | no | Template of a file name. Variable is `entity_id`, e.g., {% raw %}`/tmp/{{ entity_id.name }}.mp4`{% endraw %}. | +| `filename` | no | Recording file name. | | `duration` | yes | Target recording length (in seconds). Default: 30 | | `lookback` | yes | Target lookback period (in seconds) to include in addition to duration. Only available if there is currently an active HLS stream. Default: 0 | @@ -103,11 +103,13 @@ For example, the following action in an automation would take a recording from " ```yaml actions: + - variables: + entity_id: camera.yourcamera # Store the camera entity_id in a variable for reuse - action: camera.record target: - entity_id: camera.yourcamera + entity_id: '{{ entity_id }}' data: - filename: '/tmp/{{ entity_id.name }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.mp4' + filename: '/tmp/{{ entity_id }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.mp4' ``` {% endraw %} @@ -119,7 +121,7 @@ Take a snapshot from a camera. | Data attribute | Optional | Description | | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------ | | `entity_id` | no | Name(s) of entities to create a snapshot from, e.g., `camera.living_room_camera`. | -| `filename` | no | Template of a file name. Variable is `entity_id`, e.g., {% raw %}`/tmp/snapshot_{{ entity_id.name }}`{% endraw %}. | +| `filename` | no | Snapshot file name. | The path part of `filename` must be an entry in the `allowlist_external_dirs` in your [`homeassistant:`](/integrations/homeassistant/) section of your {% term "`configuration.yaml`" %} file. @@ -129,11 +131,13 @@ For example, the following action in an automation would take a snapshot from "y ```yaml actions: + - variables: + entity_id: camera.yourcamera # Store the camera entity_id in a variable for reuse - action: camera.snapshot target: - entity_id: camera.yourcamera + entity_id: '{{ entity_id }}' data: - filename: '/tmp/yourcamera_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg' + filename: '/tmp/{{ entity_id }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg' ``` {% endraw %}