(solved) Transform ON / OFF into another value (e.g. string)

Hi, my weather station sends for rain the command “ON” and for no rain the command “OFF”.

openhab.log:

2016-03-28 09:10:23 - Rainsensor received command OFF
2016-03-28 09:11:54 - Rainsensor received command OFF
2016-03-28 09:13:28 - Rainsensor received command OFF
2016-03-28 09:15:01 - Rainsensor received command OFF

item:

Switch Rainsensor { knx=“<(60)3/7/9”}

What is your proposal or idea to best transform the value “OFF” into “It’s not raining” and the value of “ON” into “Its raining”

Click

Thanks, an example would be much more useful

Please keep the conversation in english.

The link John posted does include the following example

Let’s make a small example to illustrate this function. If you have a sensor which returns you the number 0 for a closed window and 1 for an open window, you can transform these values into the words “open” or “closed”. Create a map file named window.map for example and add the desired keys and values.
0=closed
1=opened
UNDEFINED=unknown
-=unknown

What else do you need ?

I have the same issue, no idea how to do that

Translated into English. My response was too fast :wink:

Thanks this is helpful. So, can i assume that the map needs to be called the same as the item?

made i file called Rainsensor.map:

OFF=No Rain
ON=Rain
UNDEFINED=unknown
-=unknown

item:

String Rainsensor { knx=“<(60)3/7/9”}

Sitemap:

Text item=Rainsensor

My GUI displays “OFF” instead of No Rain

No, you can name the .map file to whatever you like, cause you specify the file to be used in your item mapping.
But for better readability, it makes sense to call it “rain.map” in your case.

Example for item file

Contact Window_EG_WZ_S "Wohnzimmer [MAP(en.map):%s]" <contact> (gEG_WZ, gContacts, gWindows)

1 Like

This is great! Thank you Sir!

Fantastic! Thanks JohnnyX! This helped a lot!

@all, this configuration works:

Rainsensor.map:

OFF=No Rain
ON=Rain
UNDEFINED=unknown
-=unknown

item:

String Rainsensor “Rain [MAP(Regensensor.map):%s]” { knx=“<(60)3/7/9”}

sitemap:

Text item=Rainsensor