Merge pull request #715 from EdJoPaTo/multiAccessories

fixed SamplePlatform crashes
This commit is contained in:
Khaos Tian
2016-07-30 18:40:35 -07:00
committed by GitHub

View File

@@ -28,7 +28,7 @@ function SamplePlatform(log, config, api) {
this.requestServer = http.createServer(function(request, response) {
if (request.url === "/add") {
this.addAccessory();
this.addAccessory(new Date().toISOString());
response.writeHead(204);
response.end();
}
@@ -176,10 +176,6 @@ SamplePlatform.prototype.addAccessory = function(accessoryName) {
console.log("Add Accessory");
var uuid;
if (!accessoryName) {
accessoryName = "Test Accessory"
}
uuid = UUIDGen.generate(accessoryName);
var newAccessory = new Accessory(accessoryName, uuid);
@@ -216,4 +212,4 @@ SamplePlatform.prototype.removeAccessory = function() {
this.api.unregisterPlatformAccessories("homebridge-samplePlatform", "SamplePlatform", this.accessories);
this.accessories = [];
}
}