Nest


The nest integration allows you to integrate your Google Nest devices in Home Assistant. This integration uses the Smart Device Management API and Google’s Cloud Pubsub to efficiently listen for changes in device state or other events. See Supported Devices for all devices supported by the SDM API.

There is currently support for the following device types within Home Assistant:

Cameras and Doorbells use Automation and Device Triggers for events and a Media Source for capturing media images on supported devices. Other device types like Smoke and CO Alarms or Security systems are not currently supported by the SDM API.

You are in control of the information and capabilities exposed to Home Assistant. You can authorize a single device, multiple devices, or different levels of functionality such as motion events, live streams, for any particular device. The integration is flexible enough to adapt based on what you allow.

The Nest Smart Device Management (SDM) API requires a US$5 fee.

Device Access Registration

For the first phase, you will turn on the API and create the necessary credentials to have Home Assistant talk to the Nest API.

Create and configure Cloud Project [Cloud Console]
Configure OAuth Consent screen [Cloud Console]
Configure OAuth client_id and client_secret [Cloud Console]
Create a Device Access project_id [Device Access Console]

Configuration

You now should have everything needed to configure Nest in Home Assistant. Edit your configuration.yaml file and populate a nest entry in the format of the example configuration below.

# Example configuration.yaml entry
nest:
  client_id: CLIENT_ID
  client_secret: CLIENT_SECRET
  # "Project ID" in the Device Access Console (not Cloud Project ID!)
  project_id: PROJECT_ID

Then make sure to restart Home Assistant under Server Controls.

Configuration Variables

client_id string Required

Your Device Access or Nest developer client ID.

client_secret string Required

Your Device Access or Nest developer client secret.

project_id string (Optional)

Your Device Access Project ID. This enables the SDM API.

subscriber_id string (Optional)

Recommended to leave blank, and let the integration manage this for you. If you want to use your subscription, enter the full path for the Pub/sub Subscription name.

Device Setup

Once configuration.yaml has a valid nest entry, you need to add Nest to your Home Assistant instance via the user interface by using this My button:

Manual configuration steps

The Nest integration setup will walk you through the steps of authorizing your Home Assistant to access your account and Nest devices.

OAuth and Device Authorization steps

Climate

All Google Nest Thermostat models are exposed as a climate entity that use the Thermostat Traits in the SDM API. State changes to the thermostat are reported to Home Assistant through the Cloud Pubsub subscriber.

Given a thermostat named Upstairs then the climate entity is created with a name such as climate.upstairs

This feature is enabled by the following permissions:

  • Allow Home Assistant to access and control your thermostat

Sensor

All Google Nest Thermostat models have traits exposed from the SDM API. The initial values of the sensors are fetched on startup, then updated regularly using the Cloud Pubsub subscriber. The following traits are supported with sensors:

Given a thermostat named Upstairs then sensors are created with names such as sensor.upstairs_temperature or sensor.upstairs_humidity.

This feature is enabled by the following permissions:

  • Allow Home Assistant to access and control your thermostat
Additional Nest Temperature Sensors are not supported by the SDM API.

Camera

Home Assistant supports all SDM API features. However, every Camera or Doorbell device has a different set of built-in capabilities. A Camera device has one of the following live stream types:

  • RTSP: These devices have an HLS stream served by the Home Assistant Core. These cameras support server-side camera services like stream recording or image preview. See Low Latency HLS as a great option to enable to reduce stream latency.
  • WebRTC: These devices support direct browser to camera communication and a super low latency stream. A Picture Glance Card can show the live stream in the grid with the Camera View set to live (not recommended for battery-powered cameras). camera services like stream recording are not supported.

This feature is enabled by the following permissions:

  • Allow Home Assistant to see and display your camera’s livestream
  • Other permissions in the Nest or Google Home apps.

All cameras have motion and person triggers, however only some support capturing snapshots for events. The table below summarizes the Supported SDM API features for each device.

Device Live Stream Triggers / Events Media Source
for Triggers / Events
Nest Cam (indoor, wired)
Nest Cam (outdoor, battery)
WebRTC Motion
Person
N/A
Nest Cam Indoor
Nest Cam IQ Indoor
Nest Cam IQ Outdoor
Nest Cam Outdoor
RTSP
Recording
Motion
Person
Sound
Snapshot (jpg)
Nest Cam with floodlight WebRTC Motion
Person
N/A
Nest Doorbell (battery) WebRTC Motion
Person
Chime
Clip Preview (mp4, gif)
Nest Doorbell (wired) RTSP
Recording
Motion
Person
Sound
Chime
Snapshot (jpg)
Nest Hub Max RTSP
Recording
Motion
Person
Sound
* SDM API known issue
Snapshot (jpg)

Given a camera named Front Yard then the camera is created with a name such as camera.front_yard.

Automation and Device Triggers

The Nest integration provides device triggers to enable automation in Home Assistant. You should review the Automating Home Assistant getting started guide on automations or the Automation documentation for full details.

Screenshot Device Triggers

Example Device Trigger / Event payload

Continue reading below to Media Source Attachments to see how to use media with notification actions.

This feature is enabled by the following permissions:

  • Allow Home Assistant to know when there’s a camera event
  • Allow Home Assistant to know when there’s a doorbell event
  • Other permissions in the Nest or Google Home apps.

Media Source

The Nest Media Source platform allows you to browse clips for recent camera events. Home Assistant is not intended to be a Network Video Recorder (NVR) platform, however, basic support for capturing recent events is supported.

The table above describes which devices support event image snapshots or 10-frame mp4 video clips for recent events.

Media Attachments

The Media Source APIs can be used in Companion App Attachments for Notifications as actions for Device Triggers above like Doorbell Pressed. You will need to be familiar with both the Media Sources supported for your camera, as well as the media capabilities of the companion apps.

  • /api/nest/event_media/DEVICE_ID/EVENT_ID: Media for the event, which supports image snapshots (jpg) or clip previews (mp4) depending on the camera type.

  • /api/nest/event_media/DEVICE_ID/EVENT_ID/thumbnail: A thumbnail preview of the media, which supports image snapshots (jpg) or clip previews (gif) depending on the camera type.

You can use the event payload fields device_id and event_id in an automation to send a notification from an actions as shown in the examples below.

Example Action: Clip Preview (mp4) attachment for iOS
Example Action: Clip Preview thumbnail (gif) for Android or iOS
Example Action: Snapshot (jpg) attachment for Android or iOS

This feature is enabled by the following permissions:

  • Based on the events you’ve selected to share from this device, allow Home Assistant to access camera video clips
  • Based on the events you’ve selected to share from this device, allow Home Assistant to access camera snapshots
  • Other permissions in the Nest or Google Home apps.

Troubleshooting

  • You can manage devices and permissions granted to Home Assistant in the Nest Partner Connections Manager. Restart Home Assistant to make new devices available. See the SDM API Troubleshooting documentation for more details.

  • Error 400: invalid_request plus a message about not complying with Google’s OAuth Policy for keeping accounts secure is shown when using App Auth or Desktop Auth or OOB Auth which has been deprecated by Google. You need to create new Web App credentials following the instructions on this page and update your Home Assistant to use them.

  • Error 400: redirect_uri_mismatch means that your OAuth Client ID is not configured to match the My Home Assistant callback URL. Home Assistant’s redirect URL behavior may have changed since you initially set this up!

Details about resolving redirect_uri_mismatch
I have manually disabled My Home Assistant
  • Reauthentication required often: If you are getting logged out every 7 days, this means an OAuth Consent Screen misconfiugration or your authentication token was revoked by Google for some other reason.
Details about reauthentication issues
  • Check Settings -> System -> Logs to see if there are any error messages or misconfigurations then see the error messages below.

  • Thermostat does not appear or is unavailable happens due to a bug where the SDM API does return the devices. A common fix get the API to work again is to:

How to restart thermostat
  • No devices or entities are created if the SDM API is not returning any devices for the authorized account. Double-check that GCP is configured correctly to Enable the API and authorize at least one device in the OAuth setup flow. If you have trouble here, then you may want to walk through the Google instructions and issue commands directly against the API until you successfully get back the devices.

  • Error 403: access_denied means that you need to visit the OAuth Consent Screen and add your Google Account as a Test User.

  • Error: invalid_client no application name means the OAuth Consent Screen has not been fully configured for the project. Enter the required fields (App Name, Support Email, Developer Email) and leave everything else as default.

  • Subscriber error means that configuration.yaml has an incorrect subscriber_id or the subscription is misconfiugred. It is recommended to delete this from the configuration, then delete and re-add the integration to let it create a subscription for you.

  • Not receiving updates typically means a problem with the subscriber configuration. Make sure to check the logs for any error messages. Changes for things like sensors or thermostat temperature set points should be instantly published to a topic and received by the Home Assistant subscriber when everything is configured correctly.

  • You can see stats about your subscriber in the Cloud Console which includes counts of messages published by your devices, and how many have been acknowledged by your Home Assistant subscriber. You can also View Messages to see examples of published. Many old unacknowledged messages indicate the subscriber is not receiving the messages and working properly or not connected at all.

  • To aid in diagnosing subscriber problems or camera stream issues it may help to turn up verbose logging by adding some or all of these to your configuration.yaml depending on where you are having trouble:


logger:
  default: info
  logs:
    homeassistant.components.nest: debug
    homeassistant.components.nest.climate_sdm: debug
    homeassistant.components.nest.camera_sdm: debug
    homeassistant.components.nest.sensor_sdm: debug
    homeassistant.helpers.config_entry_flow: debug
    homeassistant.helpers.config_entry_oauth2_flow: debug
    google_nest_sdm: debug
    google_nest_sdm.device: debug
    google_nest_sdm.device_manager: debug
    google_nest_sdm.google_nest_subscriber: debug
    google_nest_sdm.event: debug
  • It is recommended to let Home Assistant create the Pub/Sub subscription for you. However, if you would like more control you can enter a susbcriber_id in the configuration. See Subscribe to Events for more instructions on how to manually create a subscription and use the full subscription name in the Home Assistant configuration e.g. projects/gcp-project-name/subscriptions/subscription-id

Works With Nest API

The Legacy Works with Nest API is not accepting new signups.

Legacy Works with Nest Configuration Steps