]> git.basschouten.com Git - openhab-addons.git/commitdiff
[knx] Bugfix problem with DPT 251.600 (#15723)
authorMarco Müller <marco@ms-mueller.ch>
Tue, 10 Oct 2023 07:58:49 +0000 (09:58 +0200)
committerGitHub <noreply@github.com>
Tue, 10 Oct 2023 07:58:49 +0000 (09:58 +0200)
* Fix problem with DPT 251.600.
In the old implementation the datatype was implemented with byte 0-255.
The DPT 251.600 is defined with 0-100%, change this from byte to
PercentType.

Signed-off-by: Marco Mueller <marco@ms.mueller.ch>
bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/dpt/ValueEncoder.java

index f30a137d01717b6db77f5b8ed4d712f5c7e18f99..c2519d3bf719ffd3343a49ea1acf13bc712995cc 100644 (file)
@@ -162,8 +162,9 @@ public class ValueEncoder {
                 double[] xyY = ColorUtil.hsbToXY(hsb);
                 return String.format("(%,.4f %,.4f) %,.1f %%", xyY[0], xyY[1], xyY[2] * 100.0);
             case "251.600":
-                rgb = ColorUtil.hsbToRgb(hsb);
-                return String.format("%d %d %d - %%", rgb[0], rgb[1], rgb[2]);
+                PercentType[] rgbw = ColorUtil.hsbToRgbPercent(hsb);
+                return String.format("%,.1f %,.1f %,.1f - %%", rgbw[0].doubleValue(), rgbw[1].doubleValue(),
+                        rgbw[2].doubleValue());
             case "5.003":
                 return hsb.getHue().toString();
             default: