Skip to content

[worxlandroid] Fix NumberFormatException when sending a Command to mode Channel - #21331

Merged
lsiepel merged 5 commits into
openhab:mainfrom
cweitkamp:bugfix-worxlandroid-mode-command
Aug 14, 2026
Merged

[worxlandroid] Fix NumberFormatException when sending a Command to mode Channel#21331
lsiepel merged 5 commits into
openhab:mainfrom
cweitkamp:bugfix-worxlandroid-mode-command

Conversation

@cweitkamp

@cweitkamp cweitkamp commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
  • Fix NumberFormatException when sending a Command to mode Channel
2026-08-06 16:29:32.109 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.worxlandroid.inte
rnal.handler.WorxLandroidMowerHandler@6b491d39': For input string: "Party"
java.lang.NumberFormatException: For input string: "Party"
        at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.base/java.lang.Integer.parseInt(Unknown Source)
        at java.base/java.lang.Integer.parseInt(Unknown Source)
        at org.openhab.binding.worxlandroid.internal.handler.WorxLandroidMowerHandler.internalHandleCommand(WorxLandroidMowerHandler.java:244)
        at org.openhab.binding.worxlandroid.internal.handler.AWSClientThingHandler.handleCommand(AWSClientThingHandler.java:227)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:149)
        at org.openhab.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59)
        at jdk.proxy135783/jdk.proxy135783.$Proxy135940.handleCommand(Unknown Source)
        at org.openhab.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:97)
        at org.openhab.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49)
        at org.openhab.core.thing.profiles.StateProfile.onCommandFromItem(StateProfile.java:42)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:149)
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)

A different solution might be adding command options to the channel-type like this:

	<channel-type id="schedule-mode-type">
		<item-type>String</item-type>
		<label>Schedule Mode</label>
		<description>Sets Normal or Party mode</description>

		<state readOnly="false">
			<options>
				<option value="NORMAL">Normal</option>
				<option value="PARTY">Party</option>
			</options>
		</state>
		<command>
			<options>
  				<option value="1">Normal</option>
				<option value="2">Party</option>
			</options>
        </command>
	</channel-type>

Signed-off-by: Christoph Weitkamp github@christophweitkamp.de

…de Channel

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
@cweitkamp cweitkamp added the bug An unexpected problem or unintended behavior of an add-on label Aug 7, 2026
@cweitkamp
cweitkamp requested a review from clinique as a code owner August 7, 2026 09:34
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
@wborn
wborn requested a balanced review from Copilot August 8, 2026 00:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes schedule mode command conversion for Worx Landroid mowers.

Changes:

  • Passes raw schedule commands to channel-specific handling.
  • Adds mode-to-protocol-code mapping.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
WorxLandroidMowerHandler.java Converts mode commands to mower codes.
WorxLandroidModeCodes.java Defines Normal and Party mode codes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@clinique clinique left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wborn

wborn commented Aug 9, 2026

Copy link
Copy Markdown
Member

I'd go for dropping backwards compatibility and have the more readable commands/enum values (update docs, add upgrade instruction). Also looks like Copilot found a real issue.

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
@cweitkamp

Copy link
Copy Markdown
Contributor Author

I applied the comments from Copilot review and added a hint to the docs.

Comment thread bundles/org.openhab.binding.worxlandroid/README.md Outdated
Signed-off-by: lsiepel <leosiepel@gmail.com>

@lsiepel lsiepel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@lsiepel
lsiepel merged commit 1aa3af4 into openhab:main Aug 14, 2026
1 of 2 checks passed
@lsiepel lsiepel added this to the 5.3 milestone Aug 14, 2026
lsiepel pushed a commit that referenced this pull request Aug 14, 2026
…de Channel (#21331)

* [worxlandroid] Fix NumberFormatException when sending a Command to mode Channel

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
@lsiepel lsiepel added the backported A PR that has been cherry-picked to a patch release branch label Aug 14, 2026
@cweitkamp
cweitkamp deleted the bugfix-worxlandroid-mode-command branch August 14, 2026 10:05
cipianpascu pushed a commit to cipianpascu/openhab-addons that referenced this pull request Aug 16, 2026
…de Channel (openhab#21331)

* [worxlandroid] Fix NumberFormatException when sending a Command to mode Channel

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported A PR that has been cherry-picked to a patch release branch bug An unexpected problem or unintended behavior of an add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants