Fix incorrect order of simdata tuple for SimDevice instantiation in ModbusDeviceContext.__init__#2952
Merged
janiversen merged 1 commit intoJul 2, 2026
Conversation
…ctor hr_simdata and ir_simdata should be swapped to match the documentation in SimDevice for the simdevice attribute: The tuple is defined as: (<coils>, <discrete inputs>, <holding registers>, <input registers>)
SimData instantiation in ModbusDeviceContext.__init__simdata tuple for SimDevice instantiation in ModbusDeviceContext.__init__
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The call to the constructor for
SimDatainsideModbusDeviceContextintroduced in #2897 appears to have an incorrect tuple order for thesimdataargument. This causes input registers to be swapped with holding registers in versions 3.13.0.pymodbus/pymodbus/datastore/context.py
Lines 62 to 64 in 25e72e8
Referring to the docs the last two elements should be holding registers followed by input registers.
-- https://pymodbus.readthedocs.io/en/latest/source/simulator/datamodel.html#pymodbus.simulator.SimDevice.simdata