Number item vs string

In Openhab 1 I could just change the item type to Number and it would be able to be graphed.
When doing this in Openhab2 it doesn’t work.

See examples below.

How do I cast a string being returned from a thing in an item?

This doesn’t work
Number Temperature_Bedroom “Temperature Bedroom [%f °C]” (Temperature) { channel=“exec:command:Temperature_Bedroom:output”}

This works
String Temperature_Meals “Temperature Meals [%s °C]” (Temperature) { channel=“exec:command:Temperature_Meals:output”}

Error messages in the logs are always a help. Without anything more than “doesn’t work” we are left to guess.

My first guess would be that the “number” being returned by your script is unparsable. Does it have leading or trailing white space? Comma instead of a period for the decimal place?

There is nothing in the log. The conversion is just returning '- °C’
The script worked in openhab1.8x which is why I thought the syntax may have changed.
Any help would be appreciated.
When configured as string it returns '16.625 °C’
There is no leading space, comma or anything I can see to mean it wouldn’t convert.

If you are using the 2.x Exec binding then the indeed the syntax and use has changed tremendously. It is a completely new binding. Please see the readme.

If you are not familiar with Things and other new OH 2 concepts, please see the Migration Tutorial.