mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
different add times will create different UUIDs -> no crash with the second add call
This commit is contained in:
@@ -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 = [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user