Repository navigation
Component start order fixes - #2832
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a phased component initialization approach to resolve start order dependencies. Components are now initialized and started in two phases (phase 0 and phase 1), with phase 0 handling core infrastructure components and phase 1 handling components that depend on configuration resolution. The changes also improve error handling when configuration entities cannot be resolved.
Key Changes
- Implemented two-phase component initialization (phase 0 for core components, phase 1 for components requiring resolved configuration)
- Added error handling for sensor value conversion in Solcast integration
- Modified
auto_configto support a final pass after all components are initialized
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/predbat/components.py | Added phase property to all components and updated initialize/start methods to filter by phase |
| apps/predbat/predbat.py | Modified initialization to call component initialize/start in two phases and perform final auto_config |
| apps/predbat/userinterface.py | Added final parameter to auto_config to control warning behavior and removed dead debugging code |
| apps/predbat/solcast.py | Added error handling for sensor value conversion and clarified variable naming |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| data, total_data, total_sensor = self.fetch_pv_datapoints(argname, arg_value) | ||
| # We have to re-get the arg here as the regexp wouldn't be resolved earlier | ||
| entity_id = getattr(self, argname, None) | ||
|
|
There was a problem hiding this comment.
Trailing whitespace should be removed from this blank line for consistency with coding standards.
No description provided.