-
-
Notifications
You must be signed in to change notification settings - Fork 37.9k
Issue warning modbus configuration when modbus configuration is empty #112618
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -370,12 +370,14 @@ def validate_entity( | |
| if not validate_modbus(hub, hub_name_inx): | ||
| del config[hub_inx] | ||
| continue | ||
| minimum_scan_interval = 9999 | ||
| no_entities = True | ||
| for component, conf_key in PLATFORMS: | ||
| if conf_key not in hub: | ||
| continue | ||
| no_entities = False | ||
| entity_inx = 0 | ||
| entities = hub[conf_key] | ||
| minimum_scan_interval = 9999 | ||
| while entity_inx < len(entities): | ||
| if not validate_entity( | ||
| hub[CONF_NAME], | ||
|
|
@@ -388,7 +390,11 @@ def validate_entity( | |
| del entities[entity_inx] | ||
| else: | ||
| entity_inx += 1 | ||
|
|
||
| if no_entities: | ||
| err = f"Modbus {hub[CONF_NAME]} is instable without entities, please add entities!" | ||
| _LOGGER.warning(err) | ||
| # Ensure timeout is not started/handled. | ||
| hub[CONF_TIMEOUT] = -1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So for whom would this log message be? Because if someone adds this to support a custom integration, the message to "please add entities!" doesn't really make sense, since the custom integration is doing this for them. In what way will it be unstable? Maybe sentences like: "There are no entities defined for {something}. Ignoring timeout."
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The text is for the end-user who uses the integration, and even if the custom integration adds entities, we have no idea how (and do not want to know), so we have no way of knowing if the integration continues to be unstable. The only valid option is to add at least one entity (some custom components are now, finally, starting to recommend that). I have tried to adjust the text along your suggestion. WDYT ? |
||
| if hub[CONF_TIMEOUT] >= minimum_scan_interval: | ||
| hub[CONF_TIMEOUT] = minimum_scan_interval - 1 | ||
| _LOGGER.warning( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.