ZeroOne3010 / yetanotherhueapi

A Java library for controlling Philips Hue lights. Available from the Maven Central.
MIT License
68 stars 21 forks source link

Why such a restrictive State.Builder? #55

Closed Kakifrucht closed 1 year ago

Kakifrucht commented 2 years ago

I'm not sure what the intention behind using a step builder pattern for it is with restrictions on alert and effect mode sending. It is allowed to send a State to the bridge that contains for example both a brightness change and a short alert. After the short alert the light will correctly set to the brightness change that was set in the same API call.

In general I'm not sure why we would need the step builder pattern here at all.

ZeroOne3010 commented 2 years ago

I'll ditch the step builder pattern with the Hue Bridge API v2. You might want to peek into the api-v2 branch. It's still very rudimentary, but you'll get the jist. 😃

ZeroOne3010 commented 1 year ago

Greetings again! Sorry, it has been a while, but the version using APIv2 is finally out. It's called 3.0.0-alpha and the state building should now be significantly less painful, as it's not using the step builder pattern anymore. Here's just a short example from README.md:

// Turn the lights on, make them pink:
room.setState(State.builder().color(Color.of(java.awt.Color.PINK)).on());

Thanks for your patience! Let me know if this works better for you. With the alpha version I'm looking for feedback to make it 3.0.0 officially. I'll just go ahead and close this issue, but feel free to reply here or open a new one anyway. Cheers!