Skip to content

rtfol/aionest

Repository files navigation

aionest

Documentation Status Updates

Asynchronous python library for Nest API

Features

  • Minimium requirement is Python 3.5.3
  • Full support of aysncio
  • Use Nest Stream API

Installation

pip install aionest

Nest Developer Account

You will need a Nest developer account, and a Product on the Nest developer portal to use this library:

  1. Visit Nest Developers, and sign in. Create an account if you don't have one already.
  2. Fill in the account details:
  • The "Company Information" can be anything.
  1. Submit changes.
  2. Click "Products" at top of page.
  3. Click "Create New Product"
  4. Fill in details:
  • Product name must be unique.
  • The description, users, urls can all be anything you want.
  1. For permissions, check every box and if it's an option select the read/write option.
  • The description requires a specific format, recommend use following format
[Your product name] [Edit] [For Home Automation]
  1. Click "Create Product".
  2. Once the new product page opens the "Product ID" and "Product Secret" are located on the right side. These will be used as product_id and product_secret below.

Usage

import aionest
import asyncio

async def nest_update():
    nest_api = aionest.NestApi(product_id)
    print('Go to {} to authorize, then enter PIN below'.format(nest_api.get_authorize_url()))
    pin = input("PIN: ")
    # you can cache access_token future reuse
    access_token, expires_in = await nest_api.authenticate(pin, product_secret)
    nest_api.connect()
    try:
        async for event in nest_api:
            print(event.data)
    finally:
        nest_api.close()

event_loop = asyncio.get_event_loop()
try:
    event_loop.run_until_complete(nest_update())
finally:
    event_loop.close()

Credits

This project was inspired by python-nest.

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

About

Asynchronous python library for Nest API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published