Should ReadHoldingRegistersReponse contain the address of the resister that was asked for? #2612
Replies: 3 comments 4 replies
-
That is correct, the address is not used in clients but only in server. In a client you do not need to know it, because it is response to your request, so you have the address at hand. |
Beta Was this translation helpful? Give feedback.
-
Asyncio gather, will not help you, pymodbus treats the call one by one, so first call is served and the rest waiting on an asyncio.lock This correspond to the modbus protocol which is a request/response type. |
Beta Was this translation helpful? Give feedback.
-
Thanks for this, I did not realise that the modbus protocol meant that the Modbus server could not handle multiple requests at once. After some quick testing, I actually determined that in my case when using Modbus TCP and whatever devices I have, the sync client is actually quicker, and using async gather method actually the slowest while being the most cumbersome to code, therefore I will just go to using the sync client which will solve my problem of knowing the address much easier when decoding the return messages. Thanks fr your help. |
Beta Was this translation helpful? Give feedback.
-
I am using Read Holding Register and pass the address 550 for example. The repsonse is of type ReadHoldingRegistersResponse which contains the correct dev_id and accurate value of the registers and status=1. However the address is 0.
I am using one async call (asyncio.gather) to read multiple slaves with multiple different registers on each slave, so am looking for a way to easily relate the reply with what device and register. I was wondering if the response should contain the address or if I need to do something so it will? So far I have a workaround that I just read the same registers from all devices so can iterate through them using an index but would be nice to optimise this.
Beta Was this translation helpful? Give feedback.
All reactions