whizzosoftware / WZWave

A native Java library for interfacing with Z-Wave PC controllers
Eclipse Public License 1.0
33 stars 22 forks source link

Invalid command class version from device cause Exception #35

Closed eperott closed 5 years ago

eperott commented 5 years ago

As I'm evaluating WZWave I'm getting some exceptions as I'm starting to add devices.

com.whizzosoftware.wzwave.ZWaveRuntimeException: MULTI_CHANNEL_END_POINT_GET is not available in command class version 1
    at com.whizzosoftware.wzwave.commandclass.MultiInstanceCommandClass.createMultiChannelEndPointGet(MultiInstanceCommandClass.java:275)
    at com.whizzosoftware.wzwave.commandclass.MultiInstanceCommandClass.queueStartupMessages(MultiInstanceCommandClass.java:135)
    at com.whizzosoftware.wzwave.node.ZWaveNode.setState(ZWaveNode.java:145)
    at com.whizzosoftware.wzwave.node.ZWaveNode.onApplicationCommand(ZWaveNode.java:184)
    at com.whizzosoftware.wzwave.controller.netty.NettyZWaveController.onApplicationCommand(NettyZWaveController.java:399)
    at com.whizzosoftware.wzwave.channel.ZWaveChannelInboundHandler.channelRead(ZWaveChannelInboundHandler.java:56)
    at com.whizzosoftware.wzwave.channel.ZWaveChannelInboundHandler.userEventTriggered(ZWaveChannelInboundHandler.java:94)
    at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:304)
    at io.netty.channel.AbstractChannelHandlerContext.fireUserEventTriggered(AbstractChannelHandlerContext.java:290)
    at com.whizzosoftware.wzwave.channel.TransactionInboundHandler$NettyZWaveChannelContext.process(TransactionInboundHandler.java:171)
    at com.whizzosoftware.wzwave.channel.TransactionInboundHandler.channelRead(TransactionInboundHandler.java:66)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
    at com.whizzosoftware.wzwave.channel.FrameQueueHandler.channelRead(FrameQueueHandler.java:239)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
    at com.whizzosoftware.wzwave.channel.ACKInboundHandler.channelRead(ACKInboundHandler.java:33)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
    at io.netty.channel.oio.AbstractOioByteChannel.doRead(AbstractOioByteChannel.java:147)
    at io.netty.channel.oio.AbstractOioChannel$1.run(AbstractOioChannel.java:45)
    at io.netty.channel.ThreadPerChannelEventLoop.run(ThreadPerChannelEventLoop.java:53)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
    at java.lang.Thread.run(Thread.java:744)

It turns out this is happening because the device in this case announce support for the MultiInstanceCommandClass. But when WZWave query the device for supported command class version, the response will indicate the command class is not supported by saying that supported version is 0x00.

14:15:35.279 [pool-1-thread-1] TRACE c.w.wzwave.codec.ZWaveFrameDecoder - Done processing received data: [ZW_APPLICATION_COMMAND_HANDLER[0x05]: 0x86 0x14 0x60 0x00 ]
...and later...
14:15:35.363 [pool-1-thread-1] DEBUG c.w.w.c.VersionCommandClass - Setting command class COMMAND_CLASS_MULTI_INSTANCE to version 0x00

The specs are not very clear how the host should handle this scenario. But version 0 is never valid, and so I propose to ignore response and continue with default (version 1).