From e6648375c7b92336c90f05765726008756df7f11 Mon Sep 17 00:00:00 2001 From: Edgar To Date: Sun, 24 Jul 2016 22:38:05 +0200 Subject: [PATCH] different add times will create different UUIDs -> no crash with the second add call --- example-plugins/homebridge-samplePlatform/index.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/example-plugins/homebridge-samplePlatform/index.js b/example-plugins/homebridge-samplePlatform/index.js index 353513e..71315b2 100644 --- a/example-plugins/homebridge-samplePlatform/index.js +++ b/example-plugins/homebridge-samplePlatform/index.js @@ -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 = []; -} \ No newline at end of file +}