diff --git a/bundles/org.openhab.binding.deconz/README.md b/bundles/org.openhab.binding.deconz/README.md
index e2ef2c1f9..62d56d096 100644
--- a/bundles/org.openhab.binding.deconz/README.md
+++ b/bundles/org.openhab.binding.deconz/README.md
@@ -89,6 +89,10 @@ The transition time is the time to move between two states and is configured in
The resolution provided is 1/10s.
If no value is provided, the default value of the device is used.
+`extendedcolorlight` and `colorlight` have different modes for setting the color.
+Some devices accept only XY, others HSB, others both modes and the binding tries to autodetect the correct mode.
+If this fails, the advanced `colormode` parameter can be set to `xy` or `hs`.
+
### Textual Thing Configuration - Retrieving an API Key
If you use the textual configuration, the thing file without an API key will look like this, for example:
diff --git a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java
index 8dfe010ca..fcacb90fc 100644
--- a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java
+++ b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java
@@ -78,6 +78,7 @@ public class LightThingHandler extends DeconzBaseThingHandler {
*/
private LightState lightStateCache = new LightState();
private LightState lastCommand = new LightState();
+ private String colorMode = "";
// set defaults, we can override them later if we receive better values
private int ctMax = ZCL_CT_MAX;
@@ -179,7 +180,7 @@ public class LightThingHandler extends DeconzBaseThingHandler {
}
} else if (command instanceof HSBType) {
HSBType hsbCommand = (HSBType) command;
- if ("xy".equals(lightStateCache.colormode)) {
+ if ("xy".equals(colorMode)) {
PercentType[] xy = hsbCommand.toXY();
if (xy.length < 2) {
logger.warn("Failed to convert {} to xy-values", command);
@@ -268,6 +269,7 @@ public class LightThingHandler extends DeconzBaseThingHandler {
}
LightMessage lightMessage = (LightMessage) stateResponse;
+
if (needsPropertyUpdate) {
// if we did not receive an ctmin/ctmax, then we probably don't need it
needsPropertyUpdate = false;
@@ -427,6 +429,13 @@ public class LightThingHandler extends DeconzBaseThingHandler {
logger.trace("Ignoring differing update after last command until {}", lastCommandExpireTimestamp);
return;
}
+ if (colorMode.isEmpty()) {
+ String cmode = lightState.colormode;
+ if (cmode != null && ("hs".equals(cmode) || "xy".equals(cmode))) {
+ // only set the color mode if it is hs or xy, not ct
+ colorMode = cmode;
+ }
+ }
lightStateCache = lightState;
if (Boolean.TRUE.equals(lightState.reachable)) {
updateStatus(ThingStatus.ONLINE);
diff --git a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/ThingConfig.java b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/ThingConfig.java
index a43e07577..cc95c4c36 100644
--- a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/ThingConfig.java
+++ b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/ThingConfig.java
@@ -25,4 +25,5 @@ public class ThingConfig {
public String id = "";
public int lastSeenPolling = 1440;
public @Nullable Double transitiontime;
+ public String colormode = "";
}
diff --git a/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/config/config.xml b/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/config/config.xml
index 132f255a4..caff77650 100644
--- a/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/config/config.xml
+++ b/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/config/config.xml
@@ -47,7 +47,6 @@
-
@@ -59,4 +58,24 @@
+
+
+
+ The deCONZ bridge assigns an integer number ID to each device.
+
+
+
+ Time to move between two states. If empty, the default of the device is used. Resolution is 1/10 second.
+
+
+
+ Override the default color mode (auto-detect)
+
+
+
+
+ true
+
+
+
diff --git a/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/light-thing-types.xml b/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/light-thing-types.xml
index 7de5c8aca..1e576e10f 100644
--- a/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/light-thing-types.xml
+++ b/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/light-thing-types.xml
@@ -97,7 +97,7 @@
uid
-
+
@@ -114,7 +114,7 @@
uid
-
+