Update Conditional to account for "Colour" in the color mode property.#52
Update Conditional to account for "Colour" in the color mode property.#52brannon-bowden wants to merge 2 commits intobasdelfos:masterfrom brannon-bowden:patch-1
Conversation
It appears some devices return "colour" not "color". This definitely causes issue when parsing out the Saturation and Brightness, and helps resolve some of the issues with specific RGB Strips. There appears to still be an issue with Saturation specifically, but trying to sort through that next.
Fixed two missing closing ")"
|
Ok, figured out one of the issues with saturation. Math.floor(Percentage / 100) * 255 isn't going to work. Anything under 100 would be 0 * 255. It needs to be at minimum Math.floor((Percentage / 100) * 255. I actually propose to change to Math.ceil as well. |
|
Anyway I can implement this on a mostly functional install of the latest release? I get wonky saturation issues and wrong colors/colours when attempting to change them via HomeKit. |
|
@gashead76 I have found another issue that I can't figure out how to resolve that is preventing me from finishing the fixes. There are occasional times where the values get sent to the API and the tuya api responds with success, but it wasn't actually succesful. (The lights don't change and on the next poll of the api, the value never updated). There is no apparent rhyme or reason. Unfortunately it isn't as simple as it failed, press the preset color again, because on the poll it updates the homekit preset colors and changes them to the previous value. |
|
@Sytanek I was getting an issue on my lights where attempting to set the color would set the hue correctly but the saturation would be zero. After poking around for a while I figured out that it's because my lights want saturation as a float from 0-1. No idea if this is a common thing as I only have one light type but it could also be the cause of @gashead76's problem. Any thoughts? |
It appears some devices return "colour" not "color". This definitely causes issue when parsing out the Saturation and Brightness, and helps resolve some of the issues with specific RGB Strips. There appears to still be an issue with Saturation specifically, but trying to sort through that next.