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

How do you access the raw (bytes) response for decoding messages that aren't composed of 16-bit integers? #111

Open
fake-name opened this issue Jan 20, 2021 · 2 comments

Comments

@fake-name
Copy link

Effectively the title. I have a device that packs 32-bit floats into two sequential registers.

Currently, there seems to be no way to get anything but the already decoded 16-bit integer sequence.

I can re-pack the return data from umodbus.client.serial.rtu.send_message() into a byte-array, and then re-decode that using the device's structure, bit that seems asinine given that all I really need is uModbus to not do the (in this application incorrect) decode step.

I spent a bit of time looking into potentially just replacing send_message() with a version that still does the CRC check and message trimming, but not the decode, but it appears that separating the message validation and trimming from the decoding is sufficiently annoying that I can't see this as anything other then a bug.

How do I get the raw response the modbus device returns without having to re-pack the data into a bytearray?

@azat385
Copy link

azat385 commented Jun 30, 2021

is it possible to get response ADU from send_message?

def send_message(adu, serial_port):

@johanvdw
Copy link

I also think it would be a good idea to allow setting the datatype in send_message, to allow decoding into something different than uint16 or int16 (depending on conf.SIGNED_VALUES).

In general I actually think that setting conf.SIGNED_VALUES is not a good practice, because changing that value globally is not ideal when you want to support different devices.

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

No branches or pull requests

3 participants