function myDriver(opts,app) {

  var self = this;
  this._log = app.log;
  this._opts = opts;

  if ( !this._opts.deviceList ) {
    this._opts.deviceList = [];
  }
 

  if ( !this._opts.gotConfig ) {
    this._opts.gotConfig = false;
 
  }

    if ( !this._opts.test ) {
    this._opts.test = true;
 
  }
   this.registeredDevices = {};

 
  app.on('client::up',function(){

    // The client is now connected to the Ninja Platform
    // Register a device
   
    if(opts.gotConfig == true)
    {
  
      for ( var i = 0; i < opts.deviceList.length; i++ )
      {
        self.emit('register', new Device(this, opts.deviceList[i].type, opts.deviceList[i].id, opts.deviceList[i].name));
      }

      self.emit('register', new Device(this,"Energy","0000", "Energy Monitor"));
    }

  });
}
/**
 * Called when our client starts up
 * @constructor
 *
 * @param  {Object} opts Saved/default driver configuration
 * @param  {Object} app  The app event emitter
 * @param  {String} app.id The client serial number
 *
 * @property  {Function} save When called will save the contents of `opts`
 * @property  {Function} config Will be called when config data is received from the Ninja Platform
 *
 * @fires register - Emit this when you wish to register a device (see Device)
 * @fires config - Emit this when you wish to send config data back to the Ninja Platform
 */
Called when our client starts up
@constructor

@param  {Object} opts Saved/default driver configuration
@param  {Object} app  The app event emitter
@param  {String} app.id The client serial number

@property  {Function} save When called will save the contents of `opts`
@property  {Function} config Will be called when config data is received from the Ninja Platform

@fires register - Emit this when you wish to register a device
@fires config - Emit this when you wish to send config data back to the Ninja Platform
Called when our client starts up @constructor @param { Object } opts Saved / default driver configuration @param { Object } app The app event emitter @param { String } app . id The client serial number @property { Function } save When called will save the contents of ` opts ` @property { Function } config Will be called when config data is received from the Ninja Platform @fires register - Emit this when you wish to register a device @fires config - Emit this when you wish to send config data back to the Ninja Platform
function myDriver(opts,app) {
  var self = this;
  this._log = app.log;
  this._opts = opts;
  if ( !this._opts.deviceList ) {
    this._opts.deviceList = [];
  }
  if ( !this._opts.gotConfig ) {
    this._opts.gotConfig = false;
  }
    if ( !this._opts.test ) {
    this._opts.test = true;
  }
   this.registeredDevices = {};
  app.on('client::up',function(){
    if(opts.gotConfig == true)
    {
      for ( var i = 0; i < opts.deviceList.length; i++ )
      {
        self.emit('register', new Device(this, opts.deviceList[i].type, opts.deviceList[i].id, opts.deviceList[i].name));
      }
      self.emit('register', new Device(this,"Energy","0000", "Energy Monitor"));
    }
  });
}
function myDriver ( opts , app ) { var self = this ; this . _log = app . log ; this . _opts = opts ; if ( ! this . _opts . deviceList ) { this . _opts . deviceList = [ ] ; } if ( ! this . _opts . gotConfig ) { this . _opts . gotConfig = false ; } if ( ! this . _opts . test ) { this . _opts . test = true ; } this . registeredDevices = { } ; app . on ( 'client::up' , function ( ) { if ( opts . gotConfig == true ) { for ( var i = 0 ; i < opts . deviceList . length ; i ++ ) { self . emit ( 'register' , new Device ( this , opts . deviceList [ i ] . type , opts . deviceList [ i ] . id , opts . deviceList [ i ] . name ) ) ; } self . emit ( 'register' , new Device ( this , "Energy" , "0000" , "Energy Monitor" ) ) ; } } ) ; }
Called when our client starts up
 @constructor
Called when our client starts up @constructor
// The client is now connected to the Ninja Platform // Register a device