@@ -186,7 +186,10 @@ def execute(self, no_response_expected: bool, request: ModbusPDU): # noqa: C901
186
186
ModbusTransactionState .to_string (self .client .state ),
187
187
)
188
188
retries = self .retries
189
- request .transaction_id = self .getNextTID ()
189
+ if isinstance (self .client .framer , FramerSocket ):
190
+ request .transaction_id = self .getNextTID ()
191
+ else :
192
+ request .transaction_id = 0
190
193
Log .debug ("Running transaction {}" , request .transaction_id )
191
194
if _buffer := hexlify_packets (
192
195
self .client .framer .databuffer
@@ -241,7 +244,7 @@ def execute(self, no_response_expected: bool, request: ModbusPDU): # noqa: C901
241
244
self .addTransaction (pdu )
242
245
if not (result := self .getTransaction (request .transaction_id )):
243
246
if len (self .transactions ):
244
- result = self .getTransaction (tid = 0 )
247
+ result = self .getTransaction (0 )
245
248
else :
246
249
last_exception = last_exception or (
247
250
"No Response received from the remote slave"
@@ -250,7 +253,7 @@ def execute(self, no_response_expected: bool, request: ModbusPDU): # noqa: C901
250
253
result = ModbusIOException (
251
254
last_exception , request .function_code
252
255
)
253
- self .client .close ()
256
+ self .client .close ()
254
257
if hasattr (self .client , "state" ):
255
258
Log .debug (
256
259
"Changing transaction state from "
0 commit comments