core/homeassistant/components/tuya
BNolet 6fbdcac323
Fix setting color + brightness of Tuya lights (#88470)
* Check if changing TO a color mode

Changing brightness alone does not change work mode, but changing brightness with a color value will keep the light in white mode. 

By verifying the new state has color or not, rather than the existing state being in color work mode, the light will change to color correctly.

Tuya interprets HSV as including the brightness in the (v) value (which is generally what that's used for when setting HSV values). The brightness value given by Home Assistant is still used in this case.

* Fix brightness-only turning colour mode to white

This will take into account the case where brightness is the only parameter for both the case of colour mode and white mode.

Tests passed after this change:

* Brightness only (colour mode) 
* Brightness only (white mode) 
* Colour only (colour mode) 
* Colour only (white mode) 
* Colour temp only (colour mode) 
* Colour temp only (white mode) 
* Colour + brightness (colour mode) 
* Colour + brightness (white mode) 
* Colour temp + brightness (colour mode) 
* Colour temp + brightness (white mode) 

* Fix code formatting
2023-03-28 12:20:54 +02:00
..
__init__.py
alarm_control_panel.py
base.py
binary_sensor.py
button.py
camera.py
climate.py
config_flow.py
const.py
cover.py
diagnostics.py
fan.py
humidifier.py
light.py
manifest.json
number.py
scene.py
select.py
sensor.py
siren.py
strings.json
switch.py
util.py
vacuum.py