Giter VIP home page Giter VIP logo

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())

python-wink's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.