 class Connector extends EventEmitter
   constructor: ->
     @limitMinutes = 2
-    @validUtil = ''#moment().utc().add(@limitMinutes, 'minute')
+    @validUntil = moment().utc().add(@limitMinutes, 'minute')
     @board = new five.Board {io: new Raspi(),repl: false,debug: false}
     @board.on 'ready', @handleReady
 

    @motion.on 'change', @updateValidUntil

  updateValidUntil: () =>
    @validUtil = moment().add(@limitMinutes, 'minutes').utc()
    console.log 'updateValidUntil Valid Until : ', @validUtil.toISOString()
    return

  getValidUntil: () =>
    return @validUtil

  isOnline: (callback) =>
    callback null, running: true

      console.log "curentMeeting found : ", currentMeeting
      meetingStartTime = _.get event, 'genisys.currentMeeting.startTime'
      noShowLimit = moment(meetingStartTime).utc().add(@limitMinutes, 'minute')
      if (moment().isBefore(noShowLimit) && moment(@validUntil.isBefore(moment())))
        @validUntil = noShowLimit
        console.log "Initializing valid until to no show limit as : #{@validUntil.toISOString()}"

      if (moment(@validUntil.isBefore(moment().utc())) && moment().utc().isAfter(noShowLimit))
        meetingId = _.get currentMeeting, 'meetingId'
        console.log "====================================="
        console.log "Ending meeting, validUntil: ", moment(@validUntil.toISOString())
        console.log "Ending meeting, current time: ", moment().toISOString()
        console.log "meetingStartTime: #{meetingStartTime} and No show limit :#{noShowLimit.toISOString()}" if moment().utc().isAfter(noShowLimit)
        @endMeeting meetingId


  endMeeting: (meetingId) =>
    console.log 'Ending meeting with meetingId:', meetingId
