mirror of
https://github.com/lehanspb/tuya-mqtt.git
synced 2025-12-16 17:54:36 +00:00
correct file
sorry for the screw up.....must be getting tired
This commit is contained in:
@@ -181,26 +181,20 @@ TuyaColorLight.prototype.setHSL = function (hue, saturation, brightness) {
|
||||
this.setHue(hue);
|
||||
}
|
||||
|
||||
TuyaColorLight.prototype._stripBraces = function (string) {
|
||||
return string.slice(1,-1);
|
||||
}
|
||||
/**
|
||||
* Set color from given string
|
||||
* @param {String} colorValue could be HEX or HSL color type
|
||||
* @returns {Object} dps settings for given color
|
||||
*/
|
||||
TuyaColorLight.prototype.setColor = function (colorValue) {
|
||||
var colorValue2;
|
||||
debug("Recieved color", colorValue);
|
||||
|
||||
debug("Received color", colorValue);
|
||||
colorValue2 = this._stripBraces(colorValue);
|
||||
debug("colorValue2 = "+colorValue2);
|
||||
if (this._ValIsHex(colorValue2)) {
|
||||
if (this._ValIsHex(colorValue)) {
|
||||
debug("Color is Hex");
|
||||
color = convert.hex.hsl(colorValue2);
|
||||
var color = convert.hex.hsl(colorValue);
|
||||
} else {
|
||||
debug("Color is HSL");
|
||||
var color = colorValue2.split(",");
|
||||
var color = colorValue.split(",");
|
||||
// convert strings to numbers
|
||||
color.forEach(function (element, key) {
|
||||
color[key] = parseInt(element, 10);
|
||||
@@ -250,4 +244,4 @@ TuyaColorLight.prototype.getDps = function () {
|
||||
return dpsTmp;
|
||||
}
|
||||
|
||||
module.exports = TuyaColorLight;
|
||||
module.exports = TuyaColorLight;
|
||||
Reference in New Issue
Block a user