Skip to content

python-wink/python-wink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Wink API

Join the chat at https://gitter.im/python-wink/python-wink Build Status Coverage Status

This library is an attempt to implement the entire Wink API in Python 3. Documentation for the Wink API can be found here http://docs.winkapiv2.apiary.io/# however, from my experience it isn't kept up-to-date.

This library also has support for the unoffical local API and doesn't require a rooted hub.

This library provides support for Wink in Home Assistant!

To install

pip3 install python-wink

Get developer credentials

  1. Vist https://developer.wink.com/login
  2. Crate an account and request your credentials. (Approval can take several days)
  3. Enter in a redirect URL to point at your application.
  4. Plug in your details into the test script below.

Example usage

Print all light names and state, and toggle their states.

import pywink

print("Please vist the following URL to authenticate.")
print(pywink.get_authorization_url("YOUR_CLIENT_ID", "YOUR_REDIRECT_URL"))
code = input("Enter code from URL:")
auth = pywink.request_token(code, "YOUR_CLIENT_SECRET")
pywink.set_wink_credentials("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET",
                                         auth.get("access_token"), auth.get("refresh_token"))

lights = pywink.get_light_bulbs()
for light in lights:
    print("Name: " + light.name())
    print("State: " + light.state())
    light.set_state(not light.state())

About

Python implementation of the Wink API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published