From 57d0a2ef8fafaba5f8dfb7ed2e75a3ee1d290838 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 17 Oct 2024 17:07:55 +0200 Subject: [PATCH 1/2] Remove documentation of entity_id camera action service template variable --- source/_integrations/camera.markdown | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/_integrations/camera.markdown b/source/_integrations/camera.markdown index 7467a440339c..a48ab49bf8c7 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 - 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 - 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 %} From 3588b63827f52b8ef15332dd531255176aec2218 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 17 Oct 2024 17:22:21 +0200 Subject: [PATCH 2/2] Add suggestions from the bot --- source/_integrations/camera.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/_integrations/camera.markdown b/source/_integrations/camera.markdown index a48ab49bf8c7..85caa1c4dc2c 100644 --- a/source/_integrations/camera.markdown +++ b/source/_integrations/camera.markdown @@ -104,7 +104,7 @@ For example, the following action in an automation would take a recording from " ```yaml actions: - variables: - entity_id: camera.yourcamera + entity_id: camera.yourcamera # Store the camera entity_id in a variable for reuse - action: camera.record target: entity_id: '{{ entity_id }}' @@ -132,7 +132,7 @@ For example, the following action in an automation would take a snapshot from "y ```yaml actions: - variables: - entity_id: camera.yourcamera + entity_id: camera.yourcamera # Store the camera entity_id in a variable for reuse - action: camera.snapshot target: entity_id: '{{ entity_id }}'