main.js
function Reset () {
  log.info('Reseting environment...')
  for (let m in motionDetectors) {
    RemoveDetector(motionDetectors[m])
  }
  for (let n in em.GetNotifiers()) {
    RemoveNotifier(em.GetNotifiers()[n], true)
  }
  em.SetNotifiers([])
  if (em.GetEnvironment()) {
    em.GetEnvironment().removeAllListeners('changedState')
    em.GetEnvironment().exit()
    em.SetEnvironment(undefined)
  }
  motionDetectors = []
  Object.keys(pm.GetPlugins()).forEach(function (key) {
    let p = pm.GetPlugins()[key]
    console.log(`  Attempting to reset plugin ${p.id} with key ${key}...`)
    if (p.Reset) {
      p.Reset()
      log.info('ok.')
    }
  })
  pm.ResetPlugins()
  config = {}
  log.info('Done Reseting environment.')
}
function Reset () {
  log.info('Reseting environment...')
  for (let m in motionDetectors) {
    RemoveDetector(motionDetectors[m])
  }
  for (let n in em.GetNotifiers()) {
    RemoveNotifier(em.GetNotifiers()[n], true)
  }
  em.SetNotifiers([])
  if (em.GetEnvironment()) {
    em.GetEnvironment().removeAllListeners('changedState')
    em.GetEnvironment().exit()
    em.SetEnvironment(undefined)
  }
  motionDetectors = []
  Object.keys(pm.GetPlugins()).forEach(function (key) {
    let p = pm.GetPlugins()[key]
    console.log(`  Attempting to reset plugin ${p.id} with key ${key}...`)
    if (p.Reset) {
      p.Reset()
      log.info('ok.')
    }
  })
  pm.ResetPlugins()
  config = {}
  log.info('Done Reseting environment.')
}
function Reset ( ) { log . info ( 'Reseting environment...' ) for ( let m in motionDetectors ) { RemoveDetector ( motionDetectors [ m ] ) } for ( let n in em . GetNotifiers ( ) ) { RemoveNotifier ( em . GetNotifiers ( ) [ n ] , true ) } em . SetNotifiers ( [ ] ) if ( em . GetEnvironment ( ) ) { em . GetEnvironment ( ) . removeAllListeners ( 'changedState' ) em . GetEnvironment ( ) . exit ( ) em . SetEnvironment ( undefined ) } motionDetectors = [ ] Object . keys ( pm . GetPlugins ( ) ) . forEach ( function ( key ) { let p = pm . GetPlugins ( ) [ key ] console . log ( ` ${ p . id } ${ key } ` ) if ( p . Reset ) { p . Reset ( ) log . info ( 'ok.' ) } } ) pm . ResetPlugins ( ) config = { } log . info ( 'Done Reseting environment.' ) }
Resets the current context environment, notifiers and motion detectors.
@public
Resets the current context environment notifiers and motion detectors .