mirror of
https://github.com/mtan93/homebridge.git
synced 2026-04-16 22:05:15 +01:00
Added ability to specify a specific Liftmaster door
Current version operates the "first door found". For users with multiple doors, this allows them to specify a specific door with the 'requiredDeviceId' option in config.
This commit is contained in:
@@ -9,6 +9,7 @@ function LiftMasterAccessory(log, config) {
|
|||||||
this.name = config["name"];
|
this.name = config["name"];
|
||||||
this.username = config["username"];
|
this.username = config["username"];
|
||||||
this.password = config["password"];
|
this.password = config["password"];
|
||||||
|
this.requiredDeviceId = config["requiredDeviceId"];
|
||||||
}
|
}
|
||||||
|
|
||||||
LiftMasterAccessory.prototype = {
|
LiftMasterAccessory.prototype = {
|
||||||
@@ -86,14 +87,14 @@ LiftMasterAccessory.prototype = {
|
|||||||
// look through the array of devices for an opener
|
// look through the array of devices for an opener
|
||||||
for (var i=0; i<devices.length; i++) {
|
for (var i=0; i<devices.length; i++) {
|
||||||
var device = devices[i];
|
var device = devices[i];
|
||||||
if (device["MyQDeviceTypeName"] == "GarageDoorOpener") {
|
if ((device["MyQDeviceTypeName"] == "GarageDoorOpener") && (that.requiredDeviceId == device.MyQDeviceId)) {
|
||||||
that.deviceId = device.MyQDeviceId;
|
that.deviceId = device.MyQDeviceId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (that.deviceId) {
|
if (that.deviceId) {
|
||||||
that.log("Found an opener with ID " + that.deviceId +". Ready to open.");
|
that.log("Found an opener with ID " + that.deviceId +". Ready to send command...");
|
||||||
that.setTargetState();
|
that.setTargetState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,6 +146,7 @@ LiftMasterAccessory.prototype = {
|
|||||||
that.log("State was successfully set.");
|
that.log("State was successfully set.");
|
||||||
else
|
else
|
||||||
that.log("Bad return code: " + json["ReturnCode"]);
|
that.log("Bad return code: " + json["ReturnCode"]);
|
||||||
|
that.log("Raw response " + JSON.stringify(json));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
that.log("Error '"+err+"' setting door state: " + JSON.stringify(json));
|
that.log("Error '"+err+"' setting door state: " + JSON.stringify(json));
|
||||||
|
|||||||
Reference in New Issue
Block a user