From 4aff5e0b2a9a8ba3b5b151efe57c5ef574c04c82 Mon Sep 17 00:00:00 2001 From: Ben Jones Date: Tue, 25 Nov 2014 09:08:03 +1300 Subject: [PATCH] Fix for controller initialisation, and some debug tidy up in the BATTERY/HAIL command classes. --- .../commandclass/ZWaveBatteryCommandClass.java | 4 ++-- .../protocol/commandclass/ZWaveHailCommandClass.java | 10 ++++++---- .../initialization/ZWaveNodeStageAdvancer.java | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveBatteryCommandClass.java b/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveBatteryCommandClass.java index a95f931171e..f512f52690e 100644 --- a/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveBatteryCommandClass.java +++ b/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveBatteryCommandClass.java @@ -74,7 +74,7 @@ public CommandClass getCommandClass() { public void handleApplicationCommandRequest(SerialMessage serialMessage, int offset, int endpoint) { logger.trace("Handle Message Battery Request"); - logger.debug("Node {}: Received Battery Request", this.getNode().getNodeId()); + logger.debug("NODE {}: Received Battery Request", this.getNode().getNodeId()); int command = serialMessage.getMessagePayloadByte(offset); switch (command) { case BATTERY_GET: @@ -84,7 +84,7 @@ public void handleApplicationCommandRequest(SerialMessage serialMessage, logger.trace("Process Battery Report"); batteryLevel = serialMessage.getMessagePayloadByte(offset + 1); - logger.debug(String.format("Node %d: Battery report value = 0x%02X", this.getNode().getNodeId(), batteryLevel)); + logger.debug(String.format("NODE %d: Battery report value = 0x%02X", this.getNode().getNodeId(), batteryLevel)); ZWaveCommandClassValueEvent zEvent = new ZWaveCommandClassValueEvent(this.getNode().getNodeId(), endpoint, this.getCommandClass(), batteryLevel); this.getController().notifyEventListeners(zEvent); diff --git a/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveHailCommandClass.java b/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveHailCommandClass.java index c4a2817f02e..8cfa746d9ac 100644 --- a/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveHailCommandClass.java +++ b/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveHailCommandClass.java @@ -58,12 +58,13 @@ public CommandClass getCommandClass() { public void handleApplicationCommandRequest(SerialMessage serialMessage, int offset, int endpoint) { logger.trace("Handle Message Manufacture Specific Request"); - logger.debug(String.format("Received Hail command for Node ID = %d", this.getNode().getNodeId())); + logger.debug("NODE {}: Received Hail command (v{})", this.getNode().getNodeId(), this.getVersion()); int command = serialMessage.getMessagePayloadByte(offset); switch (command) { case HAIL: - logger.trace("Process Hail command"); - logger.debug(String.format("Request an update of the dynamic values for node id %d", this.getNode().getNodeId())); + logger.trace("Process Hail command"); + + logger.debug("NODE {}: Request an update of the dynamic values", this.getNode().getNodeId()); // We only rerequest dynamic values for nodes that are completely initialized. if (this.getNode().getNodeStage() != NodeStage.DONE) @@ -73,7 +74,8 @@ public void handleApplicationCommandRequest(SerialMessage serialMessage, break; default: - logger.warn(String.format("Unsupported Command 0x%02X for command class %s (0x%02X).", + logger.warn(String.format("NODE %d: Unsupported Command 0x%02X for command class %s (0x%02X).", + this.getNode().getNodeId(), command, this.getCommandClass().getLabel(), this.getCommandClass().getKey())); diff --git a/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/initialization/ZWaveNodeStageAdvancer.java b/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/initialization/ZWaveNodeStageAdvancer.java index a6917cc9573..b661e6a1498 100644 --- a/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/initialization/ZWaveNodeStageAdvancer.java +++ b/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/initialization/ZWaveNodeStageAdvancer.java @@ -537,7 +537,7 @@ else if (zwaveDynamicClass instanceof ZWaveMultiInstanceCommandClass) { // If we have all the data, set stageAdvanced to true to tell the // system // that we're starting again, then loop around again. - if (sendMessage() == false) { + if (currentStage != NodeStage.DONE && sendMessage() == false) { // Move on to the next stage currentStage = currentStage.getNextStage(); stageAdvanced = true;