 
 
 matchObject = (object, param) ->
-  return false if not object._keys?
+  return false if not object._keys? or object._keys.length == 0
   for k in object._keys
     v = common.matchType(param[k]._value, object[k])
     if param[k]._value != v

        if mongoQuery.test(device, p.precondition)
          devicePresets.push(p)

      configurations = accumulateConfigurations(devicePresets)
      now = Date.now()
      taskList = []
      expiry = config.PRESETS_CACHE_DURATION

  )


getObjectHash = (object) ->
  return object._id if not object._keys? or object._keys.length == 0
  hash = ''
  for k in object._keys
    hash += "#{k}=#{object[k]}"
  return hash

accumulateConfigurations = (presets, objects) ->
  maxWeights = {}
  configurations = {}
  for p in presets
