Asynchronous python library for Nest API
- Free software: Apache Software License 2.0
- Documentation: https://aionest.readthedocs.io.
- Minimium requirement is Python 3.5.3
- Full support of aysncio
- Use Nest Stream API
pip install aionest
You will need a Nest developer account, and a Product on the Nest developer portal to use this library:
- Visit Nest Developers, and sign in. Create an account if you don't have one already.
- Fill in the account details:
- The "Company Information" can be anything.
- Submit changes.
- Click "Products" at top of page.
- Click "Create New Product"
- Fill in details:
- Product name must be unique.
- The description, users, urls can all be anything you want.
- 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]
- Click "Create Product".
- 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.
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()
This project was inspired by python-nest.
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.