RFX Somfy RTS rollershutter NumberFormatException

Hello,

I’m using Somfy RTS wall plugs that are registered as Rollershutters in the system (that’s what I figured is what the binding wants). When I issue an

PLUG.sendCommand(0)

from a rule, I unfortunately get an exception

==> /var/log/openhab2/openhab.log <==
2017-10-25 20:39:16.626 [ERROR] [ternal.profiles.DefaultMasterProfile] - Exception occurred while calling handler: java.lang.NumberFormatException: Can't convert 0 to Command
java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Can't convert 0 to Command
	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:51) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$2(CommunicationManager.java:223) ~[?:?]
	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:218) [105:org.eclipse.smarthome.core.thing:0.9.0.201710101404]
	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.receive(CommunicationManager.java:95) [105:org.eclipse.smarthome.core.thing:0.9.0.201710101404]
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:207) [98:org.eclipse.smarthome.core:0.9.0.201710101404]
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1) [98:org.eclipse.smarthome.core:0.9.0.201710101404]
	at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181) [98:org.eclipse.smarthome.core:0.9.0.201710101404]
	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) [?:?]
Caused by: java.lang.NumberFormatException: Can't convert 0 to Command
	at org.openhab.binding.rfxcom.internal.messages.RFXComRfyMessage.convertFromState(RFXComRfyMessage.java:237) ~[?:?]
	at org.openhab.binding.rfxcom.handler.RFXComHandler.handleCommand(RFXComHandler.java:81) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile$1.call(DefaultMasterProfile.java:54) ~[?:?]
	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

which I don’t understand as the logs usually say that the PLUG was set to 0 or 100 when I press the up or down button in Basic UI. I realized that a sendCommand(UP) works, but that’s not working for me. Principally in the rule I can live with that, but in the sitemap file I have to do

mappings=[UP="ON",DOWN="OFF"]

and then the state is not reflected in Basic UI as the “real value” of the PLUG is 0 or 100.

Can I somehow send it the number value or is that impossible?

1 Like

Rollershutter requires a PercentType to be sent as a command. Because PercentType is more restrictive than DecimalType (i.e. the state for Number Items) it does not support sending arbitrary Numbers.

Use

PLUG.sendCommand(new PercentType(0))

Is this changed in OH2? Because in OH1 (1.8.0) myShutter.sendCommand(0) works as expected. But of course I have knx and no Somfy RTS.

Caused by: java.lang.NumberFormatException: Can't convert 0 to Command

I would expect this when there is no channel to set an absolute position.

I don’t know if this changed or not. I do think that the value is converted by the binding so perhaps knx is better at handling Number commands.

But without being able to test it myself, the only thing that makes sense is that it is failing to convert the Number into a PercentType.

1 Like

Ah, that makes sense!

Looking at the source code of RFXComRfyMessage.java method convertFromState which throws the error it doesn’t seem to be able to handle NumberType nor PercentageType. This implementation should be able to handle Percentage commands given the specification of Rollershutter.

Hi Rich, hope all is well. I am having this problem too. But from a different angle, which is using Alexa. So i tell Alexa to open or close the shutters and she sends the command to openhab and openhab (the RFXCOM binding) tries to execute this command by giving a number 0 or 100, but the command does not get executed.

Also when i manually test this from the control screen and enter a number and click the button next to it (the tick mark), the command is not sent to the shutters.

Do you have any idea how i could get around this?
Thanks so much.
Emre

If OH is receiving and generating the commands and you see the Items updating in events.log then the problem is in the binding and I’ll be of no help.