Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: add warning log when using internal default simulator config #2874

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

Open
FedericoMusa wants to merge 1 commit into pymodbus-dev:dev
base: dev
Choose a base branch
Loading
from FedericoMusa:fix/simulator-startup-warning

Conversation

@FedericoMusa
Copy link
Contributor

@FedericoMusa FedericoMusa commented Feb 10, 2026
edited
Loading

Description

Following up on the discussion in PR #2880 regarding simulator persistence and onboarding.

While the simulator provides a great "zero-config" experience, starting it without a user-provided JSON file often leads to confusion when clients attempt to request data from non-existent registers.

This PR adds a proactive warning in the entry point logic:

  • Detects if the internal setup.json is being used as a fallback.
  • Logs a WARNING indicating that a demo configuration is active.
  • Provides explicit instructions on how to load a custom configuration using --json_file.

Technical Changes

  • Modified pymodbus/server/simulator/main.py: Added logic check in get_commandline after logging initialization to ensure the warning is formatted correctly according to the user's log level.

Testing

-OS: Windows 11 Enterprise LTSC.

Shell: MINGW64 (Git Bash) / PowerShell Core.

  • Running pymodbus.simulator now correctly triggers the warning logs.
  • Running with a custom --json_file bypasses the warning as expected.
image

Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

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

LGTM,thanks.

FedericoMusa reacted with rocket emoji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@janiversen janiversen janiversen approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /