Modbus: fix delay and timeout handling - #32694
Merged
Merged
Conversation
Templates that deprecated their own delay or timeout param in favour of the modbus definition rendered no value at all. Deprecated params are pre-populated with an empty default which was treated as a user-supplied value.
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
ModbusValues, thev != nil && v != ""guard now treats any non-nil, non-empty-string value as a user override, which means zero-values of non-string types (e.g.0,false) will also block default propagation; if the params are expected to be strings only, consider making that explicit with a type assertion or a type switch so that future non-string params don't accidentally rely on this behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `ModbusValues`, the `v != nil && v != ""` guard now treats any non-nil, non-empty-string value as a user override, which means zero-values of non-string types (e.g. `0`, `false`) will also block default propagation; if the params are expected to be strings only, consider making that explicit with a type assertion or a type switch so that future non-string params don't accidentally rely on this behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
andig
enabled auto-merge (squash)
August 10, 2026 14:37
Delay, connect delay and timeout apply to the physical connection which is shared between all logical connections of the same uri or device, including the modbus proxy. Keep the largest requested value instead of letting the last writer win.
This was referenced Aug 10, 2026
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.
Regression from #31996, found while investigating #32687.
Templates that deprecated their own
delay/timeoutparam in favour of the modbus definition rendered no value at all, so the affected devices silently fell back to the modbus library default of 3s instead of their device-specific value. On top of that, delay and timeout are properties of the physical connection, which is shared between all logical connections of the same uri or device, so the last configured device used to overrule all others.timeout: 15sfor huawei-sun2000-inverter anddelay: 100msfor wattsonic, in rendered configs, docs and config UI defaults alikedelayortimeout, among them the huawei-sun2000, solaredge, sungrow and saj templates🤖 Generated with Claude Code