Items in sitemap generate log message - Exception while formatting value ... of item

I have started my migration to OH2 from OH1. I have created the items and a simple sitemap. There seems to be some issue with my rfxcom things/items. They where discovered correctly and I have linked the relevant channels to items.

When I bring up the sitemap I get an exception in the log and the item in the UI shows up as Err

Exception while formatting value '5.20000000000000017763568394002504646778106689453125' of item Kyl_Temperatur with format '%d °C': java.util.IllegalFormatConversionException: d != java.math.BigDecimal

I have found a similar issue in github issue #351. But that’s for another binding.

My item-definition is as such:
Number Kyl_Temperatur "Kyl Temperatur [%.1f] °C" <temperature> (gKok)

The same formatting string works in my 1.7.1 setup. It also looks like everything is ok up until the UI-gets hold of it.
At least that’s what I gather from the logs. Hopefully it’s just me that messed up something obvious. It also seems like the values sometimes shows up in th UI. Those seem to be values that can be converted as integers.

2015-12-27 20:50:43 [DEBUG] [.r.handler.RFXComBridgeHandler:369  ] - Message received: Raw data = 0A5209147F000034350169, Packet type = TEMPERATURE_HUMIDITY, Seq number = 20, Sub type = VIKING_02035_02038, Device Id = 32512, Temperature = 5.2, Humidity = 53, Humidity status = COMFORT, Signal level = 6, Battery level = 9
2015-12-27 20:50:43 [DEBUG] [s.c.d.internal.PersistentInbox:142  ] - Discovery result with thing 'rfxcom:temperaturehumidity:efdd2b01:32512' not added as inbox entry. It is already present as thing in the ThingRegistry.
2015-12-27 20:50:43 [INFO ] [ome.event.ThingStatusInfoEvent:43   ] - 'rfxcom:temperaturehumidity:efdd2b01:32512' updated: ONLINE
2015-12-27 20:50:43 [DEBUG] [b.rfxcom.handler.RFXComHandler:167  ] - Received message from bridge: rfxcom:bridge:efdd2b01 message: Raw data = 0A5209147F000034350169, Packet type = TEMPERATURE_HUMIDITY, Seq number = 20, Sub type = VIKING_02035_02038, Device Id = 32512, Temperature = 5.2, Humidity = 53, Humidity status = COMFORT, Signal level = 6, Battery level = 9
2015-12-27 20:50:43 [INFO ] [smarthome.event.ItemStateEvent:43   ] - Kyl_Temperatur updated to 5.20000000000000017763568394002504646778106689453125
2015-12-27 20:50:43 [DEBUG] [o.i.m.internal.MyOpenHABClient:492  ] - Sending update '5.20000000000000017763568394002504646778106689453125' for item 'Kyl_Temperatur'
2015-12-27 20:50:43 [INFO ] [ome.event.ThingStatusInfoEvent:43   ] - 'rfxcom:bridge:efdd2b01' updated: ONLINE
2015-12-27 20:50:43 [INFO ] [s.event.ItemStateChangedEvent :43   ] - Kyl_Temperatur changed from NULL to 5.20000000000000017763568394002504646778106689453125
2015-12-27 20:50:43 [WARN ] [s.u.i.items.ItemUIRegistryImpl:320  ] - Exception while formatting value '5.20000000000000017763568394002504646778106689453125' of item Kyl_Temperatur with format '%d °C': java.util.IllegalFormatConversionException: d != java.math.BigDecimal

My z-wave items does not show the same error. It’s the 1.8.0 snapshot

Does anyone have any ideas?

You have to use the %f syntax for numbers with decimals. To show only 1 decimal, use %.1f.

Well that’s the thing… I am using %.1f in my item definition. (The item definition is in my original post.). The %d that shows up in the log is coming “from somewhere else”.

It might be a label="... [%d °C]" statement in your sitemap?

The only thing I have in the sitemap right now is group items without labels.

But when looking in the channels.xml for the rfxcom binding I see this. channel.xml

Number Temperature Current temperature in degree Celsius

Could that possibly have something to do with it?

EDIT: Filed an issue over at github #581

Oh yes. I would say that that channel.xml file you linked appears to make the bold assumption that all Number items with %d formatting will never present decimal places. I don’t know anything about that binding, but I would suggest opening an issue in github so that that assumption is fully vetted.

Coming up against the same problem in OH3, with an RFXCOM Energy Sensor.

[WARN ] [e.internal.SseItemStatesEventBuilder] - Exception while formatting value '7499290.392817862' of item HouseEnergyMonitor_TotalUsage with format '%d Wh': d != java.math.BigDecimal

I know this is an old post but did anyone out there find a solution? Can’t find the issue on github and the channesl.xlm has %d Wh under totalusage so likey the same issue?
Thanks!

Five years and two openHAB versions later … let’s treat it as new issue.

How is your Item HouseEnergyMonitor_TotalUsage defined? What’s it linked to,if anything? Have you applied a profile to that link? Under what circumstances do you get the warn message?

1 Like