Closed blaineam closed 8 years ago
@pdlove any suggestions?
I can confirm hiding the bulbs id's does not fix the issue with turning on every time home bridge restarts. it did hide them on the home app though.
@techyowl Once it's on, doe it allow controlling the color? I know why it's doing it and can resolve it, but I'd like to fix an issue that is occurring with color controls on some of the other types of lights if I can. Can you remove lines 55-58 in the file accessories/light_bulbs.js? It's the code that reads like this: if (that.device.desired_state.color_model != undefined) that.updateWinkProperty(function () { return 0; }, "color_model", "hsb", true);
I have homer bridge-wink vs 1.0.2 installed and I just tried changing the colors which didn't work even after unhiding the bulbs. i can turn them on and off though. I can try to remove that section of code.
@pdlove removing that did work for fixing the lights turning on by themselves but still didn't allow for hue controls. I'm not worried because i don't need them since i bought the new hue bridge which has builtin home kit support. still thanks for guiding me to a fix so quickly. you rock!
The ultimate issue is that Wink doesn't support Hue/Saturation/Brightness properly. I tried working around this by using Wink's own function, but what I really need to do is bring in a conversion library that converts from hsb to the xyb. I will probably simply remove the color support for now, but I'll look first tomorrow to see if I can find an easier way.
Well I don't think it uses the xyb but rather the xy color triangle based on the cie 1931 color coordinated based on 0-1.0 and I was wondering couldn't you just convert the Siri imputed color value to a hex code and pass that without the hashtag in front of it. I'm not sure because the app is rather confusing as to whether it allows you to choose hsb rgb or xy as the color model or wether that would already be set based on the bulb type.
So you can convert an hsb to a xyz value. But I couldn't find anything on xyb. Other then a Wikipedia article but no conversion algorithms.
@pdlove
@techyowl You see the issue. I'm telling Wink the color type in the line of code that apparently turns hue on. Wink is setting it back at some point before I set it. I'm thinking it might work to set hue/saturation and then tell wink to use the new color type. I don't have any Wink-compatible color changing lights, so it's harder for me to work through.
Well if you tell me what to patch I can test it if you'd like todo it that way. I don't think I can share Phillips hue lights at least it doesn't appear that way much the same way the wink relay couldn't be shared.
Try the light_bulbs from here: https://raw.githubusercontent.com/pdlove/homebridge-wink/develop/accessories/light_bulbs.js
Let me know if that lets you set the color. If so, that's probably sufficient for what this plugin should do.
@pdlove that script made it to where the hue bulbs didn't respond at all to the hue saturation or power. whats weird is the home app allows me to toggle the power state on and off but this didn't cause any action on the hue bulbs. however it had the hue and saturation locked to their previous values. so that seemed to break it more than it helped. however it didn't power on by themselves which is good.
@pdlove scratch the power state not working i must not have let home bridge initiate fully the power state and brightness sliders work properly. the hue and saturation are locked to their previous values.
@techyowl I was just hoping that would work. I think I found a proper conversion from HSB to XYB, so I'll proceed with that. Did you say wink won't let you share the Hue bulbs with me? If it will, please do so.
i can't share them the normal way so I sent you an email with access to a blank wink account setup with my hue light bulbs. let me know if that will work. I sent the email to the one attached to your wink account you sent us before. @pdlove
any progress on this? @pdlove
@techyowl Try out @pdlove's changes in release 1.1.0
I just tried to issue the command via the home app and when I go to set the hue it acts like it will set it but then it jumps the hue to 0 degrees and then when you reload the device in the app it gets frozen and stops responding to all changes. I would like to add that I got color controls working on my GitHub wink web interface and this required converting color spaces from on to another and I used a JS plugin called tinyColor to help with this. The input gave me a hex color code and I then converted it to hsv(almost the same thing as hsb as far as I could tell) and to rgb. The rgb was then sent to the algorithm to convert it to xyz(z being almost the same as brightness as well) then I sent the color mode hsb, color_x, Color_Y, hue, saturation, brightness, powered state, and even the color value and I can set and control the color based on this. Part of the script is below if you wish to see it.
change: function(color) {
newColornohash = color.toHexString().replace('#', '');
newrgb = tinycolor(color.toHexString()).toRgbString().replace('rgb(', '').replace(')', '').split(', ');
var_R = (newrgb[0] / 255) //R from 0 to 255
var_G = (newrgb[1] / 255) //G from 0 to 255
var_B = (newrgb[2] / 255) //B from 0 to 255
if (var_R > 0.04045) var_R = ((var_R + 0.055) / 1.055) ^ 2.4
else var_R = var_R / 12.92
if (var_G > 0.04045) var_G = ((var_G + 0.055) / 1.055) ^ 2.4
else var_G = var_G / 12.92
if (var_B > 0.04045) var_B = ((var_B + 0.055) / 1.055) ^ 2.4
else var_B = var_B / 12.92
var_R = var_R * 100
var_G = var_G * 100
var_B = var_B * 100
//Observer. = 2°, Illuminant = D65
newX = var_R * 0.4124 + var_G * 0.3576 + var_B * 0.1805
newY = var_R * 0.2126 + var_G * 0.7152 + var_B * 0.0722
//Z = var_R * 0.0193 + var_G * 0.1192 + var_B * 0.9505
newhsb = tinycolor(color.toHexString()).toHsvString().replace('hsv(', '').replace(')', '').replace('%', '').split(', ');
newhue = newhsb[0] / 360;
newsaturation = newhsb[1] / 100;
newbrightness = newhsb[2].replace('%', '') / 100;
var body = {
"desired_state": {
"powered": true,
"color_model": "hsb",
"color": newColornohash,
"color_x": newX,
"color_y": newY,
"brightnes": newbrightness,
"hue": newhue,
"saturation": newsaturation
}
};
I also feel like adding that the phillips hue lightbulbs supported by wink already are capable of home kit siri integration via their new hub and I remember reading that home bridge is designed to support smart home devices that don't yet have home kit integration. I mean right now thats the only wink supported color lightbulbs that i'm aware wink supports although if they add support for the LIFX bulbs I would be so much more like hey lets get this bug fixed but I honestly don't even need home bridge support for my phillips hue bulbs seeing as i have their new hub already and home bridge-wink makes them duplicated to siri.
Ecosmart also makes a bulb that will integrate with Wink. I'll be adding a few HUE bulbs to my setup that will be connecting directly to the Wink hub, so I'll test that at that time. In my tests using your shared account, I used EVE to set the color from the color swath and everything appeared to work properly according to setting the color and then looking to see if the Wink app reflected the new color. I also told Siri to set the color to Blue and Wink updated correctly to reflect the light was blue. Color conversions are difficult because wink uses a funky xyY color scheme instead of RGB or HSV. I'll take a look at your example above as well if I have any trouble. The formulas in it look like ones I've tried before that didn't work properly to convert xyY to RGB.
@pdlove yeah color conversions are a pain and I decided to revisit this now that I'm not as busy and I have some information to add.
The Hue bulbs don't turn on when homebridge-wink rescans which is what this issue is originally titled as. The Home app doesn't currently support color bulbs very well or something is playing nicely with it idkw. To redo the test with version 1.1.1 I enabled one of my hue light bulbs. I then decided to rename it in the home app so I am sure siri send the command to the correct device by renaming it from Living Room Hue 3 to Home Bridge which is phonetically different from any of the other phillips hue bulbs and is different from any of the other devices. I then tested sending the command through siri such as "Set Home Bridge to Blue" which seems to set it to purple in person but the wink app shows a dark blue. I though surely that isn't working but I tested it with green and it showed a yellowy green and then I tried red and it showed red. My dad also didn't think it was blue either and we aren't color blind according to our eye doctors and the wink app seems to represent the correct color so I think it has to do with how the Hue bulbs respond to color values.
so I suppose we can close this issue as fixed.
Thanks again so much @pdlove for working through all this and I hope your able to enjoy your hue bulbs when they get setup.
This may be a dumb question but I just can't seem to find the answer and it sort of pertains to this conversation. In my configure.json under the Wink platform section, what is the correct syntax to hide just the Hue lights? It is currently set to ignore "thermostats", that works fine, the Ecobee doesn't show up in homebridge. But since I have the 2nd gen Hue hub, the lights are duplicated in a HomeKit app. Thanks for any help.
I'm don't know how it works now with the current version but when you used to start homebridge it would print out a really long string of JSON that contains a device ID for each hue light bulb. Adding that to your hidden devices array for each bulb in the configuration file for homebridge will remove each one. I had to do the same thing and luckily we only had 3 hue bulbs. Best of luck. Also using an online JSON beautified might be helpful in finding the id's.
I have an issue where my hue lights turn themselves on when home bridge starts up and I believe it is more related to when the wink plugin registers the wink devices because every so often they hue lights turn themselves on. I don't need to control the phillips hue lights with the wink plugging because I upgrade my phillips hue bridge to the home kit compatible one. is there any way to disable the phillips hue lights from a turning on by themselves and by possibly hide them from the home kit devices.