Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DSL] Expose ColorUtil methods to DSL rules #4410

Merged
merged 2 commits into from
Nov 17, 2024

Conversation

holgerfriedrich
Copy link
Member

@holgerfriedrich holgerfriedrich commented Oct 7, 2024

  • Expose xyToKelvin and kelvinToXY
  • Add missing throws declaration
  • Expose xyToDuv

Unfortunately, we forgot about the throws declaration in #4367. This is API breaking, you might need to add a catch statement in binding code. We did not find any issues in the add-on repo so far, it still compiles fine.

@holgerfriedrich holgerfriedrich requested a review from a team as a code owner October 7, 2024 16:27
@holgerfriedrich holgerfriedrich requested review from andrewfg and removed request for a team October 7, 2024 16:27
Copy link
Contributor

@andrewfg andrewfg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM many thanks.

@holgerfriedrich holgerfriedrich added the work in progress A PR that is not yet ready to be merged label Oct 7, 2024
@holgerfriedrich
Copy link
Member Author

Lets wait for #4401, then we can add xyToDuv as well.

@holgerfriedrich holgerfriedrich added API breaking and removed work in progress A PR that is not yet ready to be merged labels Oct 7, 2024
@holgerfriedrich
Copy link
Member Author

Done.
I will create an additional PR in docs.
@florian-h05 do you want to create a change in JS scripting as well (follow-up to openhab/openhab-js#319)?

@florian-h05
Copy link
Contributor

These methods are just added to the CoreUtil class, correct?
In that case only a doc update in openhab-js is needed.

@andrewfg
Copy link
Contributor

andrewfg commented Oct 8, 2024

@holgerfriedrich apropos the thrown exception potentially breaking the API — two things..

  1. In [zigbee] Map colour temperature states to color HSB states org.openhab.binding.zigbee#855 I did not call the respective method, so that one will not be broken.
  2. Did you check the ColorUtil JUnit tests (here in core) since they do call the respective method?

florian-h05 added a commit to florian-h05/openhab-js that referenced this pull request Oct 8, 2024
florian-h05 added a commit to openhab/openhab-js that referenced this pull request Oct 8, 2024
@holgerfriedrich
Copy link
Member Author

@andrewfg thanks for checking, the build seems still fine. I think in tests it is not mandatory to catch all declared exceptions....

Copy link
Contributor

@andrewfg andrewfg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* Expose xyToKelvin and kelvinToXY
* Add missing throws declaration

Signed-off-by: Holger Friedrich <[email protected]>
Signed-off-by: Holger Friedrich <[email protected]>
@holgerfriedrich
Copy link
Member Author

Rebased to let CI run on ubuntu-24.04

@holgerfriedrich holgerfriedrich requested a review from a team November 9, 2024 14:57
@lolodomo
Copy link
Contributor

lolodomo commented Nov 17, 2024

All this looks very good.
@J-N-K @kaikreuzer : can you please have a look ?

Copy link
Member

@J-N-K J-N-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@J-N-K J-N-K added the enhancement An enhancement or new feature of the Core label Nov 17, 2024
@J-N-K J-N-K added this to the 4.3 milestone Nov 17, 2024
*/
public static double xyToKelvin(double[] xy) {
public static double xyToKelvin(double[] xy) throws IllegalArgumentException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since an IAE is a runtime exception this should not break code.

@J-N-K J-N-K merged commit aededae into openhab:main Nov 17, 2024
5 checks passed
@holgerfriedrich holgerfriedrich deleted the pr-color-dsl branch November 17, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants