Skip to main content

Library for the Google Nest SDM API

Project description

python-google-nest-sdm

This is a library for Google Nest Device Access using the Smart Device Management API.

Usage

This can be used with the sandbox which requires Registration, accepting terms and a fee.

You'll want to following the Get Started guides for setup including steps in the google cloud console. Overall, this is fairly complicated with many steps that are easy to get wrong. It is likely worth it to make sure you can get the API working using their supplied curl commands with your account before attempting to use this library.

Structure

This API was designed for use in Home Assistant following the advice in Building a Python Library for an API.

If you are integrating this from outside Home Assistant, you'll need to create your own oauth integration and token refresh mechanism and tooling.

Fetching Data

This is an example to use the command line tool to access the API:

PROJECT_ID="some-project-id"
CLIENT_ID="some-client-id"
CLIENT_SECRET="some-client-secret"
# Initial call will ask you to authorize OAuth2 then cache the token
google_nest --project_id="${PROJECT_ID}" --client_id="${CLIENT_ID}" --client_secret="${CLIENT_SECRET}" list_structures
# Subsequent calls only need the project id
google_nest --project_id="${PROJECT_ID}" get_device "some-device-id"
google_nest --project_id="${PROJECT_ID}" set_mode COOL
google_nest --project_id="${PROJECT_ID}" set_cool 25.0

Subscriptions

See Device Access: Getting Started: Subscribe to Events for documentation on how to create a pull subscription.

You can create the subscription to use with the tool with these steps:

This is an example to run the command line tool to subscribe:

PROJECT_ID="some-project-id"
SUBSCRIPTION_ID="projects/some-id/subscriptions/enterprise-some-project-id-python-google-nest"
google_nest --project_id="${PROJECT_ID}" subscribe ${SUBSCRIPTION_ID}

Development

$ python3 -m venv venv
$ source venv/bin/activate
$ pip3 install -e .
$ pip3 install -r requirements.txt

# Running tests
$ pytest

# Running tests w/ Code Coverage
$ pytest --cov=google_nest_sdm tests/ --cov-report=term-missing

# Formatting and linting
$ pre-commit run --all-files

Funding and Support

If you are interested in donating money to this effort, instead send a donation to Black Girls Code which is a great organization growing the next generation of software engineers.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_nest_sdm-6.1.3.tar.gz (67.4 kB view details)

Uploaded Source

Built Distribution

google_nest_sdm-6.1.3-py3-none-any.whl (50.7 kB view details)

Uploaded Python 3

File details

Details for the file google_nest_sdm-6.1.3.tar.gz.

File metadata

  • Download URL: google_nest_sdm-6.1.3.tar.gz
  • Upload date:
  • Size: 67.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for google_nest_sdm-6.1.3.tar.gz
Algorithm Hash digest
SHA256 e65d98f973dcf553db0d7daefd34db9827b2fff97d406d98635bd304f47443d4
MD5 f03939d3f32e99dbc469bc7c9e573155
BLAKE2b-256 8993753c94ec465f0d97da42fd42f6d9e9bf47c7ab37d87d0869e248e434e74e

See more details on using hashes here.

File details

Details for the file google_nest_sdm-6.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for google_nest_sdm-6.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7cdf503ef5e01522d0c72ea6271d24d9b671f0a6708d2ccbf6339fa2ba2f2f4f
MD5 22e87f5ed752aa812ae079c719e42278
BLAKE2b-256 8ebc037f10aa5c4ffcf8a5b54cfe4b007bc46a6a83e95b26f5470798ca0953db

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page