Skip to content

Commit

Permalink
- Fixes #44, error in processing state value if the id is in error
Browse files Browse the repository at this point in the history
  • Loading branch information
osirisoft-pmurray committed Feb 4, 2015
1 parent 3388705 commit c479b8b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions hue-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,23 +991,24 @@ HueApi.prototype._getLightStateOptions = function (lightId, stateValues) {
} else {
state = lightState.create(stateValues);
}
}

if (state.hasRGB()) {
promise = self.lightStatus(lightId)
.then(function (lightDetails) {
state = state.applyRGB(lightDetails.modelid);
options.values = state.payload();
if (state.hasRGB()) {
promise = self.lightStatus(lightId)
.then(function (lightDetails) {
state = state.applyRGB(lightDetails.modelid);
options.values = state.payload();

return options;
});
} else {
options.values = state.payload();
return options;
});
} else {
options.values = state.payload();

deferred = Q.defer();
deferred.resolve(options);

deferred = Q.defer();
deferred.resolve(options);
promise = deferred.promise;
}

promise = deferred.promise;
}

return promise;
Expand Down

0 comments on commit c479b8b

Please sign in to comment.