misenhower / homebridge-wyze-connected-home

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

Fix: Setting groups of lights by a scene #23

Open caseypugh opened 3 years ago

caseypugh commented 3 years ago

Problem

When setting groups of lights via a scene, it doesn't always set all the lights to the correct power state, brightness, and color. This is due to a couple of possible reasons:

How to test/recreate

Then try toggling between the two scenes. You'll see it wont always work, but with delays, it does.

Solution

This adds a small async delay to the brightness & color, which guarantees setting the power state first. This seems to have fixed the underlying issue, but I'm not sure it is the best approach. I'm new to writing homebridge plugins :)

Also, this adds the package-lock.json to the repo. Not sure why that was not included?

This fixes https://github.com/misenhower/homebridge-wyze-connected-home/issues/19

caseypugh commented 3 years ago

package.lock.json isn't added because the repo already has a yarn.lock (yarn install is meant to be used, not npm intsall)

Thanks, totally missed the yarn.lock. Removed!

Pantman commented 3 years ago

Just wondering, is this going to get merged into master at some point?

ammacdonald3 commented 3 years ago

I manually updated my Homebridge to use this new version by @caseypugh , and it greatly improves the user experience. I have four lights on one scene, and they all now turn off and turn on together, whereas previously one or two would randomly not change in sync with the others. Barring any issues, I definitely recommend including this in the official build. Thanks!

Pantman commented 3 years ago

I'm running the branch, but I find my scenes sometimes still don't work. In my case, I have an "evening lights" scene which sets the power state, temperature, and brightness.

I have a number of similar scenes in the house, and most days, one or two bulbs get stuck.

Any suggestions on how to tweak?

caseypugh commented 3 years ago

@Pantman you might want to try increasing the delay between the calls and see if that fixes it. I sort of randomly set it to a 0.5s delay. https://github.com/misenhower/homebridge-wyze-connected-home/pull/23/files