 
         ###
           Same as rejectWithErrorString, but has been deprecated
-          @param {Function} reject - function to reject a promise on return, may be null
+          @param {Function} reject - function to reject a promise on return,
+                                     may be null
           @param {Error} error  - error object
           @deprecated
         ###

        ###
          Generates a new device id which is not yet in use by another device
          @param {Object} framework - the pimatic framework object.
          @param {String} prefix - a prefix string to be used as part of device id.
          @param {String} [lastId] - the lastId returned by generateDeviceId
          @returns {String} the id generated or undefined if id could not be generated
        ###
        generateDeviceId: (framework, prefix, lastId = null) ->
          start = 1
          if lastId?
            m = lastId.match /.*-([0-9]+)$/
            start = +m[1] + 1 if m? and m.length is 2
          for x in [start...1000] by 1
            result = "#{prefix}-#{x}"
            matched = framework.deviceManager.devicesConfig.some (element, iterator) ->
              element.id is result
            return result if not matched
      }

            timerData.target = timerData.delay
            timerData.startTime = Date.now() - timerData.delay
          else
            elapsed = Date.now() - timerData.startTime
            adjust = timerData.target - elapsed

          timerData.target += timerData.delay
          if common._periodicTimers.hasOwnProperty(id)
            common._periodicTimers[id] =
              setTimeout(taskHandler, timerData.delay + adjust)
            timerData.func()

        return id
