Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Changing quickly the light color is laggy #21

Open
vmorris1959 opened this issue Feb 5, 2018 · 4 comments
Open

Changing quickly the light color is laggy #21

vmorris1959 opened this issue Feb 5, 2018 · 4 comments

Comments

@vmorris1959
Copy link

When the light color is changed quickly, for instance using a color wheel, the color is not shown instantaneously in a smooth way but looks very laggy, however if I use the color wheel in the native Home or Hue apps it works as expected. I use the following procedure to change the light color:

let lightState = PHSLightState()
lightState.alert = .none
lightState.effect = .none
lightState.transitionTime = 1 as NSNumber
let color = PHSColor.create(withRed: Int32(newColor.redComponent * 255.0), green: Int32(newColor.greenComponent * 255.0), blue: Int32(newColor.blueComponent * 255.0))
lightState.setXYWith(color)
light.update(lightState, allowedConnectionTypes: .local) {}

Any ideas why or suggestions how to improve it?

@jhvdb87
Copy link

jhvdb87 commented Feb 22, 2018

You will flood the SDK/bridge with many requests when using the color wheel (generates many events), which will fill the internal queue of the SDK/bridge. App probably has some throttling implemented when dragging the color picker (to reduce number of requests)

@vmorris1959
Copy link
Author

vmorris1959 commented Feb 25, 2018

I understand what you say but I think in this case is more an SDK issue because in the documentation it says under the Update Lights section:

"Please note that the light doesn’t get updated with the light state passed as argument. Only the light in the cache will be updated. This will be improved in future version of the SDK"

So in my opinion, it is the SDK what needs to implement that "throttling" and manage the updating of lights efficiently.

@jhvdb87
Copy link

jhvdb87 commented Feb 26, 2018

Basic throttling is already implemented by the SDK, but I agree with you that more advanced throttling should be handled by the SDK to cover the use case you mentioned. An action point is already on our backlog.

The comment you quoted is not related to this. It means that the object you call update_state on, doesn't get updated automatically when sending light state to the light. Only the light object in the cache gets updated

@vmorris1959
Copy link
Author

The quoted text was taken from the SDK User's Guide exactly from the section showing how to change the light color.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants