misenhower / homebridge-wyze-connected-home

Wyze Connected Home plugin for Homebridge
MIT License
70 stars 52 forks source link

Initial support for new Wyze Color Bulbs #35

Open mda590 opened 3 years ago

mda590 commented 3 years ago

This PR adds support for new Wyze Color Bulbs to this Homebridge plug-in.

A few things of note:

I would love others to test this out and see if there is some kind of edge case I overlooked - and even to help contribute any fixes. It doesn't look like this project is very active any more so we will see if we can get this merged or if we need to branch out and create our own.

At the end of the day, the bulb shows up in the Home app and allows me to control all aspects of the bulb: image image image

dejaloomer commented 3 years ago

Thanks for this. One comment... I'm getting pretty strange results when trying to set color. If brightness is 100% the rgb value is computed as white. Online converters confirm that's expected...so I replaced hsl calculations with hsv and hardcode v to 100% . I don't see homekit ever sending brightness when changing colors so I suspect it's not meant to be used in the rgb calc. I'm brand new to colorspace conversion though...so might be wrong...but it at least seems to be working.

mda590 commented 3 years ago

@dejaloomer can you share the changes you made? I had a lot of issues with this part, as well, and your change to HSV makes sense based on everything I read! I would be interested to get that put into this PR (if you want to do a PR against my fork, I can merge that).

InstigatorX commented 3 years ago

@dejaloomer can you share the changes you made? I had a lot of issues with this part, as well, and your change to HSV makes sense based on everything I read! I would be interested to get that put into this PR (if you want to do a PR against my fork, I can merge that).

I noticed the odd behavior at 100% brightness as well. You might consider using https://www.npmjs.com/package/colorsys to standardize on the calcs/method.

mda590 commented 3 years ago

Oh wow, great find! I'll work on incorporating that into the code.

Sent from my iPhone


From: InstigatorX @.> Sent: Wednesday, April 7, 2021 5:08:44 PM To: misenhower/homebridge-wyze-connected-home @.> Cc: Matt Adorjan @.>; Author @.> Subject: Re: [misenhower/homebridge-wyze-connected-home] Initial support for new Wyze Color Bulbs (#35)

@dejaloomerhttps://github.com/dejaloomer can you share the changes you made? I had a lot of issues with this part, as well, and your change to HSV makes sense based on everything I read! I would be interested to get that put into this PR (if you want to do a PR against my fork, I can merge that).

I noticed the odd behavior at 100% brightness as well. You might consider using https://www.npmjs.com/package/colorsys to standardize on the calcs/method.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/misenhower/homebridge-wyze-connected-home/pull/35#issuecomment-815294948, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABBECJLYKM7632FYPIEGSULTHTJWZANCNFSM42LNQ2RA.

mda590 commented 3 years ago

@dejaloomer @InstigatorX - this is updated to use HSV and the colorsys package now. This seems to work much better, especially when brightness is at 100. Let me know if you notice any issues after the change.

InstigatorX commented 3 years ago

Oh wow, great find! I'll work on incorporating that into the code. Sent from my iPhone ____ From: InstigatorX @.> Sent: Wednesday, April 7, 2021 5:08:44 PM To: misenhower/homebridge-wyze-connected-home @.> Cc: Matt Adorjan @.>; Author @.> Subject: Re: [misenhower/homebridge-wyze-connected-home] Initial support for new Wyze Color Bulbs (#35) @dejaloomerhttps://github.com/dejaloomer can you share the changes you made? I had a lot of issues with this part, as well, and your change to HSV makes sense based on everything I read! I would be interested to get that put into this PR (if you want to do a PR against my fork, I can merge that). I noticed the odd behavior at 100% brightness as well. You might consider using https://www.npmjs.com/package/colorsys to standardize on the calcs/method. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABBECJLYKM7632FYPIEGSULTHTJWZANCNFSM42LNQ2RA.

@dejaloomer @InstigatorX - this is updated to use HSV and the colorsys package now. This seems to work much better, especially when brightness is at 100. Let me know if you notice any issues after the change.

Yeah man! Works much better now. Only weirdness is setting TEMPERATURE in Home app. When you select something around the curve it changes the light color accordingly, but then jumps to another spot with the original color in the circle. Not sure how to explain it.

dejaloomer commented 3 years ago

I just pushed my changes to a fork in my repo. Unfortunately before I discovered your changes I had branched off off RMCob/homebridge-wyze-connected-home-op which seemed to have more recent support than misenhower. I used color-convert package and your wyze property list changes so we probably ended up with about the same solution. One thing I added that you might want to check out is that I batch multiple property-set requests into a single transaction. This seems to have fixed issues with bulbs getting out of sync when homekit uses scenes or groups to rapidly change a bunch of settings.