|
7 | 7 |
|
8 | 8 | from pymodbus.datastore import ModbusSlaveContext |
9 | 9 | from pymodbus.exceptions import NotImplementedException |
10 | | -from pymodbus.logging import Log |
11 | 10 |
|
12 | 11 |
|
13 | 12 | class ModbusPDU: |
@@ -57,7 +56,7 @@ def verifyAddress(self, address: int = -1) -> None: |
57 | 56 | raise ValueError(f"0 < address {address} < 65535 !") |
58 | 57 |
|
59 | 58 | def __str__(self) -> str: |
60 | | - """Build a representation of an exception response.""" |
| 59 | + """Build a representation of a Modbus response.""" |
61 | 60 | return ( |
62 | 61 | f"{self.__class__.__name__}(" |
63 | 62 | f"dev_id={self.dev_id}, " |
@@ -126,7 +125,15 @@ def __init__( |
126 | 125 | super().__init__(transaction_id=transaction, dev_id=slave) |
127 | 126 | self.function_code = function_code | 0x80 |
128 | 127 | self.exception_code = exception_code |
129 | | - Log.error(f"Exception response {self.function_code} / {self.exception_code}") |
| 128 | + |
| 129 | + def __str__(self) -> str: |
| 130 | + """Build a representation of an exception response.""" |
| 131 | + return ( |
| 132 | + f"{self.__class__.__name__}(" |
| 133 | + f"dev_id={self.dev_id}, " |
| 134 | + f"function_code={self.function_code}, " |
| 135 | + f"exception_code={self.exception_code})" |
| 136 | + ) |
130 | 137 |
|
131 | 138 | def encode(self) -> bytes: |
132 | 139 | """Encode a modbus exception response.""" |
|
0 commit comments