Nodejs-Script to combine tuyaapi and openhab via mqtt
MIT License
173
stars
80
forks
source link
my EleLight tuya bulb will not work with the present TuyaColorLight.prototype.setColor method because this tuya Bulb ignores dps 5 if you set dps 3 or dps 4 while setting dps 5, label:bug #22
try to set the color using your software where it sets dps 1, dps 2, dps 3, dps 4, and dps 5
The color on the light will go from color to White. Even if dps 2 is set to colour.
Expected behavior
I expected the bulb to change to the color I choose, not to turn white
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
OS: [e.g. iOS] Window 10
Browser [e.g. chrome, safari] Chrome
Version [e.g. 22]
Smartphone (please complete the following information):
Device: [e.g. iPhone6]
OS: [e.g. iOS8.1]
Browser [e.g. stock browser, safari]
Version [e.g. 22]
Additional context
I added a new update to my pull request that takes care of this problem and also gives you the correct linear equations to use for brightness conversion to 255 scale and the correct conversion equations for color temperature scale and saturation scales. I also discovered the correct format for dps 5 14 hex digit setting. Please see my comments on my current pull request number: fa22807
As far as I can determine, the correct format for dps 5 is as follows:
If the bulb is in 'colour' mode than the dps 3 and dps 4 are ignored but if you set them now some tuya bulbs will ignore dps 5 because you set dps 3 or dps 4. The tuya bulb will get the saturation settings and the brightness setting from (dps 5) hex digits.
A. FOR 'colour' mode the bulb looks at dps 1, dps 2, and dps 5.
i. DPS 5 is in the following format:
ii. HSL to HEX format are the leftmost hex digits (hex digits 14 - 9). This is as you did it before.
iii. hex digits 8 - 5 are the HSB/HSL Hue value in HEX format. Four HEX digits needed here.
iv. hex digits 4 - 3 are the HSB/HSL Saturation percentage as a value (converted to "0 - 255" scale) in HEX format.
v. hex digits 2 - 1 are the HSB Brightness percentage as a value (converted to "25 - 255" scale) in HEX format.
B. if the bulb is in 'white' mode then the dps 5 value is ignored by the bulb, FOR 'white' mode the bulb looks at dps 1, dps 2, dps 3 and dps 4
i. DPS 3 is the HSB/HSL Brightness percentage converted to a value; "25 to 255" in decimal format.
ii. DPS 4 is the HSB/HSL Saturation percentage converted to a value; "0 to 255" in decimal format.
So to give the software more flexibility, please do not automatically set dps 3 and dps 4, only set them when the bulb really needs them set.
Describe the bug the tuya Bulb ignores dps 5 if you set dps 3 and/or dps 4 while setting dps 5
To Reproduce Steps to reproduce the behavior:
Expected behavior I expected the bulb to change to the color I choose, not to turn white
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context I added a new update to my pull request that takes care of this problem and also gives you the correct linear equations to use for brightness conversion to 255 scale and the correct conversion equations for color temperature scale and saturation scales. I also discovered the correct format for dps 5 14 hex digit setting. Please see my comments on my current pull request number: fa22807
As far as I can determine, the correct format for dps 5 is as follows:
If the bulb is in 'colour' mode than the dps 3 and dps 4 are ignored but if you set them now some tuya bulbs will ignore dps 5 because you set dps 3 or dps 4. The tuya bulb will get the saturation settings and the brightness setting from (dps 5) hex digits.
A. FOR 'colour' mode the bulb looks at dps 1, dps 2, and dps 5. i. DPS 5 is in the following format: ii. HSL to HEX format are the leftmost hex digits (hex digits 14 - 9). This is as you did it before. iii. hex digits 8 - 5 are the HSB/HSL Hue value in HEX format. Four HEX digits needed here. iv. hex digits 4 - 3 are the HSB/HSL Saturation percentage as a value (converted to "0 - 255" scale) in HEX format. v. hex digits 2 - 1 are the HSB Brightness percentage as a value (converted to "25 - 255" scale) in HEX format.
B. if the bulb is in 'white' mode then the dps 5 value is ignored by the bulb, FOR 'white' mode the bulb looks at dps 1, dps 2, dps 3 and dps 4 i. DPS 3 is the HSB/HSL Brightness percentage converted to a value; "25 to 255" in decimal format. ii. DPS 4 is the HSB/HSL Saturation percentage converted to a value; "0 to 255" in decimal format.
So to give the software more flexibility, please do not automatically set dps 3 and dps 4, only set them when the bulb really needs them set.