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(RSSI.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 'RSSI.map' : 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.
You can’t just throw transforms into channel configs, unless the binding supports transforms. This binding docs don’t mention it, so assume unsupported.