Skip to content

Commit

Permalink
Issue #59 cont'd
Browse files Browse the repository at this point in the history
Don’t update light from bridge state while updating
  • Loading branch information
ebaauw committed Feb 17, 2017
1 parent be32290 commit 307bbb3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/HueLight.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,7 @@ HueLight.prototype.setHK = function() {

HueLight.prototype.heartbeat = function(obj) {
// jshint -W106
if (this.desiredState) {
// Update to light is pending.
if (this.updating) {
return;
}
const old = {
Expand Down Expand Up @@ -743,6 +742,7 @@ HueLight.prototype.setSat = function(sat, callback) {

// Collect changes into a combined request.
HueLight.prototype.request = function(key, value) {
this.updating = true;
if (this.desiredState) {
// Add this change to pending update.
this.desiredState[key] = value;
Expand Down Expand Up @@ -773,6 +773,7 @@ HueLight.prototype.put = function() {
this.state.any_on = desiredState.on;
this.state.all_on = desiredState.on;
}
this.updating = false;
return;
}.bind(this))
.catch(function(err) {
Expand Down

0 comments on commit 307bbb3

Please sign in to comment.