Skip to content

Commit

Permalink
Merge pull request openhab#6 from sumnerboy12/zwave-initialisation
Browse files Browse the repository at this point in the history
Fix for controller initialisation, and some debug tidy up
  • Loading branch information
cdjackson committed Nov 24, 2014
2 parents fbdc8f6 + 4aff5e0 commit ec850bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ec850bd

Please sign in to comment.