Skip to content

Raise NoSuchIdException for unknown device id in SimCore. - #3086

Merged
janiversen merged 1 commit into
pymodbus-dev:devfrom
cyberchitta:fix-simcore-missing-device
Nov 11, 2026
Merged

janiversen merged 1 commit into
pymodbus-dev:devfrom
cyberchitta:fix-simcore-missing-device

Conversation

@restlessronin

Copy link
Copy Markdown
Contributor

SimCore.__get_device falls back to self.devices[0] even when no device 0 exists, so an unknown device id raises KeyError and the server answers 0x04. The request handler expects NoSuchIdException, so it never answers 0x0B, and ignore_missing_devices has no effect.

This restores the old ModbusServerContext lookup: the id, else device 0, else NoSuchIdException. Tests added in test_simcore.py.

🤖 Generated with Claude Code - reviewed by @restlessronin

Co-authored-by: Claude Opus 5.5 <claude-opus-5.5@claude-cli>

@janiversen janiversen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@janiversen
janiversen merged commit b6d6c46 into pymodbus-dev:dev Nov 11, 2026
16 checks passed
@restlessronin
restlessronin deleted the fix-simcore-missing-device branch November 12, 2026 05:37
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

Successfully merging this pull request may close these issues.

2 participants