OH3 transformation map - how to?

What is a correct way in OH3 to map item state to the map file?
I’ve created map file manually and placed it to the conf/transform/motion.map

then in given item I’ve added state description with pattern MAP:motion.map tried MAP(motion.map) as well, but either works

what is correct syntax if it is different from OH2x ?

as in OH2

MAP(transformation.map):%s
2 Likes

damn, thanks and sorry for bothering … i’m sometimes just blid :wink:

I try to use a MAP transformation by defining the following pattern in stateDescription metadata of an item:

MAP(anlagenschema.map):%s

But I get the following error:

Failed transforming the state ‘4’ on item ‘Viessmann_Anlagenschema’ with pattern ’ MAP(anlagenschema.map):%s’: Couldn’t transform value because transformation service of type ’ MAP’ is not available.

“MAP Transformation” Add-on is installed an running:

openhab-transformation-map │ 3.0.0 │ x │ Started │ openhab-addons-3.0.0 │ Map Transformation

Any ideas?

Is there a file called anlagenschema.map in the maps folder?

That would be my guess

Yes, there is a file called “anlagenschema.map” in the maps folder which is readable by openhab user.

is the stae 4 in the map?

Yes, in fact it’s a map I already (successfully) used with openhab 2.5. With openhab 3 none of my maps work.

This may or may not be helpful - I originally had a Thing Channel and Item as a Number Type, and the MAP transformation worked sporadically (I couldn’t work out when it did and didn’t work, but it seemed to be a combination of saves and page refreshes).

Deleting and re-creating the Thing Channel and Items as String Types now seems to work fine - note you have to delete and re-create, at least with the Channels: you can’t change their Type after they’ve been created in the UI, and changing it in the YAML didn’t make the MAP work.

My use case was an incoming number, which I then MAP to a string (such as incoming 2 = Cloudy)

I finally did another reinstall of the transformation service and cleaned openhab’s cache. Now the mapping is working.

Thanks all for your hints.

1 Like

Still not working for me. Having the map-files from OH2.5 now transferred to OH3. but not result.
reinstall the transformation service / cleaned the cache. still no results. any ideas?

How didi ypu define the items with mappings? The mapping goes like any other value formation into metadat State Description

Hi, I have EXACTLY the same problem. It doesn’t seem to work exactly like OH2!
In fact it’s weird because the SCALE transformations I use for wind speed and wind direction ARE working! So MAP(rain.map):%s for my rain sensor to convert closed/open to rain/dry does NOT work in the Pattern window of State Description unless I put the map values manually into the OPTIONS window.
SCALE(beaufort.scale):%s DOES work in the Pattern window of State Description.
Everything worked perfectly in OH2 so it has nothing to do with missing files or failure to install the transformation add-ons. There are strange bugs in OH3.

Hi Kriznik,
Don’t think this is a solution. It should work like that but it doesn’t!
See my post down further… the SCALE transformation works fine when the file is referenced in the Pattern window of the State Description window but any MAP transformations simply won’t work unless I type the map values directly into that Options window lower down in the config card.

honestly I don’t know.
my production OH will remain at 2.5.8 for some time, till OH3 won’t mature a bit. Currently it’s way to much work to get it working correctly, which I’m not willing to take.

Yes it’s more modern and stuff, but OH2.5 just feels more friendly, less click-fest-like and so on

:wink:

We have identified a problem in this thread when channel has options.
https://community.openhab.org/t/oh3-map-transformation-is-behaving-different-for-different-items/114990