Replies: 1 comment
-
Rather than changing the code, which works properly for a variety of lightbulbs already, you should change your config's definition of the brightness dp to the dp that works, using a mask to pull out just the brightness portion. The issue appears to be that your dp 6 does not work at all, and you want it to use the hsv dp even when in white mode if I understand your explanation correctly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've found that on a bulb that I am working with, it doesn't take a brightness integer value in DPS ID 6, and rather takes the value as the V value of the HSV parameter into DPS ID 5. As a result, when you use the Home Assistant UI to set a color, it works just fine, but if you attempt to set only a brightness, while leaving the color unchanged, then it will silently fail, since it's trying to set an integer value to DPS ID 6 which the bulb ignores.
See discussion #1226 for additional details.
By changing line 262 in light.py to
or (ATTR_BRIGHTNESS in params and self.raw_color_mode != ColorMode.HS)
then all works just fine, and setting only a brightness will properly set the brightness of the bulb, since it is also passing the color to the bulb along with the brightness.
tuya-local/custom_components/tuya_local/light.py
Lines 260 to 265 in 72dca99
Doing this change will render this part of the code useless. I haven't reverse engineered this enough to know if this will cause issues for other types of bulbs.
tuya-local/custom_components/tuya_local/light.py
Lines 346 to 359 in 72dca99
However - when you set the mode of the light to white, you should be able to control the brightness (not temperature) of the white light. The still needs to be passed in a hex format for the light in question, and there needs to be logic built to account for that. Otherwise, by doing the fix above, it still seems to grab the old RGB color value that is stored in HA and pass that to the light, rather than passing a white value with brightness to the light.
Beta Was this translation helpful? Give feedback.
All reactions