pickeld
(Pickeld)
1
im trying to update local_file image path using automation
the file is a camera.snapshot which timestamp in the file name.
- id: '1538168905630'
alias: Camera - Motion Detection Notification
trigger:
- entity_id: sensor.amcrest_camera_motion_detected
from: 'False'
platform: state
to: 'True'
action:
- data:
entity_id: camera.amcrest_camera
filename: /config/www/snapshots/camera.amcrest_{{ now().strftime("%Y-%m-%d--%H-%M-%S")
}}.jpg
service: camera.snapshot
- data:
entity_id: camera.file_cam
file_path: /config/www/snapshots/camera.amcrest_{{ now().strftime("%Y-%m-%d--%H-%M-%S")
}}.jpg
service: camera.local_file_update_file_path
when i trigger the automation i get the following error in the log:
Could not read camera file_cam image from file: /config/www/snapshots/camera.amcrest_{{ now().strftime(“%Y-%m-%d–%H-%M-%S”) }}.jpg
can anybody please help me here?
thank you!
tom_l
2
Use /local/ instead of /config/www/
petro
(Petro)
3
Your data sections need to be data templates:
- id: '1538168905630'
alias: Camera - Motion Detection Notification
trigger:
- entity_id: sensor.amcrest_camera_motion_detected
from: 'False'
platform: state
to: 'True'
action:
- data_template:
entity_id: camera.amcrest_camera
filename: /config/www/snapshots/camera.amcrest_{{ now().strftime("%Y-%m-%d--%H-%M-%S")
}}.jpg
service: camera.snapshot
- data_template:
entity_id: camera.file_cam
file_path: /config/www/snapshots/camera.amcrest_{{ now().strftime("%Y-%m-%d--%H-%M-%S")
}}.jpg
service: camera.local_file_update_file_path
You may need to put your file_path in quotes as well (including the template).
1 Like
Hmmm - I’m trying to do this to solve this problem and doing it like this:
- id: 'cam update'
alias: Camera update
trigger:
- platform: state
entity_id: sensor.last_caller_landline
action:
- data_template:
entity_id: camera.caller
file_path: '/config/www/images/image.jpg?v={{ now().strftime("%Y-%m-%d--%H-%M-%S") }}'
service: camera.local_file_update_file_path
and it doesn’t change. Also tried without the preceding and trailing ’ and same result. Does anyone know how this should be done?