There is no media source for trigger “Doorbell pressed”.
I have set up a video recording for the trigger “person detected”. It is likely the video recording is still running while trigger “Doorbell pressed” goes off. Hence I would like to use the media source of trigger “person detected” as a substitute.
I have create a helper, input_text.hello_doorbell_current_event_id, for this purpose. However, assigning the value of trigger.event.data.nest_event_id to the helper failed and stalls the automation. The automation is defined as the following:
What is the proper way to assign the value?
alias: Hello Doorbell Person Detected
description: >-
Record a video when a person is detected by Hello Video Doorbell.
As automation Hellobell Pressed does not come with a way to get the thumbnail.
Hence it might share the thumbnail captured by this auomation if this
automation is still running.
trigger:
- platform: device
device_id: 35fb51270433531b21def80a4b34a2c4
domain: nest
type: camera_person
condition: []
action:
- variables:
time_stamp: "{{ now().strftime('%Y-%m-%d %H-%M-%S') }}"
date_stamp: "{{ time_stamp[:10] }}"
- alias: >-
**** It fails at this step ****
assign trigger.event.data.nest_event_id to input_text.hello_doorbell_current_event_id
service: input_text.set_value
data:
value: "{{ trigger.event.data.nest_event_id }}"
target:
entity_id: input_text.hello_doorbell_current_event_id
- service: camera.snapshot
data:
filename: >-
/CCTV/Hello_Doorbell/{{ date_stamp }}/Person_Detected/{{ time_stamp
}}.jpg
target:
entity_id: camera.hello_video_doorbell
- parallel:
- alias: Take a video
service: script.turn_on
target:
entity_id: script.camera_recording
data:
variables:
camera: camera.hello_video_doorbell
video_duration: 35
video_lookback: 25
video_destination: >-
/CCTV/Hello_Doorbell/{{ date_stamp }}/Person_Detected/{{
time_stamp }}.mp4
- alias: send mobile messages to adults
service: notify.ADULT_MOBILES
data:
message: Hello Doordell - A Person Detected.
title: Hello Doordell - A Person Detected.
data:
image: >-
/api/nest/event_media/{{ trigger.event.data.device_id }}/{{
trigger.event.data.nest_event_id }}/thumbnail
video: >-
/api/nest/event_media/{{ trigger.event.data.device_id }}/{{
trigger.event.data.nest_event_id }}
url: /lovelace/hello-doorbell-camera
clickAction: /lovelace/hello-doorbell-camera
- alias: >-
reset input_text.hello_doorbell_current_event_id to 'unknown'.
service: input_text.set_value
data:
value: unknown
target:
entity_id: input_text.hello_doorbell_current_event_id