99except ImportError :
1010 from pymodbus .client import ModbusSerialClient
1111
12+
1213from .modbus_base import modbus_base
1314from configparser import SectionProxy
1415from defs .common import find_usb_serial_port , get_usb_serial_port_info , strtoint
@@ -66,13 +67,14 @@ def __init__(self, settings : SectionProxy, protocolSettings : protocol_settings
6667 stopbits = 1 , parity = 'N' , bytesize = 8 , timeout = 2
6768 )
6869 else :
69- self .client = ModbusSerialClient (port = self .port ,
70+ self .client = ModbusSerialClient (
71+ port = self .port ,
7072 baudrate = int (self .baudrate ),
7173 stopbits = 1 , parity = 'N' , bytesize = 8 , timeout = 2
7274 )
7375
7476 #add to clients
75- self .clients [client_str ] = self .client
77+ modbus_base .clients [client_str ] = self .client
7678
7779 def read_registers (self , start , count = 1 , registry_type : Registry_Type = Registry_Type .INPUT , ** kwargs ):
7880
@@ -84,9 +86,9 @@ def read_registers(self, start, count=1, registry_type : Registry_Type = Registr
8486 kwargs ['slave' ] = kwargs .pop ('unit' )
8587
8688 if registry_type == Registry_Type .INPUT :
87- return self .client .read_input_registers (start , count , ** kwargs )
89+ return self .client .read_input_registers (address = start , count = count , ** kwargs )
8890 elif registry_type == Registry_Type .HOLDING :
89- return self .client .read_holding_registers (start , count , ** kwargs )
91+ return self .client .read_holding_registers (address = start , count = count , ** kwargs )
9092
9193 def write_register (self , register : int , value : int , ** kwargs ):
9294 if not self .write_enabled :
0 commit comments