openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.59k forks source link

Error when trying to display rfxcom temperature item, IllegalFormatConversionException #581

Closed larsste closed 8 years ago

larsste commented 8 years ago

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

There seem to have been a similar issue #351.

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 in OH2 up until the UI-gets hold of it.

Since none of my configurations contain %d I checked the xml-files under ESH-INF/thing for the rfxcom-binding the channels.xml defines the state-pattern as %d

`

Number
<label>Temperature</label>
<description>Current temperature in degree Celsius</description>
<state pattern="%d °C" readOnly="true"></state>

`

Regardless I think that something like %.1f would be more appropriate for temperature channels.

I'm not entirely sure that this is the cause of the problem. But since I don't have %d anywhere in my config-files it felt plausible that it could be related to my error.

kaikreuzer commented 8 years ago

@paulianttila Could you have a look at this?

lolodomo commented 8 years ago

@larsste : is this issue still relevant for you ? I did not notice this issue in recent snapshots.

paulianttila commented 8 years ago

Fixed with #1362

paulianttila commented 8 years ago

@kaikreuzer, this can be closed.