The best way to communicate between SW Mervis and third party devices is to implement the Modbus protocol on these devices. Subsequent operation and modifications are simpler and faster. Another great advantage is that this protocol basically allows you to operate multiple slave devices on one serial line.
In this case, Openport is a functional block that takes care of opening the port, ie its reservation within the system.
In the input string (def) for FB io.openport it is necessary to enter for UART port 1: "def: = 'serial: 1: 9600,8, N, 1';". I also enclose a tested code example in ST for Unipi 1.1.