I would like to show a text on a string instead of the value from my wind sensor.
So if the wind speed is from 0.0 to 0,2 it should say still
I have made a wind.map file with this input:
And so on
String windspeed "[MAP(wind.map):%s]" (weather)
My problem is that it could not accept my from and to, so I think it must be written wrong
I’m no expert here, but your trying to convert/show a number value as text, and I think this needs to done via a rule and probably with a second ‘dummy’ wind speed item.
So something like… If WindSpeed between 0 and 0.2, then MySpeed = “Still”, etc.
Just giving an idea what I think needs be done. I can may look later in the week if nobody else gets to it first.
See if this helps:
If it is an integer value (i.e. no decimal place) you can do this in your rule: if(Integer::parseInt(mqttNWBattery.state) < 25) If it does have a decimal point use Double::parseDouble() instead However, if you make your Item a Number instead of a String OH should be able to parse the value for you, as long as the String is a parseable number (e.g. no leading or trailing spaces) it will convert it to a DecimalType for you. And if there is something a little off about it you can use a transf…
If the value delivered from weather binding is a number, you have to use Number as item type. This does not affect the label, displayed through UI!
If you want that string, set through the .map-file, you can refer to the .map-file like done in the label.
It was a typing error, my item is a Number item,
my log displayes this error, it works if I display every number with a text like
But I dont think this is the right way to go.
17:14:00.369 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '0.1' with the file 'vejrst.map' : Target value not found in map for '0.1'
Ah, I didn’t realize it… you have to use scale, not map transformation
for OH1, see
https://github.com/openhab/openhab1-addons/wiki/Transformations#scale-transformation-service (with information about how to use it in items definition)
for OH2 see http://docs.openhab.org/addons/transformations/scale/readme.html