diff --git a/com.zsmartsystems.zigbee.console/src/main/java/com/zsmartsystems/zigbee/console/ZigBeeConsoleAbstractCommand.java b/com.zsmartsystems.zigbee.console/src/main/java/com/zsmartsystems/zigbee/console/ZigBeeConsoleAbstractCommand.java index 64c4e5c9c..1717103e5 100644 --- a/com.zsmartsystems.zigbee.console/src/main/java/com/zsmartsystems/zigbee/console/ZigBeeConsoleAbstractCommand.java +++ b/com.zsmartsystems.zigbee.console/src/main/java/com/zsmartsystems/zigbee/console/ZigBeeConsoleAbstractCommand.java @@ -71,14 +71,22 @@ protected ZigBeeNode getNode(ZigBeeNetworkManager networkManager, final String n */ protected ZigBeeEndpoint getEndpoint(final ZigBeeNetworkManager networkManager, final String endpointId) throws IllegalArgumentException { - for (final ZigBeeNode node : networkManager.getNodes()) { - for (final ZigBeeEndpoint endpoint : node.getEndpoints()) { - if (endpointId.equals(node.getNetworkAddress() + "/" + endpoint.getEndpointId())) { - return endpoint; - } - } + String[] endpointParts = endpointId.split("/"); + if (endpointParts.length != 2) { + throw new IllegalArgumentException("Invalid endpoint format '" + endpointId + "'"); + } + ZigBeeNode node = getNode(networkManager, endpointParts[0]); + int endpointNumber; + try { + endpointNumber = Integer.parseInt(endpointParts[1]); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Invalid endpoint number '" + endpointParts[1] + "'"); + } + ZigBeeEndpoint endpoint = node.getEndpoint(endpointNumber); + if (endpoint == null) { + throw new IllegalArgumentException("Endpoint '" + endpointId + "' is not found"); } - throw new IllegalArgumentException("Endpoint '" + endpointId + "' is not found"); + return endpoint; } /** diff --git a/com.zsmartsystems.zigbee.console/src/main/java/com/zsmartsystems/zigbee/console/ZigBeeConsoleReportingConfigCommand.java b/com.zsmartsystems.zigbee.console/src/main/java/com/zsmartsystems/zigbee/console/ZigBeeConsoleReportingConfigCommand.java index 5d7211735..e092902c6 100644 --- a/com.zsmartsystems.zigbee.console/src/main/java/com/zsmartsystems/zigbee/console/ZigBeeConsoleReportingConfigCommand.java +++ b/com.zsmartsystems.zigbee.console/src/main/java/com/zsmartsystems/zigbee/console/ZigBeeConsoleReportingConfigCommand.java @@ -70,15 +70,17 @@ public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStr if (result.isSuccess()) { final ReadReportingConfigurationResponse response = result.getResponse(); final AttributeReportingStatusRecord attributeReportingStatusRecord = response.getRecords().get(0); - + final ZclStatus statusCode = attributeReportingStatusRecord.getStatus(); if (statusCode == ZclStatus.SUCCESS) { out.println("Cluster " + response.getClusterId() + ", Attribute " + attributeReportingStatusRecord.getAttributeIdentifier() + ", type " + attributeReportingStatusRecord.getAttributeDataType() + ", minimum reporting interval: " - + attributeReportingStatusRecord.getMinimumReportingInterval() + ", maximum reporting interval: " - + attributeReportingStatusRecord.getMaximumReportingInterval() + ", timeout: " - + attributeReportingStatusRecord.getTimeoutPeriod()); + + attributeReportingStatusRecord.getMinimumReportingInterval() + + ", maximum reporting interval: " + + attributeReportingStatusRecord.getMaximumReportingInterval() + ", timeout: " + + (attributeReportingStatusRecord.getTimeoutPeriod() == 0 ? "N/A" + : attributeReportingStatusRecord.getTimeoutPeriod())); } else { out.println("Attribute value read error: " + statusCode); }