How to read file record (0x14)? #2404
-
I missed some example for this. But i tried something. This gives me successfully that what i want in the logging. But there ist no hint to use the result. Where is the file? from pymodbus.constants import Endian logging.basicConfig() client = ModbusTcpClient('192.168.178.27') logging: |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 11 replies
-
?? you send a request for a record of the file, not the whole file. Please read the modbus standard, it explains how to read files. The record is delivered back in response, but I wonder why you use execute instead of the API available. |
Beta Was this translation helpful? Give feedback.
-
Also I am puzzled why do you use a FileRecord as parameter to the request pdu, that is not correct (FileRecord is in the response object) You might not want to use the simpler call file_read_record, which is a shame, because it actually defines the parameters needed. |
Beta Was this translation helpful? Give feedback.
-
Please remember your device might also respond with no records, which is stored in another object variable....you really need to see FileReadRecordResponse with the corresponding page in the modbus standard. you write: This is simple: but it seem you made it a lot less simple, calling the BinaryPayloadDecodder is not correct, and on some CPUs very wrong. |
Beta Was this translation helpful? Give feedback.
-
Thanks, debugging does the thing. I have the values. |
Beta Was this translation helpful? Give feedback.
-
Maybe this or something similar can go to the examples. It is for Sentron Pac2200: from pymodbus.constants import Endian client = ModbusTcpClient('IP-Adress') |
Beta Was this translation helpful? Give feedback.
I think the problem is not the example, but more what you want to achieve, normally apps only read the records they are interested in, typically it does not make sense to read all records, and even less to make a real file.
You handle the FileReadRecordRequest class, so what is the problem in handling the FileReadRecordRespomse class, which is what you get back.
Not knowing, sounds like you have not read our documentation, there all calls are documented with parameters.
The content of the file records are highly vendor dependent, so an example would only be able to print the hex information, as we already do in the log,