Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(result => {
if (result[0] === 0 && result[1] === 0) {
const hsv = Utils.convertRGBToHSV({
red: result[2],
green: result[3],
blue: result[4],
});
this.setCapabilityValue('light_mode', 'color');
this.setCapabilityValue('light_hue', hsv.hue);
this.setCapabilityValue('light_saturation', hsv.saturation);
} else {
const temperature = Math.round(result[0] / 255 * 100) / 100;
this.setCapabilityValue('light_mode', 'temperature');
this.setCapabilityValue('light_temperature', temperature);
}
});
}, 500);