Hi guys,
I’m in the process of switching to OH3, including a switch from file based config to GUI/jsondb based config. And just now I’m a bit stymied by how to apply MAP transformations…
I found in this post that I can configure value transformations in the GUI via /Add Metadata/State Description/Pattern in the format <transformation service>(<myFile>.map):%s
. But since the value is formatted as float (1.0
) instead of integer (1
), I would like to apply formatting before transforming the value.
According to the Java formatter class syntax (link in chapter Items/State Presentation), that should be done by using %d
instead of %s
. But it doesn’t work, instead I get the following error message:
Failed transforming the state '3.0' on item 'PowerOpenhab_SignalStrength' with pattern 'MAP(hm_qos.map):%d': Cannot format state '3.0' to format '%d'
And yes, the Map add-on is running, it works with %s
and the easy way out would be to just change my transformation file so that I can match against 3.0
instead of 3
.
But I would like to understand why the formatting is not working…
On a side note:
- the chapter Transformation does not mention transformation for GUI based configs
- it does link to section Profiles in chapter Items, but this section doesn’t explain profile based transformations at all
- the brief documentation for MAP does mention how to use profiles for transformation - for text based configs