michielpost / Q42.HueApi

C# helper library to talk to the Philips Hue bridge
MIT License
412 stars 114 forks source link

SceneCommand not changing scene? #193

Closed No0Vad closed 4 years ago

No0Vad commented 4 years ago

NuGet version: 3.12.0

I noticed that RecallSceneAsync or SceneCommand does not activate the scene. I used GetScenesAsync to find that the Relax scene has Id FuPwrV9h-1jyo7x

But neither of the code below changes the scene: await client.RecallSceneAsync("FuPwrV9h-1jyo7x", groupId); await client.SendGroupCommandAsync(new SceneCommand("FuPwrV9h-1jyo7x"), groupId);

The calls each return a SuccessResult

michielpost commented 4 years ago

I had a look at the code and tested the json output but did not notice anything weird.

Make sure to use the groupId that belongs to the scene. So get the scene from the bridge,

var scenes = await _client.GetScenesAsync();
var scene = scenes.First();

var command = new SceneCommand { Scene = scene.Id };

await _client.SendGroupCommandAsync(command, scene.Group);

Can you check the json response from the bridge (for example using Fiddler https://www.telerik.com/fiddler)

No0Vad commented 4 years ago

Thanks to your code I've noticed the scenes are duplicated to how many groups you have. I have 2 groups. The Relax Id I first found was to group 2, when I was trying to change the scene on group 1 facepalm

image

When I have the correct group Id everything works as expected.