smarthomej / addons

SmartHome/J addons for openHAB
Eclipse Public License 2.0
59 stars 23 forks source link

[tuya] IllegalArgumentException: Unknown color format #540

Closed jsetton closed 6 months ago

jsetton commented 6 months ago

The color data point for one of my Tuya lighting devices get initialized to some weird value H^K whenever it is restarted. This is causing an IllegalArgumentException error preventing the relevant Thing from going online. The only workaround is to log into my Tuya Smart app and change the color to update the data point. No command can be sent on the OH side since the relevant Thing is offline.

Wouldn't it be better to just set the state of the relevant channel to UnDefType.UNDEF in that case?

I am using the 4.1-SNAPSHOT version.

2023-12-20 17:04:14.304 [TRACE] [a.internal.handler.TuyaDeviceHandler] - 'tuya:tuyaDevice:xxxxxxxx' received status message '{20=true, 21=white, 22=500.0, 23=500.0, 24=H^K, 25=200000000200000000000003e80000, 26=0.0}'
2023-12-20 17:04:14.304 [WARN ] [rnal.local.handlers.UserEventHandler] - xxxxxxxx/xx.xx.xx.xx:xx: class java.lang.IllegalArgumentException caught, closing the channel
java.lang.IllegalArgumentException: Unknown color format
        at org.smarthomej.binding.tuya.internal.util.ConversionUtil.hexColorDecode(ConversionUtil.java:60) ~[?:?]
        at org.smarthomej.binding.tuya.internal.handler.TuyaDeviceHandler.processChannelStatus(TuyaDeviceHandler.java:168) ~[?:?]
        at java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) ~[?:?]
        at org.smarthomej.binding.tuya.internal.handler.TuyaDeviceHandler.processDeviceStatus(TuyaDeviceHandler.java:144) ~[?:?]
        at org.smarthomej.binding.tuya.internal.local.handlers.TuyaMessageHandler.channelRead(TuyaMessageHandler.java:81) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [bundleFile:4.1.99.Final]
        at org.smarthomej.binding.tuya.internal.local.handlers.HeartbeatHandler.channelRead(HeartbeatHandler.java:90) [bundleFile:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [bundleFile:4.1.99.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) [bundleFile:4.1.99.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [bundleFile:4.1.99.Final]
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [bundleFile:4.1.99.Final]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) [bundleFile:4.1.99.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [bundleFile:4.1.99.Final]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [bundleFile:4.1.99.Final]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [bundleFile:4.1.99.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) [bundleFile:4.1.99.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) [bundleFile:4.1.99.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) [bundleFile:4.1.99.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) [bundleFile:4.1.99.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) [bundleFile:4.1.99.Final]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.99.Final]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.99.Final]
        at java.lang.Thread.run(Thread.java:840) [?:?]