openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[wifiled] Issues controlling LD686 #2829

Closed chiefymuc closed 5 years ago

chiefymuc commented 6 years ago

I bought this LD686 device: https://de.aliexpress.com/item/16Million-colors-Wifi-5channels-RGBW-WW-CW-led-controller-smartphone-control-music-and-timer-mode-magic/32796615335.html

It was automatically detected (as LD382A). After setting up the items, control does not work correctly. ON/OFF works, also for the color item, but no color change or white dimming is possible.

Tried with LD382, LD382A and LD686 protocol, both in CLASSIC and FADING mode.

I get the following error when changing White or Color:

23:51:27.886 [INFO ] [smarthome.event.ItemStateChangedEvent] - BathroomLampDimmerWW2 changed from 82 to 0
23:51:27.990 [ERROR] [nternal.profiles.DefaultMasterProfile] - Exception occurred while calling handler: java.lang.IllegalArgumentException: Value must be between 0 and 100
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Value must be between 0 and 100
        at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:220) ~[?:?]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189) ~[?:?]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83) ~[?:?]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67) ~[?:?]
        at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile.onCommand(DefaultMasterProfile.java:49) ~[?:?]
        at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$2(CommunicationManager.java:177) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) [?:?]
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) [?:?]
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) [?:?]
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) [?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) [?:?]
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270) [?:?]
        at java.util.concurrent.ConcurrentHashMap$ValueSpliterator.forEachRemaining(ConcurrentHashMap.java:3566) [?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) [?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) [?:?]
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) [?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) [?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [?:?]
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) [?:?]
        at org.eclipse.smarthome.core.thing.internal.CommunicationManager.receiveCommand(CommunicationManager.java:172) [107:org.eclipse.smarthome.core.thing:0.9.0.201709260841]
        at org.eclipse.smarthome.core.thing.internal.CommunicationManager.receive(CommunicationManager.java:91) [107:org.eclipse.smarthome.core.thing:0.9.0.201709260841]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:207) [100:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1) [100:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181) [100:org.eclipse.smarthome.core:0.9.0.201709260841]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
        at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: java.lang.IllegalArgumentException: Value must be between 0 and 100
        at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:50) ~[?:?]
        at org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:35) ~[?:?]
        at org.openhab.binding.wifiled.handler.LEDStateDTO.valueOf(LEDStateDTO.java:84) ~[?:?]
        at org.openhab.binding.wifiled.handler.ClassicWiFiLEDDriver.getLEDStateDTO(ClassicWiFiLEDDriver.java:47) ~[?:?]
        at org.openhab.binding.wifiled.handler.ClassicWiFiLEDDriver.setWhite2(ClassicWiFiLEDDriver.java:94) ~[?:?]
        at org.openhab.binding.wifiled.handler.WiFiLEDHandler.handleWhite2Command(WiFiLEDHandler.java:165) ~[?:?]
        at org.openhab.binding.wifiled.handler.WiFiLEDHandler.handleCommand(WiFiLEDHandler.java:114) ~[?:?]
        at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile$1.call(DefaultMasterProfile.java:52) ~[?:?]
        at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile$1.call(DefaultMasterProfile.java:1) ~[?:?]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:218) ~[?:?]
        ... 27 more

Current Behavior

No reaction to color change and white dimming

Your Environment

wborn commented 6 years ago

Do you still get these exceptions @chiefymuc? Are you sending commands to the binding by changing controls in Paper UI or using rules?

chiefymuc commented 6 years ago

I've stopped using this device as I was never able to fix it.

wborn commented 6 years ago

That's unfortunate to hear @chiefymuc. :-(

@xylo, @rvt are you familiar with this issue?

xylo commented 6 years ago

I'm using an LD686 with wifiled and it works/worked so far. In the last months I had some problems with the first white channel but I thought it's only some defective contact because sometimes the channel works as expected. But know that you tell, it could be that I have these errors since the last update to binding-wifiled - 2.2.0. So maybe the refactoring for the LD386* code had some side effects on the LD686. I will look into it.

rvt commented 6 years ago

@wborn I decided to give up on a arilux driver for openhab and simply re-flashed the arilux device firmware so it now uses mqtt and listens to HSB input. It does my needed fade in/out's and transitions between colors using normal operation and has options for very slow fade in/outs so it can slowly change between colors (think minutes). THis was for me the only way to make the whole system more reliable...

chiefymuc commented 6 years ago

If there is a proposed fix or something I can try, I'd be happy to test it.

cirolaferrara commented 6 years ago

When I try to change the color via Basic UI i have in the log:

2018-05-25 15:43:45.971 [ome.event.ItemCommandEvent] - Item 'Bedroom_Color' received command 347,86,100
2018-05-25 15:43:46.011 [vent.ItemStateChangedEvent] - Bedroom_Color changed from NULL to 347,86,100
2018-05-25 15:43:46.016 [GroupItemStateChangedEvent] - gLight changed from NULL to ON through Bedroom_Color
2018-05-25 15:43:46.224 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.wifiled.handler.WiFiLEDHandler@2e63c59b': Value must be between 0 and 100
java.lang.IllegalArgumentException: Value must be between 0 and 100
        at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:55) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:40) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.openhab.binding.wifiled.handler.LEDStateDTO.valueOf(LEDStateDTO.java:84) [241:org.openhab.binding.wifiled:2.2.0]
        at org.openhab.binding.wifiled.handler.ClassicWiFiLEDDriver.getLEDStateDTO(ClassicWiFiLEDDriver.java:47) [241:org.openhab.binding.wifiled:2.2.0]
        at org.openhab.binding.wifiled.handler.ClassicWiFiLEDDriver.setColor(ClassicWiFiLEDDriver.java:54) [241:org.openhab.binding.wifiled:2.2.0]
        at org.openhab.binding.wifiled.handler.WiFiLEDHandler.handleColorCommand(WiFiLEDHandler.java:128) [241:org.openhab.binding.wifiled:2.2.0]
        at org.openhab.binding.wifiled.handler.WiFiLEDHandler.handleCommand(WiFiLEDHandler.java:110) [241:org.openhab.binding.wifiled:2.2.0]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at com.sun.proxy.$Proxy139.handleCommand(Unknown Source) [241:org.openhab.binding.wifiled:2.2.0]
        at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
        at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]

If i choose another color:

2018-05-25 15:45:11.528 [ome.event.ItemCommandEvent] - Item 'Bedroom_Color' received command 179,98,100
2018-05-25 15:45:11.532 [vent.ItemStateChangedEvent] - Bedroom_Color changed from 180,60,100 to 179,98,100
2018-05-25 15:45:11.530 [INFO ] [.eclipse.smarthome.model.script.test] - test
2018-05-25 15:45:11.665 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.wifiled.handler.WiFiLEDHandler@2e63c59b': Value must be between 0 and 100
java.lang.IllegalArgumentException: Value must be between 0 and 100
        at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:55) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:40) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.openhab.binding.wifiled.handler.LEDStateDTO.valueOf(LEDStateDTO.java:84) [241:org.openhab.binding.wifiled:2.2.0]
        at org.openhab.binding.wifiled.handler.ClassicWiFiLEDDriver.getLEDStateDTO(ClassicWiFiLEDDriver.java:47) [241:org.openhab.binding.wifiled:2.2.0]
        at org.openhab.binding.wifiled.handler.ClassicWiFiLEDDriver.setColor(ClassicWiFiLEDDriver.java:54) [241:org.openhab.binding.wifiled:2.2.0]
        at org.openhab.binding.wifiled.handler.WiFiLEDHandler.handleColorCommand(WiFiLEDHandler.java:128) [241:org.openhab.binding.wifiled:2.2.0]
        at org.openhab.binding.wifiled.handler.WiFiLEDHandler.handleCommand(WiFiLEDHandler.java:110) [241:org.openhab.binding.wifiled:2.2.0]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at com.sun.proxy.$Proxy139.handleCommand(Unknown Source) [241:org.openhab.binding.wifiled:2.2.0]
        at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
        at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
cirolaferrara commented 6 years ago

It was recognized ftom Paper UI as AK001-ZJ200

wborn commented 6 years ago

Looks like the code where these exceptions occur in OH 2.2 has been reworked with https://github.com/openhab/openhab2-addons/pull/2496. Did any of you already test if this is still an issue with openHAB 2.3.0-SNAPSHOT?

cirolaferrara commented 6 years ago

Same with openHAB 2.3.0-SNAPSHOT

2018-05-25 19:13:09.758 [ome.event.ItemCommandEvent] - Item 'Bedroom_Color_2' received command 173,100,100
2018-05-25 19:13:09.760 [vent.ItemStateChangedEvent] - Bedroom_Color_2 changed from 113,100,100 to 173,100,100
2018-05-25 19:13:09.880 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.wifiled.handler.WiFiLEDHandler@78fa42ee': Value must be between 0 and 100
java.lang.IllegalArgumentException: Value must be between 0 and 100
        at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:55) [101:org.eclipse.smarthome.core:0.10.0.oh230RC1]
        at org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:50) [101:org.eclipse.smarthome.core:0.10.0.oh230RC1]
        at org.openhab.binding.wifiled.handler.LEDStateDTO.valueOf(LEDStateDTO.java:99) [242:org.openhab.binding.wifiled:2.3.0.RC1]
        at org.openhab.binding.wifiled.handler.ClassicWiFiLEDDriver.getLEDStateDTO(ClassicWiFiLEDDriver.java:58) [242:org.openhab.binding.wifiled:2.3.0.RC1]
        at org.openhab.binding.wifiled.handler.ClassicWiFiLEDDriver.setColor(ClassicWiFiLEDDriver.java:68) [242:org.openhab.binding.wifiled:2.3.0.RC1]
        at org.openhab.binding.wifiled.handler.WiFiLEDHandler.handleColorCommand(WiFiLEDHandler.java:128) [242:org.openhab.binding.wifiled:2.3.0.RC1]
        at org.openhab.binding.wifiled.handler.WiFiLEDHandler.handleCommand(WiFiLEDHandler.java:110) [242:org.openhab.binding.wifiled:2.3.0.RC1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230RC1]
        at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.oh230RC1]
        at com.sun.proxy.$Proxy150.handleCommand(Unknown Source) [242:org.openhab.binding.wifiled:2.3.0.RC1]
        at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [108:org.eclipse.smarthome.core.thing:0.10.0.oh230RC1]
        at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [108:org.eclipse.smarthome.core.thing:0.10.0.oh230RC1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230RC1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.oh230RC1]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
janmo0 commented 5 years ago

I have an CCT led strip with the LD686. On my LD686 controller it was because the "programSpeed" variable was initially read with an value of 255.

In LEDStateDTO.java line 97-99:

BigDecimal ps = new BigDecimal(programSpeed).divide(new BigDecimal(0x1f), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100.0)); PercentType e = new PercentType(new BigDecimal(100.0).subtract(ps));

So it was trying to subtract "ps" (calculated value was: 255/31=2.23*100=823) from 100.

I configured the controller over the app to CCT so there were no led program settings. After switching to RGBW controller and setting the program speed to something in the app it read the "programSpeed" value between 1-31.

chiefymuc commented 5 years ago

Hi @t1lt3rr0r , so if I understand correctly, you are suggesting that changing the settings in the app would resolve the problems? I'm struggling a bit to understand exactly. Maybe the correct settings of the LD686 device then should be documented in the documentation of the binding.

janmo0 commented 5 years ago

Yes, changing the setting in the app , by moving the program speed slider, solved the problems for me. I think initially the value on the controller for the program speed is set 255. After using the slider in the app for changing program speed it is set to the correct maximum value of 31 (like expected in the code).

So either make this info available in the docs like "known issues" or changing the code to make sure if the value is 255 adjust it to 31 and write back to controller.

Do you still have the LD686 controller? What kind of LED type you used when this problem occoured? RGB? RGBW? CCT? Im using a CCT (so only WW + CW LEDs).

Also found another bug while investigating settings for CCT LEDs. The white2 channel value was always null: https://github.com/openhab/openhab2-addons/pull/4211

chiefymuc commented 5 years ago

I still have the controllers which I used RGBW leds with, but it's currently in some drawer. I could try it again.

Regarding the solution of this problem, of course it would be nice if the binding would do it itself, but I lack the coding skills for that. Otherwise, a note in the readme is at least a good hint for any users!

davidgraeff commented 5 years ago

Does someone have the 5mins to add that information to the readme please? Closing this issue now as it apparently cannot be solved, but only be documented.