Code: Alles auswählen
openwb@debian12:~/openWB$ git diff packages/modules/common/modbus.py | cat
diff --git a/packages/modules/common/modbus.py b/packages/modules/common/modbus.py
index a7ef40ed8..f31a3123e 100644
--- a/packages/modules/common/modbus.py
+++ b/packages/modules/common/modbus.py
@@ -10,7 +10,9 @@ from enum import Enum
from typing import Callable, Iterable, Union, overload, List
import pymodbus
-from pymodbus.client.sync import ModbusTcpClient, ModbusSerialClient
+from pymodbus.client.tcp import ModbusTcpClient
+from pymodbus.client.serial import ModbusSerialClient
+# from pymodbus.client.sync import ModbusTcpClient, ModbusSerialClient
from pymodbus.constants import Endian
from pymodbus.payload import BinaryPayloadDecoder
from urllib3.util import parse_url
@@ -72,8 +74,8 @@ class ModbusClient:
def __read_registers(self, read_register_method: Callable,
address: int,
types: Union[Iterable[ModbusDataType], ModbusDataType],
- byteorder: Endian = Endian.Big,
- wordorder: Endian = Endian.Big,
+ byteorder: Endian = Endian.BIG,
+ wordorder: Endian = Endian.BIG,
**kwargs):
try:
multi_request = isinstance(types, Iterable)
@@ -103,45 +105,45 @@ class ModbusClient:
raise Exception(__name__+" "+str(type(e))+" " + str(e)) from e
@overload
- def read_holding_registers(self, address: int, types: Iterable[ModbusDataType], byteorder: Endian = Endian.Big,
- wordorder: Endian = Endian.Big, **kwargs) -> List[Number]:
+ def read_holding_registers(self, address: int, types: Iterable[ModbusDataType], byteorder: Endian = Endian.BIG,
+ wordorder: Endian = Endian.BIG, **kwargs) -> List[Number]:
pass
@overload
- def read_holding_registers(self, address: int, types: ModbusDataType, byteorder: Endian = Endian.Big,
- wordorder: Endian = Endian.Big, **kwargs) -> Number:
+ def read_holding_registers(self, address: int, types: ModbusDataType, byteorder: Endian = Endian.BIG,
+ wordorder: Endian = Endian.BIG, **kwargs) -> Number:
pass
def read_holding_registers(self, address: int,
types: Union[Iterable[ModbusDataType], ModbusDataType],
- byteorder: Endian = Endian.Big,
- wordorder: Endian = Endian.Big,
+ byteorder: Endian = Endian.BIG,
+ wordorder: Endian = Endian.BIG,
**kwargs):
return self.__read_registers(
self.delegate.read_holding_registers, address, types, byteorder, wordorder, **kwargs
)
@overload
- def read_input_registers(self, address: int, types: Iterable[ModbusDataType], byteorder: Endian = Endian.Big,
- wordorder: Endian = Endian.Big,
+ def read_input_registers(self, address: int, types: Iterable[ModbusDataType], byteorder: Endian = Endian.BIG,
+ wordorder: Endian = Endian.BIG,
**kwargs) -> List[Number]:
pass
@overload
- def read_input_registers(self, address: int, types: ModbusDataType, byteorder: Endian = Endian.Big,
- wordorder: Endian = Endian.Big, **kwargs) -> Number:
+ def read_input_registers(self, address: int, types: ModbusDataType, byteorder: Endian = Endian.BIG,
+ wordorder: Endian = Endian.BIG, **kwargs) -> Number:
pass
def read_input_registers(self, address: int,
types: Union[Iterable[ModbusDataType], ModbusDataType],
- byteorder: Endian = Endian.Big,
- wordorder: Endian = Endian.Big,
+ byteorder: Endian = Endian.BIG,
+ wordorder: Endian = Endian.BIG,
**kwargs):
return self.__read_registers(self.delegate.read_input_registers, address, types, byteorder, wordorder, **kwargs)
@overload
- def read_coils(self, address: int, types: Iterable[ModbusDataType], byteorder: Endian = Endian.Big,
- wordorder: Endian = Endian.Big,
+ def read_coils(self, address: int, types: Iterable[ModbusDataType], byteorder: Endian = Endian.BIG,
+ wordorder: Endian = Endian.BIG,
**kwargs) -> List[bool]:
pass
Ich empfehle ausserdem in der service definition der openwb2 das restart=always zu kommentieren, da sonst ständig das atreboot.sh neu ausgeführt wird.