Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bundles/org.openhab.binding.dirigera/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,16 @@ public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) {
protected void updateProperties() {
// fill canSend and canReceive capabilities
Map<String, Object> modelProperties = gateway().model().getPropertiesFor(config.id);
addCapabilities(config.id);
TreeMap<String, String> handlerProperties = new TreeMap<>(editProperties());
modelProperties.forEach((key, value) -> {
handlerProperties.put(key, value.toString());
});
updateProperties(handlerProperties);
}

protected void addCapabilities(String id) {
Map<String, Object> modelProperties = gateway().model().getPropertiesFor(id);
Object canReceiveCapabilities = modelProperties.get(CAPABILITIES_KEY_CAN_RECEIVE);
if (canReceiveCapabilities instanceof JSONArray jsonArray) {
jsonArray.forEach(capability -> {
Expand All @@ -234,12 +244,6 @@ protected void updateProperties() {
}
});
}

TreeMap<String, String> handlerProperties = new TreeMap<>(editProperties());
modelProperties.forEach((key, value) -> {
handlerProperties.put(key, value.toString());
});
updateProperties(handlerProperties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;

import org.eclipse.jdt.annotation.NonNullByDefault;
Expand Down Expand Up @@ -81,7 +82,26 @@ public void initializeDevice() {
memberReachability.clear();
memberDeviceIds.forEach(id -> memberReachability.put(id, false));

updateProperties();
// special handling for device set properties - add for each device in set their individual canReceive and
// canSend properties
receiveCapabilities.clear();
sendCapabilities.clear();
TreeMap<String, String> handlerProperties = new TreeMap<>(editProperties());
memberDeviceIds.forEach(id -> {
Map<String, Object> modelProperties = gateway().model().getPropertiesFor(id);
String customName = gateway().model().getCustonNameFor(id);

Object receiveCapabilities = modelProperties.get(CAPABILITIES_KEY_CAN_RECEIVE);
handlerProperties.put(customName + " " + CAPABILITIES_KEY_CAN_RECEIVE,
receiveCapabilities != null ? receiveCapabilities.toString() : "[]");
Object sendCapabilities = modelProperties.get(CAPABILITIES_KEY_CAN_SEND);
handlerProperties.put(customName + " " + CAPABILITIES_KEY_CAN_SEND,
sendCapabilities != null ? sendCapabilities.toString() : "[]");
// properties updated and user is able to check all devices in the set and their capabilities, now add the
// capabilities to the set itself
addCapabilities(id);
});
updateProperties(handlerProperties);

// 2) Initialize the set's own customName from the model so that subsequent member
// updates (which carry the member's own customName) cannot overwrite it.
Expand Down
Loading