Disable device availability checker during diagnostics regeneration#682
Disable device availability checker during diagnostics regeneration#682TheJulianJES wants to merge 1 commit intozigpy:devfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #682 +/- ##
=======================================
Coverage 97.51% 97.51%
=======================================
Files 62 62
Lines 10949 10949
=======================================
Hits 10677 10677
Misses 272 272 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| # asynchronously mutate device availability while fixtures are being written. | ||
| zha_gateway.global_updater.stop() | ||
| zha_gateway._device_availability_checker.stop() # noqa: SLF001 | ||
| zha_gateway.config.allow_polling = False |
There was a problem hiding this comment.
zha_gateway.config.allow_polling will be set to True by fetch_updated_state:
zha/zha/application/gateway.py
Line 389 in 9d03d63
With #654, we make sure to run that before regenerating diagnostics but that also means it'll re-enable allow_polling still. So that's why we also stop the global_updater and _device_availability_checker to fix the issue.
Maybe we should just patch out fetch_updated_state entirely for diagnostics. EDIT: Eh, also not possible in a nice way.
There was a problem hiding this comment.
If we'd set allow_polling = False after this line, it should work without needing to stop the global_updater and _device_availability_checker:
zha/tools/import_diagnostics.py
Line 327 in 9d03d63
Hmm...
Proposed change
This disable device availability checker during diagnostics regeneration.
At the moment, there's a rare issue where you can manage to regenerate diagnostics with
availablebeing set tofalseeverywhere, as the checker starts after 30 to 45 seconds of running diagnostics regeneration.It's possible that the implementation can be cleaned up. Just wanted to put it into a PR for now.