I am trying to use a script to trigger a new snapshot of my Blink cameras when you tap on the picture showing the latest image in Blink. Here is my script in script.yaml created using the editor:
'1561792875210':
alias: Blink Camera Snapshot
sequence:
- service: blink.trigger_camera
data:
name: {{camera_name}}
- delay: 00:00:05
- service: blink.blink_update
- service: camera.snapshot
And here is my card:
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: picture-glance
entities: []
camera_image: camera.blink_front_door
tap_action:
action: call-service
service: script.1561792875210
data:
camera_name: Front Door
- type: picture-glance
entities: []
camera_image: camera.blink_garage_door
tap_action:
action: call-service
service: script.1561792875210
data:
camera_name: Garage Door
- type: horizontal-stack
cards:
- type: glance
entities:
- entity: sensor.blink_front_door_battery
- entity: sensor.blink_front_door_temperature
- entity: sensor.blink_front_door_wifi_signal
show_name: false
- type: glance
entities:
- entity: sensor.blink_garage_door_battery
- entity: sensor.blink_garage_door_temperature
- entity: sensor.blink_garage_door_wifi_signal
show_name: false
- type: horizontal-stack
cards:
- type: picture-glance
entities: []
camera_image: camera.blink_back_yard_right
tap_action:
action: call-service
service: script.1561792875210
data:
camera_name: Back Yard - Right
- type: picture-glance
entities: []
camera_image: camera.blink_side_door
tap_action:
action: call-service
service: script.1561792875210
data:
camera_name: Side Door
- type: horizontal-stack
cards:
- type: glance
entities:
- entity: sensor.blink_back_yard_right_battery
- entity: sensor.blink_back_yard_right_temperature
- entity: sensor.blink_back_yard_right_wifi_signal
show_name: false
- type: glance
entities:
- entity: sensor.blink_side_door_battery
- entity: sensor.blink_side_door_temperature
- entity: sensor.blink_side_door_wifi_signal
show_name: false
But clicking on the picture from the Blink camera does nothing. If i hard code the variable name in the script and just trigger the script, the picture from the Blink camera does update. I’ve spent 2 hours looking at documentation but not solution yet! Can someone help please?
tom_l
June 29, 2019, 9:15am
2
service_data
, not data
.
tap_action:
action: call-service
service: script.1561792875210
service_data: ##### <----
camera_name: Front Door
1 Like
Thank you but I still cannot get this to work. Here is my script:
blink_snapshot:
alias: Blink Snapshot
sequence:
- service: blink.trigger_camera
data:
name: '{{ camera_name }}'
- delay: 00:00:05
- service: blink.blink_update
- delay: 00:00:05
- service: camera.snapshot
data:
entity_id: '{{ camera_entity_id }}'
filename: '/share/{{ camera_entity_id }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg'
And here is the card I am trying to use this in:
cards:
- cards:
- camera_image: camera.blink_front_door
entities: []
tap_action:
action: call-service
service: script.blink_snapshot
service_data:
camera_name: Front Door
camera_entity_id: camera.blink_front_door
type: picture-glance
- camera_image: camera.blink_garage_door
entities: []
tap_action:
action: call-service
service: script.blink_snapshot
service_data:
camera_name: Garage Door
camera_entity_id: camera.blink_garage_door
type: picture-glance
type: horizontal-stack
- cards:
- entities:
- entity: sensor.blink_front_door_battery
- entity: sensor.blink_front_door_temperature
- entity: sensor.blink_front_door_wifi_signal
show_name: false
type: glance
- entities:
- entity: sensor.blink_garage_door_battery
- entity: sensor.blink_garage_door_temperature
- entity: sensor.blink_garage_door_wifi_signal
show_name: false
type: glance
type: horizontal-stack
- cards:
- camera_image: camera.blink_back_yard_right
entities: []
tap_action:
action: call-service
service: script.blink_snapshot
service_data:
camera_name: Back Yard
camera_entity_id: camera.blink_back_yard_right
type: picture-glance
- camera_image: camera.blink_side_door
entities: []
tap_action:
action: call-service
service: script.blink_snapshot
service_data:
camera_name: Side Door
camera_entity_id: camera.blink_side_door
type: picture-glance
type: horizontal-stack
- cards:
- entities:
- entity: sensor.blink_back_yard_right_battery
- entity: sensor.blink_back_yard_right_temperature
- entity: sensor.blink_back_yard_right_wifi_signal
show_name: false
type: glance
- entities:
- entity: sensor.blink_side_door_battery
- entity: sensor.blink_side_door_temperature
- entity: sensor.blink_side_door_wifi_signal
show_name: false
type: glance
type: horizontal-stack
type: vertical-stack
If I hard code the two variables passed by the service call then the script works. But when I try to use variables, nothing happens.
Elvis
tom_l
December 26, 2019, 6:12am
4
Try:
service_data:
camera_name: 'Front Door'
camera_entity_id: camera.blink_front_door
Unfortunately, it still does not work. Is there a way to “print out” what the variable in the script is getting passed to it? It seems that somehow the camera name isn’t passing correctly, which makes the script fail to do anything.
tom_l
December 26, 2019, 7:15am
6
I suppose you could store it in an input.text .
EDIT: You need to adjust your script to use data_template:
, not data
:
blink_snapshot:
alias: Blink Snapshot
sequence:
- service: blink.trigger_camera
data_template: ###### <--------- Here
name: '{{ camera_name }}'
- delay: 00:00:05
- service: blink.blink_update
- delay: 00:00:05
- service: camera.snapshot
data_template: ###### <--------- And here
entity_id: '{{ camera_entity_id }}'
filename: '/share/{{ camera_entity_id }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg'
1 Like
NeoFax75
(Neo Fax75)
November 27, 2022, 9:03pm
8
No matter what I do this takes half pictures. It only processes the top half of the snapshot.