Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'Color Component ID': 2,
Value: Math.round(red),
},
{
'Color Component ID': 3,
Value: Math.round(green),
},
{
'Color Component ID': 4,
Value: Math.round(blue),
},
],
};
if (SwitchColorVersion > 1) {
setCommand.duration = typeof duration !== 'number' ? FACTORY_DEFAULT_COLOR_DURATION : Utils.calculateZwaveDimDuration(duration);
}
// Fix broken CC_SWITCH_COLOR_V2 parser
if (SwitchColorVersion === 2) {
setCommand = new Buffer([setCommand.Properties1['Color Component Count'], 0, setCommand.vg1[0].Value, 1, setCommand.vg1[1].Value, 2, setCommand.vg1[2].Value, 3, setCommand.vg1[3].Value, 4, setCommand.vg1[4].Value, setCommand.duration]);
}
return this.node.CommandClass.COMMAND_CLASS_SWITCH_COLOR.SWITCH_COLOR_SET(setCommand);
}
}