You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the condition above, the returned value after the WriteSingleRegisterRequest is always 0 and this will fail the command in the management application.
What is the correct way to fix this issue ? I have removed the condition for the test and the command is now executed successfully. Unfortunately I dont think, this is correct, because the program now executes the command to write the register value, then read its state back. AFAIK this shouldnt be necessary and the current state of the register is contained in the response on the RTU side.
Am I missing something, or is it a bug ?
The text was updated successfully, but these errors were encountered:
please add a debug log (using the pymodbus call) so we can see what happens.
The serial forwarder should forward the requests and pass the responses, however this is a very limited forwarder a real forwarder works at frame level and passes frames back and forth. We have for a long time wanted to make a real forwarder but never had the time to do so.
Steps to reproduce
serial_forwarder
from https://git.1-hub.cnpymodbus-dev/pymodbus/blob/dev/examples/contrib/serial_forwarder.pymodbus
command towrite_single_register
- for Goodwe inverterRTU
is okTCP
side is corruptedEvidences
RTU
side is as expected, enable (on) the switch0xf7 0x6 0xb9 0xec 0x0 0x1 0xb8 0x35
0xf7 0x6 0xb9 0xec 0x0 0x1 0xb8 0x35
0x0 0x1
starting on the 5th byteTCP
side is corrupted, as the packet is encoded like0x82 0xcc 0x0 0x0 0x0 0x6 0xf7 0x6 0xb9 0xec 0x0 0x1
0x82 0xcc 0x0 0x0 0x0 0x6 0xf7 0x6 0xb9 0xec 0x0 0x0
0x0 0x1
in request, two bytes from the end of the packet0x0 0x0
in the response, the last two bytesThe reason (in the code), why
pymodbus
works like this is in the code, where the condition makes to alwaysreturn [0]
.pymodbus/pymodbus/datastore/remote.py
Lines 34 to 41 in b4cecc3
Datastore is called during the execution of the
execute
inWriteSingleRegisterRequest
object.pymodbus/pymodbus/pdu/register_message.py
Lines 181 to 194 in b4cecc3
Due to the condition above, the returned value after the
WriteSingleRegisterRequest
is always0
and this will fail the command in the management application.What is the correct way to fix this issue ? I have removed the condition for the test and the command is now executed successfully. Unfortunately I dont think, this is correct, because the program now executes the command to write the register value, then read its state back. AFAIK this shouldnt be necessary and the current state of the register is contained in the response on the
RTU
side.Am I missing something, or is it a bug ?
The text was updated successfully, but these errors were encountered: