michielpost / Q42.HueApi

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

Updating Entertainment locations is not working? #176

Closed niels9001 closed 5 years ago

niels9001 commented 5 years ago

Hi all,

I'm trying to update Entertainment locations, but it seems that a bug is getting in the way :).

I'm using the following code:

Dictionary<string, LightLocation> Locs = new Dictionary<string, LightLocation>(); Locs.Add("1", new LightLocation(-0.66, 0.53, 0)); var result = await Client.UpdateGroupLocationsAsync("4", Locs);

This results in the following JSON:

{"locations":{"1":[-0.66,0.53,0.0]}}

This results in the following error:

[{"error":{"type":6,"address":"/groups/4/locations","description":"parameter, 1, not available"}}]

Not quite sure what's going wrong here..

Side note: if we want to update both the name of the Entertainment group AND the locations, do we need to do 2 separate calls (e.g. UpdateGroup and UpdateGroupLocations)?

michielpost commented 5 years ago

Is the group you are trying to set the locations for of type Entertainment? Because you can only set locations for Entertainment groups, not other group types.

niels9001 commented 5 years ago

Yes, it is.. anyone else getting the same error?

niels9001 commented 5 years ago

Seems that we might need to improve the creation of EntertainmentGroups as well. The current CreateGroup function does not allow for adding Locations.

What if we go for a:

CreateEntertainmentRoom(string Name, Dictionary<string, LightLocation> Locations) that would create a new group with GroupType set to Entertainment?

An UpdateEntertainmentRoom(string Name, Dictionary<string, LightLocation> Locations) could then be used to update the room name and light locations in 1 go.

What this make sense?

michielpost commented 5 years ago

I did a quick local test and updating the locations of an entertainment group works fine. The error you're describing is the error you get when you try to update the locations of a group that's not an entertainment group.

niels9001 commented 5 years ago

Yep can confirm this as well, not sure what happened.. My bad, closing the issue!