Fair point - I’ll take a look at moving the check. I’ll also check for other calls to setAwake(true), but I would expect that if this is set then the device is awake and can receive messages. This is effectively why this was moved since I found there were other ways that the wakeup can be notified...

I am more than happy (like, really happy :) ) if you would be able to take a look. I’d also love to pick your brains on some of the transaction stuff to find out how it works with queuing controller messages (routing commands). I recall late last year you were looking at some of this so I don’t want to do much work on it…. I understand you’re busy though :(

Cheers
Chris



On 9 Jan 2014, at 16:37, Jan-Willem Spuij <notifications@github.com> wrote:

> In bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveWakeUpCommandClass.java:
> 
> > @@ -180,17 +180,8 @@ public void handleApplicationCommandRequest(SerialMessage serialMessage,
> >  					return;
> >  				}
> >  
> > -				logger.debug("Sending {} messages from the wake-up queue of node {}", this.wakeUpQueue.size(), this.getNode().getNodeId());
> > -
> > -				// handle all messages in the wake-up queue for this node.
> > -				while (!this.wakeUpQueue.isEmpty()) {
> > -					serialMessage = this.wakeUpQueue.poll();
> > -					this.getController().sendData(serialMessage);
> > -				}
> > -				
> > -				// no more information. Go back to sleep.
> > -				logger.trace("No more messages, go back to sleep node {}", this.getNode().getNodeId());
> > -				this.getController().sendData(this.getNoMoreInformationMessage());
> > +				// Empty the pending queue
> > +				sendPending();
> The wake-up queue is now emptied before the check instead of afterwards... this.setAwake now empties the queue (and sendPending does it again, but finds nothign). This used to happen after the re-initialization check.
> 
> So either this.setAwake must NOT empty the queue or this.setAwake needs to be moved after the re-initialization check.
> 
> I find this.setAwake a bit dangerous to empty the queue, because it's called from multiple places. But I can have a look at it this weekend, if you want me to. I understand and appreciate the idea of the modification, It's just that the wake-up process is really fragile ;-)
> 
> —
> Reply to this email directly or view it on GitHub.
>