I’ll try to send pictures from an D-Link wifi IP Camera to pushbullet with hassio. For now i trigger the automation with an input_boolean. I have partially success. The script saves an photo with a fixed name and pushbullet sends it. I can even name the photo with date and time, sort of. It works for date and hours and minutes, but it doesn’t work when adding seconds. I have to add an delay otherwise pushbullet tries to send the file before Hass have saved it. As far as i can tell pushbullet tries to send a file with another time stamp than is saved.
When triggered the file “2018-09-12_21.38.06_LR.jpg” is saved, but pushbullet looked for the file “2018-09-12_21.38.18_LR.jpg”
I want to date my pictures so that more than one picture can be stored each minute and so that pushbullet can send them. If i skip the seconds the pictures are saved over each other if the automation is triggered within the same minute.
I have goten so far that I can set a variable called picture_date and use it to name the photo I’m taking. But how do I use the same variable when sending the file with Pushbullet?
My code is as below, but it doesn’t work, when pushbullet tries to send the file it can’t find it, it looks for a file named “_LR.jpg” instead of a file named “YYYY-MM-DD-HH.MM.SS_LR.jpg”
- id: '1537650449584'
alias: Test Camera
trigger:
- entity_id: input_boolean.test
platform: state
to: 'on'
condition: []
action:
- data_template:
entity_id: camera.livingroom_camera
filename: >
{% set picture_date = now().strftime('%Y-%m-%d_%H.%M.%S') %}
/config/tmp/{{ picture_date }}_LR.jpg
service: camera.snapshot
- delay:
seconds: 10
- data_template:
message: Rörelse har detekterats!
title: Rörelse!
data:
file: >
/config/tmp/{{ picture_date }}_LR.jpg
service: notify.pushbullet