openhab-addons: [MQTT] Cannot send STOP to generic roller shutter

Since I upgraded from 4.0.4 to 4.1.1, I can’t send STOP command to my mqtt channel configured as roller shutter. UP and DOWN still work

Expected Behavior

Send a message “STOP” to the topic linked to a generic roller shutter MQTT channel when the related item got the STOP command

Current Behavior

sendCommand(STOP) to the item responds OK but no message in the mqtt topic.

In the logs, I got this exception :

[ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.mqtt.generic.internal.handler.GenericMQTTThingHandler@8ec84e': STOP is not a valid command for MQTT.
java.lang.IllegalArgumentException: STOP is not a valid command for MQTT.
	at org.openhab.binding.mqtt.generic.values.RollershutterValue.parseType(RollershutterValue.java:97) ~[?:?]
	at org.openhab.binding.mqtt.generic.values.RollershutterValue.parseCommand(RollershutterValue.java:137) ~[?:?]
	at org.openhab.binding.mqtt.generic.ChannelState.publishValue(ChannelState.java:369) ~[?:?]
	at org.openhab.binding.mqtt.generic.AbstractMQTTThingHandler.handleCommand(AbstractMQTTThingHandler.java:153) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:147) [bundleFile:?]
	at org.openhab.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
	at jdk.proxy479.$Proxy594.handleCommand(Unknown Source) [?:?]
	at org.openhab.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:95) [bundleFile:?]
	at org.openhab.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [bundleFile:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:147) [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:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]

Possible Solution

I managed to fix on my side by deleting && stopCommandString != null in RollershutterValue.java:94 that comes from https://github.com/openhab/openhab-addons/pull/15875/ I guess it is only a workaround and the problem may be deeper

Steps to Reproduce (for Bugs)

  1. Create a Generic MQTT Thing
  2. Add a channel type Rollershutter (default configuration is good)
  3. Create an item of type Rollershutter linked to that channel
  4. Send command STOP to that item

Context

I saw the introduction of the bug was about mqtt.homeassistant. In my case, I only use mqtt.generic because I want to keep it simple and low level

Your Environment

  • Version used: 4.1.1
  • Environment name and version : openjdk 17.0.9, node 16.20.2
  • Operating System and version : Openhabian (Raspbian 11)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Yes, definitely a weirdness with the default value. I was able to reproduce with a UI created generic MQTT thing, but not a file based (which is what the shades in my production instance are). I wrote a fix, but did not have time to test it yet. In the meantime, you can work around by explicitly setting stop = "STOP" on the channel for a file based thing, or for a UI based thing, configure it to something else (like “ST”) first, save it, and then change it to “STOP” (do not click the little X to clear it and get the default) to get it to persist the literal string.