import pymodbus.exceptions
import serial
from pymodbus.client.sync import ModbusSerialClient as ModbusClient

client = ModbusClient(method="rtu", port="/dev/ttyUSB0", stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, baudrate=115200, timeout=1, strict=False)
status = client.connect()
read_data = client.read_holding_registers(1, count=1)
if type(read_data) is not pymodbus.exceptions.ModbusIOException:
    for i, v in enumerate(read_data.registers):
        print(f"READ DATA at {i}: {v}")
    pass
else:
    print("READ ERROR")
