In presets, ignore config parameters that don't exist in the device

This commit is contained in:
Zaid Abdulla committed 2013-01-15 16:34:18 +03:00
1 parent 77d1c86b86
commit cd67e50062
2 files changed
+10 -6

No files matched your search

+4 -3
View File
@@ -73,9 +73,10 @@ exports.assertPresets = (deviceId, presetsHash, callback) ->
switch c.type
when 'value'
src = common.getParamValueFromPath(device, "#{c.name}._value")
dst = common.matchType(src, c.value)
if src != dst
setParameterValues.push([c.name, dst])
if src isnt undefined # ignore parameters that don't exist
dst = common.matchType(src, c.value)
if src != dst
setParameterValues.push([c.name, dst])
when 'age'
timeDiff = (now - common.getParamValueFromPath(device, "#{c.name}._timestamp")) / 1000
if (c.age - timeDiff < config.PRESETS_TIME_PADDING)