If not all DB records are received, try one-by-one #531
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.
Also, improve DeviceDbGet & DeviceRefresh test coverage.
Proposed change
Thanks for considering this PR!
This PR changes the DeviceRefresh handling so that, after attempting a bulk database download (with DeviceDbGet), if the database is incomplete, Insteon-MQTT will attempt to retrieve the missing DB entries one-by-one.
This feature was previously proposed by @krkeegan in this message on #233:
The one-by-one downloading is performed in DeviceScanManagerI2, to reduce the effect of the added complexity on the rest of the DeviceRefresh/DebiceDbGet code.
Notably, this one-by-one fallback approach appears to be the same technique employed by pyinsteon (which is used by Home Assistant's native Insteon integration).
Flake8 passes without errors, pylint shows no new warnings, and all new code is shown as covered by pytest coverage report. Also, DeviceDbGet and DeviceRefresh are now listed as 100% covered.
Additional information
Example force-refresh output for a particularly persnickety device is attached (device ID's have been changed to so as not to dox innocent devices):
Checklist
If user exposed functionality or configuration variables are added/changed: