Fork me on GitHub

pimatic-wink by Doug Melton (dgmltn) | github | npm

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": "xxxxx@yyyyyyy.com",
  "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 'xxxxx@yyyyyyy.com' '123456'

device map: node wink-cli.js auth_token device_map

Plugin Config Options

pimatic-wink config options
OptionDescriptionDefault
client_id
string
oauth2 client_id provided by wink
"quirky_wink_android_app"
client_secret
string
oauth2 client secret provided by wink
"e749124ad386a5a35c0ab554a4f2c045"
username
string
wink username
password
string
wink password
auth_token
string
Oauth token recieved from Wink

Device Config Options

pimatic-wink device config schemas

WinkBinarySwitch

WinkBinarySwitch config options
OptionDescriptionDefault
device_id
string
Device id retrieved using Wink API
pubnub_channel
string
Pubnub channel retrieved using Wink API
pubnub_subscribe_key
string
Pubnub subscription key retrieved using Wink API
interval
number
The time in ms, the command gets executed to get the actual state. If 0 then the state will not updated automatically.
0

WinkLightSwitch

WinkLightSwitch config options
OptionDescriptionDefault
device_id
string
Device id retrieved using Wink API
pubnub_channel
string
Pubnub channel retrieved using Wink API
pubnub_subscribe_key
string
Pubnub subscription key retrieved using Wink API
interval
number
The time in ms, the command gets executed to get the actual state. If 0 then the state will not updated automatically.
0

WinkLightBulb

WinkLightBulb config options
OptionDescriptionDefault
device_id
string
Device id retrieved using Wink API
pubnub_channel
string
Pubnub channel retrieved using Wink API
pubnub_subscribe_key
string
Pubnub subscription key retrieved using Wink API
interval
number
The time in ms, the command gets executed to get the actual state. If 0 then the state will not updated automatically.
0

WinkShade

WinkShade config options
OptionDescriptionDefault
device_id
string
Device id retrieved using Wink API
pubnub_channel
string
Pubnub channel retrieved using Wink API
pubnub_subscribe_key
string
Pubnub subscription key retrieved using Wink API
interval
number
The time in ms, the command gets executed to get the actual state. If 0 then the state will not updated automatically.
0

WinkLock

WinkShade config options
OptionDescriptionDefault
device_id
string
Device id retrieved using Wink API
pubnub_channel
string
Pubnub channel retrieved using Wink API
pubnub_subscribe_key
string
Pubnub subscription key retrieved using Wink API
interval
number
The time in ms, the command gets executed to get the actual state. If 0 then the state will not updated automatically.
0
pimatic-wink is written by Doug Melton (dgmltn)