I was about to write a help request but finally managed to solve my own issue. It took me a couple of days to problem solve so I thought I would post it here anyway, just in case others find themselves with the same issue.
I have OpenHab2 (2.5.0.M1) running on a RaspberryPi3 running Raspbian 4.14.79-v7+.
I am new to OpenHab2 and the new bindings but have slowly migrated from the old file based configurations to PaperUI config and the like. I use a number of different MQTT things and their channels relating to various topics/items. Once I got up to speed with the new structure and terminology I have started to appreciate this new direction.
I recently started to use a personal assistant to control my shower unit, so had to set up some of my item tags such as TargetTemperature for my Shower_Ideal_Temp item and CurrentTemperature for my Shower_Water_Temp item. These items were set with the Temperature Category and Number Type. They had been linked through to my MQTT Shower thing (which is a raspberry pi controlling my shower and various other bathroom items) and were successfully controlled using OpenHab2 and the MQTT 2 binding.
While I was setting up the items to work with my home assistant, I noticed that I had not set the dimension field, so I set these two items’ dimension to Temperature (this turned out to be what caused my issue as you will see below).
Anyway, my home assistant could now set the shower temperature so I was happy. That is until I realised that although my Ideal temperature was being changed by both my home assistant and my HabPanel control this change failed to be sent via MQTT to my Shower controller. I tested my shower system using different MQTT clients and these worked well and I also noticed that OpenHab would hear the MQTT messages from the other clients and update the items correctly.
So looking at the events.log and openhab.log I noticed the following error when trying to change the Shower_Ideal_Temp and send the MQTT command.
[ome.event.ItemCommandEvent] - Item 'Shower_Ideal_Temp' received command 46 [vent.ItemStateChangedEvent] - Shower_Ideal_Temp changed from 45.0 °C to 46.0 °C ==> /var/log/openhab2/openhab.log <== [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.eclipse.smarthome.binding.mqtt.generic.internal.handler.GenericThingHandler@e850fa': null java.lang.NumberFormatException: null at java.math.BigDecimal.<init>(BigDecimal.java:497) ~[?:?] at java.math.BigDecimal.<init>(BigDecimal.java:383) ~[?:?] at java.math.BigDecimal.<init>(BigDecimal.java:809) ~[?:?] at org.eclipse.smarthome.binding.mqtt.generic.internal.values.NumberValue.update(NumberValue.java:91) ~[?:?] at org.eclipse.smarthome.binding.mqtt.generic.internal.generic.ChannelState.publishValue(ChannelState.java:321) ~[?:?] at org.eclipse.smarthome.binding.mqtt.generic.internal.handler.AbstractMQTTThingHandler.handleCommand(AbstractMQTTThingHandler.java:123) ~[?:?] at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?] at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.11.0.oh250M1] at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [102:org.eclipse.smarthome.core:0.11.0.oh250M1] at com.sun.proxy.$Proxy144.handleCommand(Unknown Source) [214:org.eclipse.smarthome.binding.mqtt.generic:0.11.0.oh250M1] at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [109:org.eclipse.smarthome.core.thing:0.11.0.oh250M1] at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [109:org.eclipse.smarthome.core.thing:0.11.0.oh250M1] at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?] at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.11.0.oh250M1] at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.11.0.oh250M1] 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) [?:?]
It looked like it was having an issue with number type format problems when trying to send the MQTT message but the item would update its value
[ome.event.ItemCommandEvent] - Item 'Shower_Ideal_Temp' received command 46 [vent.ItemStateChangedEvent] - Shower_Ideal_Temp changed from 45.0 °C to 46.0 °C
I did notice that when receiving the command via another mqtt client such as…
mosquitto_pub -h 192.168.1.XX -t cmnd/shower/idealtemp -m 45
it updated as it should…
[vent.ItemStateChangedEvent] - Shower_Ideal_Temp changed from 46.0 °C to 45.0 °C
So I tested to see if it would fail if I tried to change the value in a rule and sure enough it failed in the same way. I then tried to change the item type from a number to a dimmer and it started to send decimal percentage values as it should.
Finally, I got ready to send a help request here, but before I did I thought I would try one last thing. I removed the dimension value from the item (Temperature to empty). This is what seemed to be the reason for the error above. It now all works as you would expect.
Maybe someone could explain what was going on there, but I hope this might help anyone out there with this same issue.