Scale transformation service for negative numbers

Hello,
I installed the Transformation Service and created the following WifiSignal.scale file:

[-65…]=4
[-75…-65[=3
[-85…-75[=2
[-95…-85[=1
[…-95[=0

In the Things Incoming Value Transformation field there is the following configuration:JSONPATH:$.Wifi.Signal∩SCALE:(WifiSignal.scale).

I can extract the RSSI value frm json, but the scale conversion don’t work.

Where is the mistake?

Thanks.

Is your thing an MQTT thing?

Your scale syntax doesn’t match any of the examples in the documentation. Are you sure it should work?

Yes, It is.

Ok, sorry in the correct file I have only two point, not three. I re-written the lines without copy them.
the right file is:

[-65…]=4 //From -65 (included) to up (included)
[-75…-65[=3 //From -75 (included) to -65 (not included)
[-85…-75[=2 //From -85 (included) to -75 (not included)
[-95…-85[=1 //From -95 (included) to -85 (not included)
[…-95[=0 //From minimum (included) to -95 (not included)

Is correct?

Thanks.

I tried to rewrite the file:

NaN=0
]-65..]=4       //From -65 (included) to up (included)
]-75..-65]=3 //From -75 (not included) to -65 (not included)
]-85..-75]=2 //From -85 (not included) to -75 (not included)
]-95..-85]=1 //From -95 (not included) to -85 (not included)
[..-95]=0      //From minimum (included) to -95 (not included)

now the not included value are the first and I added also the NaN conversion, but do not work…
Incoming Value Transformation, in Paper UI MQTT Things Channels is JSONPATH:$.Wifi.Signal∩SCALE:(WifiSignal.scale).

Try:

JSONPATH:$.Wifi.Signal∩SCALE:WifiSignal.scale

If that doesn’t work, perhaps try using the transformation as a profile for the Item itself?

1 Like

Yess, Now work!