ivarho / hubitatappndevice

19 stars 4 forks source link

tuyaGenericBulbRGBW only allows white or RGB settings not both #6

Open mores opened 1 year ago

mores commented 1 year ago

I have a smart ceiling light: https://www.amazon.ae/Dimmable-Yuusei-Changing-Backlight-Compatible/dp/B08XK2ND53 It can display BOTH a white light AND a RGB light at the same time.

When setting white color temperature - it turns off the RGB light. When setting the Level - it turns off the RGB light. When setting the Color Bulb Options - it turns off the white light.

ivarho commented 10 months ago

Hello, actually there is nothing in the driver that limits this behavior. I.e. the driver does not explicitly turn off the "white LED" mode when enabling the RGB mode. It is up to the bulb, or light in this case, to handle the incoming messages.

I have a few RGB bulbs now, both tuya, and other Zigbee bulbs, non of them support being in both RGB and while LED mode. Are you sure this is actually a feature on the light you have?

mores commented 10 months ago

Yes, my fixture has both - see attached image tuya

If I remember correctly - the driver is not sending both white color temperature and RGB Color Bulb options at the SAME time

mores commented 10 months ago

From Debug logs: Set Color: dps":{"24":"000701b800aa","21":"colour"}} Set Level: dps":{"22":40}}

My guess is that the following would work: dps":{"22":40,"24":"000701b800aa","21":"colour"}}

ivarho commented 9 months ago

hi again, sorry for the late reply. I have been busy working on support for 3.4 version of the tuya protocol. I have been reading through the tuya spec on the protocol, and there is nothing there that has support for bulbs with dual modes except scenes. Could you try my latest version of the driver (which has support for scenes) called effects and see if that would do the trick? You can also try to run the "status" function on the bulb, and see what comes back in the rawMessage field: image That might give some clues to how the fixture is implemented.

The one you suggested is the brightness level (https://developer.tuya.com/en/docs/iot/generic-light-bulb-template?id=Kag3g03a9vy81#title-6-Brightness%20value) and I do not see setting that together with the color mode should do what you want.

mores commented 9 months ago

When light is white: rawMessage : {20=true, 22=40, 23=285, 24=000701b800aa, 26=0}

When light has color: rawMessage : {24=0085027600fa}

When fixture has white AND color: rawMessage : {20=true, 21=colour, 22=40, 23=285, 24=0085027600fa, 26=0}

ivarho commented 9 months ago

I have added a possibility to send a custom JSON message to the bulb. This feature is currently in the feature/heart_beat branch. With this you can test different commands to the bulb, once you get something you are happy with let me know and I can implement in the driver. This is how the driver field: image

mores commented 9 months ago

My fixture supports https://developer.tuya.com/en/docs/iot/product-function-definition?id=K9s9rhj576ypf#title-11-DP28%3A%20real-time%20adjustment

In Custom JSON Object I sent: {"28":"1007603e803e800120025"} <- white and green lights {"28":"103e803e803e800120025"} <- white and red lights

ivarho commented 9 months ago

Fantastic, this should be solvable. I am thinking that I can add a configuration in the driver (perhaps I make a separate driver as the RGBW driver starts to become quite crowded) where you can select if you want to use DP 28 for configuring the lights. Does that make sense?

On Tue, Jan 16, 2024 at 9:51 PM mores @.***> wrote:

My fixture supports https://developer.tuya.com/en/docs/iot/product-function-definition?id=K9s9rhj576ypf#title-11-DP28%3A%20real-time%20adjustment

In Custom JSON Object I sent: {"28":"1007603e803e800120025"} <- white and green lights {"28":"103e803e803e800120025"} <- white and red lights

— Reply to this email directly, view it on GitHub https://github.com/ivarho/hubitatappndevice/issues/6#issuecomment-1894492766, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRITKW56DDDEGSFPHZSHTYO3R5XAVCNFSM6AAAAAA5E5FE3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJUGQ4TENZWGY . You are receiving this because you commented.Message ID: @.***>

mores commented 9 months ago

Yes, thanks.

ivarho commented 9 months ago

Hello, this was more complex than I anticipated. However, I have started on an implementation in the branch called adding_support_for_dp28. Take a look if you want to do some early testing. Note it is very buggy at the moment. I have to deal with the driver updating its own state when using DP28 as the tuya protocol defines this as a one way command only, and the only answer you get from the bulb is that it has received the message.

ivarho commented 8 months ago

Hello, can you take a look at the final solution found in adding_support_for_dp28 branch, and let me know if this solves your use-case?

mores commented 8 months ago

This does allow me to control the color of the outer ring - I can turn the color off by setting it to black.

How can I turn off the white light, and leave the color on ? The off button currently turns BOTH lights off.

ivarho commented 8 months ago

I think you should be able to set the dim level to 0%, at least that worked on my end (with a regular bulb).

On Sun, Jan 28, 2024 at 1:16 PM mores @.***> wrote:

This does allow me to control the color of the outer ring - I can turn the color off by setting it to black.

How can I turn off the white light, and leave the color on ? The off button currently turns BOTH lights off.

— Reply to this email directly, view it on GitHub https://github.com/ivarho/hubitatappndevice/issues/6#issuecomment-1913576841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRITK6V7OFSNQGXPGPGJDYQY6S7AVCNFSM6AAAAAA5E5FE3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJTGU3TMOBUGE . You are receiving this because you commented.Message ID: @.***>

mores commented 8 months ago

I have been testing out using the dashboard… Moving the level makes the fixture brighter or dimmer - great. Setting a color makes the fixture show the color - great.

When the color changes, the dashboard level changes, the fixture brightness does not. The level in the dashboard no longer represents the actual level on the fixture, not so great.

ivarho commented 8 months ago

Yes, this is an "expected" behaviour as Hubitat re-uses the same 'level' for the level part of the hue, saturation, level (HSL color code) and the dim 'level'. Hence you will see this strange behaviour in the dashboard. This is not unique to this driver, this is just how Hubitat deals with colors and dim levels. I suspect it was never thought about the possibility of having a single light in a "dual" mode. Ideally the Hubitat platform should have used different attributes for storing the dim level and the color level, but as of now that is not the case. You see this if you take a look at the capability overview in the Developer section of the Hubitat documentation. So I do not think I can fix this the way the driver is implemented.

That being said, one solution could be to start playing with sub devices, I have done that before, but it quickly gets messy, but perhaps that is the way to go with this one?

Med vennlig hilsen

Ivar Holand

Epost: @.***

Mobiltelefon: 97182055

On Tue, Jan 30, 2024 at 3:41 PM mores @.***> wrote:

I have been testing out using the dashboard… Moving the level makes the fixture brighter or dimmer - great. Setting a color makes the fixture show the color - great.

When the color changes, the dashboard level changes, the fixture brightness does not. The level in the dashboard no longer represents the actual level on the fixture, not so great.

— Reply to this email directly, view it on GitHub https://github.com/ivarho/hubitatappndevice/issues/6#issuecomment-1918034414, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRITIBPOR3M5F64B4LLETYRFZJRAVCNFSM6AAAAAA5E5FE3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJYGAZTINBRGQ . You are receiving this because you commented.Message ID: @.***>