Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Update Conditional to account for "Colour" in the color mode property. #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

brannon-bowden
Copy link

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.

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 ")"
@brannon-bowden
Copy link
Author

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.

@gashead76
Copy link

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.

@brannon-bowden
Copy link
Author

@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.

@jlupini
Copy link

jlupini commented Jan 3, 2020

@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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants