I have a device (eq3 valve) that returns the temperature setpoint (temp field) and other fiels of its status altogether i a JSON status MQTT topic.
When yo want to change the setpoint you have to use another command topic and send the temp as raw format (string with the temperature in ºC).
I have created the thing and the channels and links to items and interface elements.
I can view and update other channels that are string like mode (auto or manual).
But when it comes to settemp (I configured it as a number in the channel) it fails.
I can see the setpoint temp pusblished by the device, but when I try to use a scale to change it it does not work.
In openHAB console it gives me an error:
15:12:57.305 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.mqtt.generic.internal.handler.GenericMQTTThingHandler@4e3bc25d': Parse Error
javax.measure.format.MeasurementParseException: Parse Error
at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.check(SimpleUnitFormat.java:631) ~[bundleFile:2.1.2]
at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseSingleUnit(SimpleUnitFormat.java:486) ~[bundleFile:2.1.2]
at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseProductUnit(SimpleUnitFormat.java:505) ~[bundleFile:2.1.2]
at tech.units.indriya.format.SimpleUnitFormat.parseObject(SimpleUnitFormat.java:293) ~[bundleFile:2.1.2]
at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:834) ~[bundleFile:2.1.2]
at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:829) ~[bundleFile:2.1.2]
at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:825) ~[bundleFile:2.1.2]
at tech.units.indriya.AbstractUnit.parse(AbstractUnit.java:219) ~[bundleFile:2.1.2]
at org.openhab.core.library.types.QuantityType.toUnit(QuantityType.java:281) ~[bundleFile:?]
at org.openhab.binding.mqtt.generic.values.NumberValue.update(NumberValue.java:116) ~[?:?]
at org.openhab.binding.mqtt.generic.ChannelState.publishValue(ChannelState.java:334) ~[?:?]
at org.openhab.binding.mqtt.generic.AbstractMQTTThingHandler.handleCommand(AbstractMQTTThingHandler.java:149) ~[?:?]
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.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
at com.sun.proxy.$Proxy380.handleCommand(Unknown Source) [?:?]
at org.openhab.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:80) [bundleFile:?]
at org.openhab.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [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:829) [?:?]
It seems the scale object sends the correct value and the item passes it corectly to the channel of the item, but when it tryes to parse it there is an error.
This is the configuration of the thing’s channel:
- id: tempObjRadiadorSalaJuegos
channelTypeUID: mqtt:number
label: Temperatura objetivo Radiador sala de juegos
description: ""
configuration:
postCommand: true
unit: ºC
min: 5
qos: 2
formatBeforePublish: "%.1f"
max: 35
commandTopic: cmnd/tasmotaSalaJuegos/EQ3/001A2215622D/settemp
step: 0.1
stateTopic: stat/EQ3/001A2215622D
transformationPattern: JSONPATH:$.temp
I have defined it as a number and it reads it correctly from the JSON message.
The problem seems to be when the number needs to be converted to string again to send it to the command topic.
I have tried to use formatBeforrePublish: %.1f and %s and none works.
I am sure I am missing something, but could not find what is it.
As said this works correctly with other fields that are text fields.