Skip to content

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

Merged
janiversen merged 1 commit intopymodbus-dev:devfrom
FedericoMusa:fix/simulator-startup-warning
Feb 11, 2026
Merged

fix: add warning log when using internal default simulator config#2874
janiversen merged 1 commit intopymodbus-dev:devfrom
FedericoMusa:fix/simulator-startup-warning

Conversation

@FedericoMusa
Copy link
Contributor

@FedericoMusa FedericoMusa commented Feb 10, 2026

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.

@janiversen janiversen merged commit c881867 into pymodbus-dev:dev Feb 11, 2026
1 check passed
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