Hello brains trust.
I am wanting to modify a large community blueprint for Frigate Camera notifications to make configuring it easier for new users and also allow multiple cameras to be configured in one automation.
My issue stems from the trigger variable not allowing most templates i’ve tried.
This is the working yaml currently for one camera
trigger_variables:
input_camera: !input camera
camera: "{{ input_camera | regex_replace('^camera\\.|_\\d+$', '') }}"
mqtt_topic: !input mqtt_topic
I’m wanting to allow users to select multiple cameras and I want to be able to leverage the new attribute “camera_name” that the frigate integration provides on these camera entities.
This works perfectly in the template editor but is prohibited in limited templates.
{% set input_camera = ['camera.front','camera.car_port', 'camera.doorbell'] %}
{% set cameras = input_camera|expand|map(attribute='attributes.camera_name')|list %}
trigger_variables:
input_camera: !input camera
camera: "{{input_camera|expand|map(attribute='attributes.camera_name')|list}}" #Expand not allowed)
mqtt_topic: !input mqtt_topic
I’m seeking ideas on how to get the list of camera names.
The subsequent trigger i’m going for looks like this to complete the picture if necessary
- platform: mqtt
topic: "{{mqtt_topic}}"
payload: "{{True}}/new"
value_template: "{{ camera|select('in', value_json['after']['camera'])|list|length>0 }}/{{ value_json['type']}}"
id: frigate-event