enwi / hueplusplus

A simple C++ library to control Philips Hue lights on Linux, MacOS, Windows, Espressif ESP32 SDK and Arduino. Full documentation at
https://enwi.github.io/hueplusplus/
GNU Lesser General Public License v3.0
55 stars 22 forks source link

Entertainment Group creation fails with API error #84

Closed danielskeenan closed 2 years ago

danielskeenan commented 2 years ago

Describe the bug: When creating a new Entertainment Group, the bridge responds with error 5 ("missing parameters in body").

To Reproduce: Steps to reproduce the behavior:

  1. Instantiate and authenticate with a bridge.
  2. Attempt to create a new entertainment group like:
    bridge.groups().create(hueplusplus::CreateGroup::Entertainment({"1"}, "my group"));
  3. Observe the HueAPIResponseException (details below).

Expected behavior: The group is created.

Console log/Error message: The exceptions what() returns:

HueApiResponseException from create in /usr/local/include/hueplusplus/ResourceList.h:304 5 /groups/class invalid/missing parameters in body

Desktop (please complete the following information):

Additional context

Jojo-1000 commented 2 years ago

The hue documentation is not very clear on this, but it may be only possible to create the entertainment setups from within the app.

danielskeenan commented 2 years ago

Yeah the docs are pretty bad... Specificlly it seems this line from the Groups API page has changed in the implementation without updating docs (maybe tied to API v2?):

Note: For room creation the room class has to be passed, without class it will get the default: “Other” class.

As a test, I changed CreateGroup::getRequest() to always set the class, defaulting to "Other" if none was passed. Can't tell if there are other consequences for this, but happy to create a PR.

Jojo-1000 commented 2 years ago

Feel free to create a pull request with your changes. Maybe we should also remove the entertainment option for CreateGroup, if it doesn't work.