Help with transform dBm to %

I’m running OH2.4 on W10 and have 3 devices which give me the RSSI in dBm rather than %.
One device uses MQTT which, after several attempts, I managed to get the map transformation to work as part of the MQTT input

Number Pi_RSSI "Pi RSSI" (RSSI) {mqtt="<[mosquitto:tele/shed/RSSI:state:MAP(]"}

I couldn’t get scale to work though so the map has 100 pairs starting with -1=100

The other two devices are TP-Link smart plugs with the TP-Link binding.
Adding the transformation to the Item doesn’t work
Putting the transformation in the label part of the item doesn’t work
Putting the transformation in the format string in the sitemap doesn’t work
If I put the map transformation in the sitemap it works with the MQTT device but leaves the value unchanged in the TP-Link ones.
I get the following error if I try the transform in the item label

2019-06-18 07:46:44.374 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '-75 %' with the file '' : Target value not found in map for '-75 %'

I tried creating a map with variations of -75%= and -75 %=
I tried JS to try to change the positive to negative

This should be relatively simple but I’ve hit a brick wall. Has anyone managed to do this or can point me in the right direction?

You haven’t given us all the puzzle pieces. I suspect your TP-link Items may have units, UoM? i.e. Number:Dimensionless types.

UoM can be a headache but really ought to be the heart of the solution for you.

I think you may have a restriction using MQTT v1 which won’t be UoM friendly. I’d be inclined to accept whatever comes in (percentage?) as a raw number and then have a rule convert that into a proxy Item with UoM
If you get all three of your Items in UoM then you can display/compare in similar ways.

The MQTT one works (but not as Scale). I can add the Map statement to the end of the channel and that works fine.

Number Pi_RSSI “Pi RSSI” (RSSI) {mqtt="<[mosquitto:tele/shed/RSSI:state:MAP(]"}

I can’t add Map to the end of the TP-Link channel nor does the profile bit work either

Number Charger_RSSI "Charger " (Bedroom1) [“Switchable”] { {{channel="tplinksmarthome:hs100:charger:rssi:”}

Tried (with no output - parse errors in the log)

{ channel=“tplinksmarthome:hs100:charger:rssi:MAP(”}

{ channel=“tplinksmarthome:hs100:charger:rssi:state:MAP(”}

{ channel=“tplinksmarthome:hs100:charger:rssi” [profile=“transform:MAP”, function=“”]}

{ channel=“tplinksmarthome:hs100:charger:rssi” [profile=“transform:MAP”, function=“”, sourceFunction="%.0f"]}

Putting the map statement in the item label gives error message

"Charger [MAP(]

Failed transforming the state ‘-70’ on item ‘Charger_RSSIa’ with pattern ‘MAP(’: Cannot format state ‘-70’ to format ‘%.0f’

"Charger [MAP(]

Gives no error but doesn’t transform the value

I’m not sure if the negative value causes issues

The TP-Link binding says

You can’t just throw transforms into channel configs, unless the binding supports transforms. This binding docs don’t mention it, so assume unsupported.

However, v2 bindings with channels will allow use of profiles, which specify a modifier between channel and Item

I’m not sure what version of OH this is available in.

2.4 release and later I think.