Transformations from-to

Hi
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:

[0.0,0.2]=still
[0.3,1.2]=almost still
And so on

My item

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

Yeah,

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 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

0.1=Still
0.2=Still

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 Transformations · openhab/openhab1-addons Wiki · GitHub (with information about how to use it in items definition)
for OH2 see http://docs.openhab.org/addons/transformations/scale/readme.html

EDIT: as links have changed…

Thanks it worked :slight_smile: