homebridge-wyze-connected-home icon indicating copy to clipboard operation
homebridge-wyze-connected-home copied to clipboard

Fix: Setting groups of lights by a scene

Open caseypugh opened this issue 4 years ago • 5 comments

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:

  • Requests are sent simultaneously to Wyze, but Wyze requires a delay between each request to recognize the command.
  • Requests are sent to Wyze out of order. Sometimes it sets the brightness, and then the power is turned on.

How to test/recreate

  • Set up a scene with 2 or more wyze bulbs setting brightness to 100% and color temp to white for both
  • Set up a scene with 2 or more wyze bulbs setting brightness to 20% and color temp to yellow for both

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 avatar Dec 06 '20 19:12 caseypugh

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!

caseypugh avatar Dec 07 '20 01:12 caseypugh

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

Pantman avatar Jan 18 '21 22:01 Pantman

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!

ammacdonald3 avatar Feb 18 '21 21:02 ammacdonald3

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?

Pantman avatar Feb 22 '21 04:02 Pantman

@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

caseypugh avatar Feb 22 '21 19:02 caseypugh