kpsuperplane / homebridge-wiz-lan

Control Wiz lights over LAN
Apache License 2.0
117 stars 37 forks source link

Color picker issues for RGB Bulbs (red) #111

Open piazzatron opened 2 years ago

piazzatron commented 2 years ago

Just set up my first pair of Wiz lights and this plugin discovered them up right away - however, I'm finding that the Homekit color picker can't select any red hues - this lights are either either purple, or white, depending on the location of the picker (right above or below true red).

Anybody else experienced something similar? Is there any way to get the lights to be red without using the Wiz app?

For reference, I'm using WiZ IZ20126084 60 Watt EQ A19, RGB+ Color.

Great work with this plugin, also - aside from this one issue, the experience was quite flawless.

kpsuperplane commented 2 years ago

... can you share a screenshot? That sounds super odd

piazzatron commented 2 years ago

Will do you one better - two photos of phone + light color. image

image

The lights are either this white color, or a purple depending on whether the picker is just above or below 90 degrees on the circle.

LMK if I can provide any other helpful info to repro :)

piazzatron commented 2 years ago

@kpsuperplane, I spent a while digging around on this one tonight. Haven't quite figured it out yet, but it looks like the plugin is sending proper values, and somehow on the Wiz side of things, the color is displayed incorrectly.

If I manually set the RGB values to 255, 0, 0, we see the red we'd expect. However, values such as 255, 0, 30, which are almost red, appear as purple. Give it 255, 20, 40, you get white.

Try it for yourself. Send a UDP packet with this value, which should be red, and watch what you get (white):

echo '{"method":"setPilot","env":"pro","params":{"mac":"MAC_HERE","src":"","state":true,"r":255,"g":20,"b":40,"c":0,"w":0}}' | nc -u IP_HERE 38899 {"method":"setPilot","env":"pro","result":{"success":true}}

(Command courtesy of https://github.com/kpsuperplane/homebridge-wiz-lan/issues/100)

I guess the next step is to packet sniff the iPhone Wiz app to see how they handle...

EDIT: Ok, I think I figured this one out. I inspected the Wiz packets and they look similar to the ones we're sending - it seems like the lights are just very sensitive in this range to any values that aren't exactly 255, 0, 0, and because we're dealing with a circular color picker, it's very difficult to get exactly that value. I think the solution is to snap to 255, 0, 0 if we're close enough to it on the picker?

BTW, the Wiz packets look like {"id":369,"params":{"orig":"ios","g":26,"b":0,"r":255,"w":0,"c":0}. Not sure what env: pro does in the Pilot, and src: "" seems to be absent from their packets.

MoTechnicalities commented 2 years ago

Related -->> #115