zettajs/zetta

Custom device uuid

Opened this issue · 2 comments

Hi,

I am wondering is there any way to assign a custom uuid for a device. like below:

DeviceDriver = function() {
  this.uuid = "<uuid>";
  Device.call(this);
}

just need to have a consistent uuid.

I believe you can manually override it with something like:

DeviceDriver = function() {
  // Device constructor first sets the id = uuid.v4()
  Device.call(this);
  // Override it after that.
  this.id = "<uuid>";
}

@AdamMagaluk it does not work as expected. Here is what I did.

var Water = module.exports = function DeviceDriver() {
  Device.call(this);
  this.id = "12121212-1111-1111-1111-121212121212";
}

Still use the default uuid.
screen shot 2017-07-28 at 8 07 54 pm

Here is the JSON returned which you can see the id is the default one.
screen shot 2017-07-28 at 8 09 52 pm