different add times will create different UUIDs -> no crash with the second add call

This commit is contained in:
Edgar To
2016-07-24 22:38:05 +02:00
parent a52bc9e437
commit e6648375c7

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 = [];
}
}