Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Fix typo in KNX test-project, support RGB

Marcus Redeker9636ce8ecace
diff --git a/agent/src/main/java/org/openremote/agent/protocol/knx/TypeMapper.java b/agent/src/main/java/org/openremote/agent/protocol/knx/TypeMapper.java
index 57d9ad2cd..82fdf9dae 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/knx/TypeMapper.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/knx/TypeMapper.java
@@ -8,6 +8,7 @@ import java.util.logging.Logger;
import org.openremote.model.attribute.AttributeType;
import org.openremote.model.value.Value;
+import org.openremote.model.value.impl.ArrayValueImpl;
import org.openremote.model.value.impl.BooleanValueImpl;
import org.openremote.model.value.impl.NumberValueImpl;
import org.openremote.model.value.impl.StringValueImpl;
@@ -175,6 +176,9 @@ public class TypeMapper {
((DPTXlatorBoolean) translator).setValue(((BooleanValueImpl) value).getBoolean());
} else if (translator instanceof DPTXlator8BitUnsigned && value instanceof NumberValueImpl) {
((DPTXlator8BitUnsigned) translator).setValue((int) ((NumberValueImpl) value).getNumber());
+ } else if (translator instanceof DPTXlatorRGB && value instanceof ArrayValueImpl) {
+ ArrayValueImpl arrayValue = (ArrayValueImpl) value;
+ ((DPTXlatorRGB) translator).setValue(arrayValue.getNumber(0).get().intValue(), arrayValue.getNumber(1).get().intValue(), arrayValue.getNumber(2).get().intValue());
} else {
// TODO depending on the DPT and the value, a more sophisticated translation is needed
translator.setValue(value.toString());
diff --git a/manager/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy b/manager/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy
index a364dc024..699ebbecb 100644
--- a/manager/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy
@@ -123,7 +123,7 @@ class KNXImportTest extends Specification implements ManagerContainerTrait {
then: "the new things and attributes should be created"
conditions.eventually {
assert assets != null
- assert assets.length == 13
+ assert assets.length == 12
assert assets.each {
!TextUtil.isNullOrEmpty(it.id) &&
!TextUtil.isNullOrEmpty(it.getName()) &&
diff --git a/manager/test/src/test/resources/org/openremote/test/protocol/knx/knx-import-testproject.knxproj b/manager/test/src/test/resources/org/openremote/test/protocol/knx/knx-import-testproject.knxproj
index 03c228f00..c880a4359 100644
Binary files a/manager/test/src/test/resources/org/openremote/test/protocol/knx/knx-import-testproject.knxproj and b/manager/test/src/test/resources/org/openremote/test/protocol/knx/knx-import-testproject.knxproj differ