Converting MQTT string to number / degrees

Hi all,

I’ve got OpenHAB2 configured to receive data from a MQTT broker. It displays just fine as a string.

I was thinking it would probably be best to use a JavaScript transformation to make it a number, but I can’t seem to get it right of find a good example (including items, etc.).

Is this the best way to tackle this or would a rule be better? FWIW I also want to convert one String from Fahrenheit to celsius.

TIA - I will probably find the answer now that I’ve taken the time to post!

There’s a wiki entry (made using OH 1.8.2); but maybe it helps you as well (e.g. the rule to process the string): https://github.com/openhab/openhab/wiki/GoogleMap#parse-the-raw-data-

with kind regards,
Patrik