PhilipsHue / HueSDK

Philips Hue Software Development Kit
98 stars 39 forks source link

Is there any way to get a PHSScene Preview? #10

Closed aaronn closed 6 years ago

aaronn commented 6 years ago

Is there any way to get a PHSScene preview, either in the form of possible LightStates (ideally) or an image? The PHSScene has a 'picture', but it's an NSString and doesn't seem to return anything.

jhvdb87 commented 6 years ago

A PHSScene object contains a list of lights. From those lights you can get the light state (light.lightState). However, you first have to call fetch on the scene object. Fetch retrieves the light states for the lights, of that scene, from the bridge.

The 'picture' field is just a placeholder to store a unique id that links to an image in your app.

aaronn commented 6 years ago

@jhvdb87 this isn’t the scene’s lightstate though, it’s the current lightstate of the light right? I’m trying to populate a list of scenes and want to get the colors in that lightstate so users have a preview instead of just the name

jhvdb87 commented 6 years ago

If you do a fetch on the scene, the light point will contain the light state that belongs to the scene

aaronn commented 6 years ago

@jhvdb87 Ah I see what I was missing now– there's literally a [scene fetchWithAllowedConnections:...] call. Thanks!