Git Product home page Git Product logo

pimatic-wink's Introduction

pimatic-wink

Pimatic plugin to interface with Wink connected devices. Currently supports the following device types:

  1. Light Bulbs
  2. Binary Switches
  3. Shades
  4. Locks - only lock/unlock functions are supported
  5. Light Switches - This not a Wink device but, a varition on light_bulb and only offers on/off functionality. This will not be added automatically by discovery. If you want to use it, you will have to do it manually. You can change the class for a device added by auto-discovery to WinkLightBulb by editing the config.json file.

This plugin suppports auto-discovery available since pimatic v0.90, and that is the preferred way of adding devices, it will retrieve all the parameters it needs using the Wink API.

This version subscribes to pubnub streams where Wink publishes real-time device statutes - google 'wink pubnub' if you want further info.

The plugin should preferrably be installed using the pimatic UI functions. After installing the plugin you should edit the parameters and set the username and password. After this restart pimatic, this will retrieve the OAuth token that the plugin needs to make Wink API calls

Plugin

{
  "plugin": "wink",
  "client_id": "quirky_wink_android_app",
  "client_secret": "e749124ad386a5a35c0ab554a4f2c045",
  "username": "[email protected]",
  "password": "123456",
  "auth_token": "0000aaaaa99999988889999332211333"
},

client_id and client_secret are used for OAuth token generation. You can email wink support and request a personalized client_id and client_secret, it's been known to take considerable time to get it, so these were taken from the Android Wink app, first seen here:

https://github.com/davidgruhin/WinkPost/blob/master/js/wink.js#L335

username and password are those used to log in to the official Wink app.

auth_token is generated by accessing the Wink API - the plug will automatically do this, after you the username and password and restart pimatic. You can also retrieve this using the CLI - see usage not below

Devices

device_id, pubnub_subscribe_key, pubnub_channel are used to interact with devices and subscribe to status updates. If you use pimatic auto-discovery to add devices, these will be automatically populated for you. You can also manually populate these, by retrieving the device map using the CLI and looking them up in the device map.

{
  "id": "my-light-bulb",                //unique id used by pimatic
  "class": "WinkLightBulb",             //this should match the device type
  "name": "Office Light Bulb"           //call it what you want 
  "device_id": "212917",                //retrieved from Wink device map
  "pubnub_channel": "very_long_string", //retrieved from Wink device map   
  "pubnub_subscribe_key": "a_string"    //retrieved from Wink device map
},
{
  "id": "my-switch",
  "class": "WinkBinarySwitch",
  "name": "Outlet",
  "device_id": "718646",                 
  "pubnub_channel": "very_long_string",     
  "pubnub_subscribe_key": "a_string"     
},
{
  "id": "my-lock",
  "class": "WinkLock",
  "name": "Front Door",
  "device_id": "404706",                 
  "pubnub_channel": "very_long_string",     
  "pubnub_subscribe_key": "a_string" 
},
{
  "id": "my-shade",
  "class": "WinkShade",
  "name": "Curtains",
  "device_id": "516323",                 
  "pubnub_channel": "very_long_string",     
  "pubnub_subscribe_key": "a_string" 
},
{
  "id": "my-floodlight",
  "class": "WinkLightSwitch",           //this MUST be a light_bulb type device 
  "name": "Curtains",
  "device_id": "201551",                 
  "pubnub_channel": "very_long_string",     
  "pubnub_subscribe_key": "a_string" 
},

Bonus: CLI

pimatic-wink includes a bonus utility that can be run from the command line (via node). See wink-cli.js for more information.

Commands to retrive auth_token and device map - you don't need to do this manually, the plugin does this for you. The auth_token will be retrieved in the first run after installing. Device can be retrieved using auto-discovery.

auth token : node wink-cli.js auth_token '[email protected]' '123456'

device map: node wink-cli.js auth_token device_map

pimatic-wink's People

Contributors

dgmltn avatar dmelton-gpsw avatar enishoca avatar mwittig avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

mwittig enishoca

pimatic-wink's Issues

Newb Issue Unhandled rejection Error: 401

I keep getting this error for my wink plugin,
Unhandled rejection Error: 401
at maybeWrapAsError (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/main/util.js:70:12)
at /home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/main/promise_resolver.js:41:50
at /home/pi/pimatic-app/node_modules/pimatic-wink/wink-node.js:335:21
at IncomingMessage. (/home/pi/pimatic-app/node_modules/pimatic-wink/wink-node.js:119:21)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)

Here is my config:

{
"plugin": "wink",
"client_id": "8888888888888888888888888",
"client_secret": 8888888888888888888",
"username": "johnsonl99999999999",
"password": "Gr3300000000000"
},

Using android or my client info ends the same.

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.