Closed wzbfyb closed 2 years ago
This issue has been mentioned on openHAB Community. There might be relevant details there:
https://community.openhab.org/t/mqtt-color-channel-not-supported/119011/4
The issue on the GUI seems to be a GUI bug, still exists on 3.2.0. @ghys WDYT? When no value is "physically clicked/selected", the GUI shows HSB as being selected, because HSB is the default value. This also occurs if you clicked on the X to "clear" the field.
In this state, the GUI saves no value for colorMode, so the channel configuration is empty {}
, which can be verified in the "Code" tab, and as a result, colorMode contains an empty string instead of the default.
I can "fix" this by removing the default value for the channel config xml, but that seems like a step backwards in usability, requiring users to have to click HSB when that could be the default, thus saving one extra click.
I'll open a PR to fix the documentation regarding upper case color mode.
PR #12163 will also fix the GUI error by using HSB as the default value.
This issue has been mentioned on openHAB Community. There might be relevant details there:
https://community.openhab.org/t/oh3-h801-rgbw-with-tasmota/135981/10
color channels from .things files as well as UI do not work as expected in the current snapshot (while they worked fine on 3.0.0)
Expected Behavior
Color channels can be configured like documented
Current Behavior
things file channels for MQTT of type "color" cause an exception:
Type color : Farbe [stateTopic="stat/kuechenkastl_6EAE75/RESULT", transformationPattern="REGEX:(.*HSBColor.*)∩JSONPATH:$.HSBColor", commandTopic="cmnd/kuechenkastl_6EAE75/HSBColor", color_mode="hsb"]
`2021-02-10 12:15:33.615 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:tasmota:kinderzimmerkasten' changed from OFFLINE (CONFIGURATION_ERROR): Remove and recreate: mqtt:topic:tasmota:kinderzimmerkasten:Farbe to UNINITIALIZED 2021-02-10 12:15:33.621 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:tasmota:kinderzimmerkasten' changed from UNINITIALIZED to UNINITIALIZED (DISABLED) 2021-02-10 12:15:34.418 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:tasmota:kinderzimmerkasten' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2021-02-10 12:15:34.423 [WARN ] [rnal.handler.GenericMQTTThingHandler] - Channel configuration error java.lang.IllegalArgumentException: No enum constant org.openhab.binding.mqtt.generic.mapping.ColorMode. at java.lang.Enum.valueOf(Enum.java:240) ~[?:?] at org.openhab.binding.mqtt.generic.mapping.ColorMode.valueOf(ColorMode.java:1) ~[bundleFile:?] at org.openhab.binding.mqtt.generic.values.ValueFactory.createValueState(ValueFactory.java:63) ~[bundleFile:?] at org.openhab.binding.mqtt.generic.internal.handler.GenericMQTTThingHandler.initialize(GenericMQTTThingHandler.java:164) [bundleFile:?] at jdk.internal.reflect.GeneratedMethodAccessor79.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?] at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?] at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:834) [?:?]
`
When created from the UI everything looks good, but I still get the exception in the log and while a color picker is displayed, etc. I cannot control the whole thing anymore, as soon as I ad a color channel:
`2021-02-10 12:35:38.408 [WARN ] [rnal.handler.GenericMQTTThingHandler] - Channel configuration error java.lang.IllegalArgumentException: No enum constant org.openhab.binding.mqtt.generic.mapping.ColorMode. at java.lang.Enum.valueOf(Enum.java:240) ~[?:?] at org.openhab.binding.mqtt.generic.mapping.ColorMode.valueOf(ColorMode.java:1) ~[bundleFile:?] at org.openhab.binding.mqtt.generic.values.ValueFactory.createValueState(ValueFactory.java:63) ~[bundleFile:?] at org.openhab.binding.mqtt.generic.internal.handler.GenericMQTTThingHandler.initialize(GenericMQTTThingHandler.java:164) [bundleFile:?] at org.openhab.core.thing.binding.BaseThingHandler.thingUpdated(BaseThingHandler.java:152) [bundleFile:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?] at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?] at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:834) [?:?]
`
removing the color channel makes the thing go online again.
Solution
use uppercase HSB in thing files works, as the enum in the code is now also uppercase: https://github.com/openhab/openhab-addons/blob/d6364aceb1d952e80c0c8ed758af5d06d072ffa4/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/mapping/ColorMode.java
but docs and UI seem to use lowercase hsb: https://www.openhab.org/addons/bindings/mqtt.generic/
Context
cannot control my mqtt based led strips anymore
Your Environment