filename has to have .name in variable (#14145)

if it is only entity_id = /tmp/snapshot_<Entity m5_cam_i: idle> which is wrong, however entity_id.name is nice /tmp/snapshot_m5_cam_i
This commit is contained in:
Cooper Dale 2020-08-03 17:48:05 +02:00 committed by GitHub
parent 9932cd75a9
commit 210025257f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,7 +73,7 @@ Both `duration` and `lookback` options are suggestions, but should be consistent
| Service 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 }}.mp4`{% endraw %}. |
| `filename` | no | Template of a file name. Variable is `entity_id`, e.g., {% raw %}`/tmp/{{ entity_id.name }}.mp4`{% endraw %}. |
| `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 |
@ -87,7 +87,7 @@ action:
service: camera.record
data_template:
entity_id: camera.yourcamera
filename: '/tmp/{{ entity_id }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.mp4'
filename: '/tmp/{{ entity_id.name }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.mp4'
```
{% endraw %}
@ -98,7 +98,7 @@ Take a snapshot from a camera.
| Service 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 }}`{% endraw %}. |
| `filename` | no | Template of a file name. Variable is `entity_id`, e.g., {% raw %}`/tmp/snapshot_{{ entity_id.name }}`{% endraw %}. |
The path part of `filename` must be an entry in the `allowlist_external_dirs` in your [`homeassistant:`](/docs/configuration/basic/) section of your `configuration.yaml` file.