@pollinolas wrote:
Hi, right now I have 4 different automations for 4 different cameras, one of them would be like this:
- id: 'Foto Movimiento Bajo' alias: Foto Movimiento Bajo initial_state: true trigger: - entity_id: binary_sensor.sensor_movimiento_acceso_bajo from: 'off' platform: state to: 'on' condition: [] action: - data: entity_id: camera.bajo filename: '/config/www/snapshot/video_{{ entity_id.entity_id }}_{{ now().strftime("%d-%m-%Y %H.%M") }}.mp4' duration: 60 service: camera.record - delay: 00:00:05 - data: entity_id: image_processing.doods_bajo service: image_processing.scan - delay: 00:00:05 - above: '0' condition: numeric_state entity_id: image_processing.doods_bajo - data: data: attachment: /config/www/snapshot/image_processing/bajo_latest.jpg html: "1" title: "\U0001F4F9 MOVIMIENTO DETECTADO" message: Se ha detectado movimiento en la entrada del bajo. service: notify.pushover - delay: 00:01:30 - service: shell_command.borrado_camara - service: shell_command.borrado_image_processing
The idea was to turn all of them into one, after looking at the topics I got something, but I have reached a point where I got stuck:
- id: 'prueba' alias: prueba initial_state: true trigger: - entity_id: binary_sensor.sensor_movimiento_acceso_bajo from: 'off' platform: state to: 'on' - entity_id: binary_sensor.sensor_movimiento_terraza from: 'off' platform: state to: 'on' - entity_id: binary_sensor.sensor_movimiento_acceso_garaje from: 'off' platform: state to: 'on' - entity_id: binary_sensor.sensor_movimiento_acceso_entrada from: 'off' platform: state to: 'on' action: - service: camera.record data_template: entity_id: > {% set mapper = { 'binary_sensor.sensor_movimiento_acceso_bajo':'camera.bajo', 'binary_sensor.sensor_movimiento_terraza':'camera.terraza', 'binary_sensor.sensor_movimiento_acceso_garaje':'camera.garaje', 'binary_sensor.sensor_movimiento_acceso_entrada':'camera.entrada' } %} {{ mapper[trigger.entity_id] }} filename: > {% set mapper = { 'binary_sensor.sensor_movimiento_acceso_bajo':'/config/www/snapshot/video_camara_bajo_{{ now().strftime("%d-%m-%Y %H.%M") }}.mp4', 'binary_sensor.sensor_movimiento_terraza':'/config/www/snapshot/video_camara_terraza_{{ now().strftime("%d-%m-%Y %H.%M") }}.mp4', 'binary_sensor.sensor_movimiento_acceso_garaje':'/config/www/snapshot/video_camara_garaje_{{ now().strftime("%d-%m-%Y %H.%M") }}.mp4', 'binary_sensor.sensor_movimiento_acceso_entrada':'/config/www/snapshot/video_camara_entrada_{{ now().strftime("%d-%m-%Y %H.%M") }}.mp4' } %} {{ mapper[trigger.entity_id] }} duration: 60 - delay: 00:00:05 - service: image_processing.scan data_template: entity_id: > {% set mapper = { 'binary_sensor.sensor_movimiento_acceso_bajo':'image_processing.doods_bajo', 'binary_sensor.sensor_movimiento_terraza':'image_processing.doods_terraza', 'binary_sensor.sensor_movimiento_acceso_garaje':'image_processing.doods_garaje', 'binary_sensor.sensor_movimiento_acceso_entrada':'image_processing.doods_entrada' } %} {{ mapper[trigger.entity_id] }} - delay: 00:00:05
I am not able to see the numerical value of the different entities in a template and continue with the automation,
I hope there is someone who can help me complete this.
Regards, and thank you very much
Posts: 3
Participants: 2