Transform contact state in modbus binding

Hello, i need help with transform OPEN to CLOSE and CLOSE to OPEN in modbus binding.
My modbus.things

Bridge modbus:serial:R3 [ port="/dev/ttyUSB2", id=3, baud=9600, stopBits="1", parity="none", dataBits=8, connectMaxTries=1, receiveTimeoutMillis=1000 ] {
    Bridge poller R3_INPUT [ start=0, length=8, refresh=1000, type="discrete", maxTries=1 ] { 
               Thing data I3_0 [ readStart="0", readValueType="uint8"] 


Contact         Window7       "Window [MAP(]"            {channel="modbus:data:R3:R3_INPUT:I3_0:contact"}

In i have translate to CZECH.


You can either use an incoming value transformation (i.e. via map) on the channel which will change the values the item receives or a state description on the item which would only be visual though.
I think you would be looking for the first option.

Using the map is only visual, this is not the solution for me

There is an invert transformation example in the docs

If you use the incoming value transformation on the channel it is not only visual as it transforms the value before it hits the item.


        Thing data I3_2 [ readStart="2", readValueType="bit", readTransform="JS:modbus_contact.js"] 


(function(inputData) {
    var out = inputData ;
    if (inputData == 'OPEN') {
        out = 'CLOSED' ; 
    } else if (inputData == 'CLOSED') {
        out = 'OPEN' ;
    return out ;     

its ok? when add ', readTransform=“JS:modbus_contact.js” ’ to things, input is not reading…

As it tells you in the binding docs

The transformation receives the extracted number as input.

and you can see the example in the docs deals with numbers 0/1

The example uses other values as well because it can be used for read and write.