Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proprietary Modbus function and use of rawRequest/rawResponce #279

Open
arinci opened this issue Mar 28, 2023 · 1 comment
Open

Proprietary Modbus function and use of rawRequest/rawResponce #279

arinci opened this issue Mar 28, 2023 · 1 comment

Comments

@arinci
Copy link

arinci commented Mar 28, 2023

Hi, I'm using with great satisfaction this little gem of library.
I have a request regarding an issue I was not able to solve by myself. I need to send a message with proprietary Modbus function code 0x41, as this special function code is used in Huawei inverters for many things (file upload/download, authentication, etc).
This function code is used in other open source libraries to perform user authentication through Modbus protocol. An example of this is contained in huawei_solar.py python files (source code available here: https://pypi.org/project/huawei-solar/#files).

I thought it was quite easy to fill a buffer with the proprietary sequence of bytes, call the rawRequest to send buffer to the device (leaving the job to create the MBAP header that prepends the buffer to the rawRequest function) and wait for a response from device with rawResponce (or even better use a callback). But I was not able to get a reply from Huawei inverter.

Emilianov (and others guru), any suggestion? Do you think is it possible to use this library for this kind of job?
Thanks!

@arinci
Copy link
Author

arinci commented Apr 6, 2023

I add here a little example of what I'm searching to do with modbus-esp8266 library.
Using ModbusPoll (https://www.modbustools.com/modbus_poll.html) I was able to send a custom proprietary request to the modbus device (using 'Test-Center' functionality), and get a response back.

This is a little extract of data communication:

Tx:AA AA 00 00 00 06 00 41 24 02 01 00
Rx:AA AA 00 00 00 15 00 41 24 11 70 8D 80 C0 F0 F7 10 0E 6F 44 B1 77 E1 64 AF CB 01

In TX we have MBAP header (first 7 bytes), the remaining bytes are for a request using function code 0x41, subcommands 0x24, length is 0x2 bytes, payload is 0x01 and 0x00.
With this request the modbus device reply with the message in second row.

Is possible to do this kind of proprietary modbus request (and process the reply from the slave device) using modbus-esp8266 library? If yes, is it possible to have a little help or an example?

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants