I find a simple way to take a snapshot of each camera integrated in home assistant.
Create an automation to set a group of all your cameras when HA starts
alias: Survillance - Create cams group
description: ""
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: group.set
data_template:
object_id: all_cams
entities: |-
{%- for s in states.camera
if ('camera' in s.entity_id or 'cam' in s.entity_id)%}
{{s.entity_id}}{% if not loop.last %}, {% endif %}
{%- endfor %}
mode: single
Create a button card in lovelace that call the camera.snapshot service for the group above
Your group set won’t work either: You need to actually give the service a list, e.g.:
entities: "{{ states.camera | map(attribute='entity_id') | list }}"
Unless you’re going to use the group for other things, you don’t really need the extra complexity of the automation, so you can just use the above in your snapshot service call.
You can’t directly act on the group in this way, but by expanding it you’re making it a list that the snapshot service can deal with.
Yes you can via lovelace card… your example doesn’t work…
Unless you’re going to use the group for other things, you don’t really need the extra complexity of the automation, so you can just use the above in your snapshot service call.
you are right but my example is an inspiration to create sub-categories of cameras such as internal or external replacing the loop criteria:
if ('camera' in s.entity_id or 'cam' in s.entity_id)