code: function parseAccessoryJSON(json) {
  
    // parse services first so we can extract the accessory name
    var services = [];
  
    json.services.forEach(function(serviceJSON) {
      var service = parseServiceJSON(serviceJSON);
      services.push(service);
    });
  
    var displayName = json.displayName;
  
    services.forEach(function(service) {
      if (service.UUID === '0000003E-0000-1000-8000-0026BB765291') { // Service.AccessoryInformation.UUID
        service.characteristics.forEach(function(characteristic) {
          if (characteristic.UUID === '00000023-0000-1000-8000-0026BB765291') {// Characteristic.Name.UUID
            displayName = characteristic.value;
          }
        });
      }
    });
  
    var accessory = new Accessory(displayName, uuid.generate(displayName));
  
    // create custom properties for "username" and "pincode" for Core.js to find later (if using Core.js)
    accessory.username = json.username;
    accessory.pincode = json.pincode;
  
    // clear out the default services
    accessory.services.length = 0;
  
    // add services
    services.forEach(function(service) {
      accessory.addService(service);
    });
  
    return accessory;
  }
docs: Accepts object-literal JSON structures from previous versions of HAP-NodeJS and parses them into
  newer-style structures of Accessory/Service/Characteristic objects.