Follow this YouTube video for a step by step guide:
This is the code used for the nest thermostat and the nest doorbell:
Substitute the project-id and the device-id, feel free to use another value from the json response file.
sensor:
- platform: rest
name: nest_thermostat
resource: https://smartdevicemanagement.googleapis.com/v1/enterprises/project-id/devices/device-id
method: GET
headers:
Content-Type: application/json
Authorization: !secret my_sensor_secret_token
value_template: "{{ value_json['traits']['sdm.devices.traits.Temperature']['ambientTemperatureCelsius'] }}"
json_attributes:
- traits
- platform: rest
name: nest_hello_doorbell
resource: https://smartdevicemanagement.googleapis.com/v1/enterprises/project-id/devices/device-id
method: GET
headers:
Content-Type: application/json
Authorization: !secret my_sensor_secret_token
value_template: "{{ value_json['type'] }}"
json_attributes:
- type
- traits
- sdm.devices.traits.CameraLiveStream
- sdm.devices.traits.CameraMotion
- sdm.devices.traits.CameraPerson
- sdm.devices.traits.CameraSound
- sdm.devices.traits.DoorbellChime
- sdm.devices.traits.Info
In this blog post you can find the solution to the refresh token: Reddit Post
You will need node-red up and running with the following two add-ons in addition.
- node-red-contrib-image-output
- node-red-contrib-google-cloud
I created these two automations based on entities create in my video and in the Blog post
Automations
Whenever the nest hello senses that there is a person in the view of the camera we are going to turn on our front door porch light.
#front_door_motion_start.yaml
alias: Turn on Front Door light when motion triggered on Nest Hello
trigger:
platform: state
entity_id: sensor.nest_doorbell_chime_time, sensor.nest_doorbell_person_time
action:
service: light.turn_on
entity_id: light.front_porch
condition:
condition: state
entity_id: sun.sun
state: 'below_horizon'
#front_door_motion_end.yaml
alias: Turn off porch light after 30 seconds of front door motion
trigger:
platform: state
entity_id: light.front_porch
from: 'off'
to: 'on'
for: '00:00:30'
action:
service: light.turn_off
entity_id: light.front_porch
Broadcast that there is a person at the door
alias: Google Mini announce movement on the front door
trigger:
platform: state
entity_id: sensor.nest_doorbell_person_time
action:
- service: tts.google_say
data:
entity_id: media_player.kitchen_speaker
message: There is someone at your front door!
- service: script.sonos_say
data_template:
sonos_entity: media_player.lounge
volume: 0.2
message: There is someone at your front door!