Deprecated payloader and simple solution. #2525
Replies: 2 comments 5 replies
-
Thanks for the extra information and a very useful library! :) I'm updating my script to use 3.8 and the deprecation messages are all over the place.
Since it's not obvious for me how to fix this (use convert_[to_from]_registers?) in order to make my console clean and prepare for 3.9, I tried to consult the example I used in the past: https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/client_payload.py but it still uses I'm certain that that example will be updated by the release of 3.9, but in the meantime is there a way to suppress these messages? (I realise that this might not be a library thing, but my other suppression attempts did not work and you'd know the best solution.) Many thanks. |
Beta Was this translation helpful? Give feedback.
-
You are using the binary payload for the server, this is a very old fashioned way (but it still works)... you could use the simulator datastore a lot more efficiently. word_order is WRONG !!! it does not take a list, but a single literal ("big" or "little"), I really wonder why your code works. Seems you try to specify byte_order as well. |
Beta Was this translation helpful? Give feedback.
-
The binary payloder have been marked as deprecated since v3.8.0 and will be removed in v3.9.0
There have been quite a number of questions on how to replace it, so I thought it better to make a formal answer:
with v3.8.x binarypayloader is still part of the library, however simple usage like e.g reading/writing int32,int64,float32,float64 and strings are easily converted with the new convert_to/from_registers and those should be used.
With v3.9.0 and beyond binarypayloader is no longer available, for apps the prefer to read/write a chunk of registers, convert_combined_to/from_registers will be available. These function accept a list of tuples (datatype, count) which are used to convert correctly.
With v3.9.0 apps that uses datatypes not matched by registers like e.g. int8 or bits less than 16 will need to do their own conversions.
The new functions will be available on dev/wait_next_api in good time before release of v3.9.0 to allow for testing or early conversion. Progress can be followed on open pull requests and/or dev.
Beta Was this translation helpful? Give feedback.
All reactions