var types = require("hap-nodejs/accessories/types.js"); var wink = require('wink-js'); var model = { light_bulbs: require('wink-js/lib/model/light') }; function WinkPlatform(log, config){ // auth info this.client_id = config["client_id"]; this.client_secret = config["client_secret"]; this.username = config["username"]; this.password = config["password"]; this.log = log; } WinkPlatform.prototype = { accessories: function(callback) { this.log("Fetching Wink devices."); var that = this; var foundAccessories = []; wink.init({ "client_id": this.client_id, "client_secret": this.client_secret, "username": this.username, "password": this.password }, function(auth_return) { if ( auth_return === undefined ) { that.log("There was a problem authenticating with Wink."); } else { // success wink.user().devices('light_bulbs', function(devices) { for (var i=0; i