mirror of
https://github.com/mtan93/homebridge.git
synced 2026-04-17 14:23:07 +01:00
@@ -89,7 +89,15 @@ WeMoAccessory.prototype.setPowerOn = function(powerOn, callback) {
|
|||||||
var binaryState = powerOn ? 1 : 0; // wemo langauge
|
var binaryState = powerOn ? 1 : 0; // wemo langauge
|
||||||
this.log("Setting power state on the '%s' to %s", this.wemoName, binaryState);
|
this.log("Setting power state on the '%s' to %s", this.wemoName, binaryState);
|
||||||
|
|
||||||
|
var callbackWasCalled = false;
|
||||||
|
|
||||||
this.device.setBinaryState(binaryState, function(err, result) {
|
this.device.setBinaryState(binaryState, function(err, result) {
|
||||||
|
if (callbackWasCalled) {
|
||||||
|
this.log("WARNING: setBinaryState called its callback more than once! Discarding the second one.");
|
||||||
|
}
|
||||||
|
|
||||||
|
callbackWasCalled = true;
|
||||||
|
|
||||||
if (!err) {
|
if (!err) {
|
||||||
this.log("Successfully set power state on the '%s' to %s", this.wemoName, binaryState);
|
this.log("Successfully set power state on the '%s' to %s", this.wemoName, binaryState);
|
||||||
callback(null);
|
callback(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user