Skip to content

Component start order fixes - #2832

Merged
springfall2008 merged 3 commits into
mainfrom
refactor4
Oct 26, 2025
Merged

springfall2008 merged 3 commits into
mainfrom
refactor4

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_config to 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.

Comment thread apps/predbat/userinterface.py
Comment thread apps/predbat/solcast.py Outdated
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)

Copilot AI Oct 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace should be removed from this blank line for consistency with coding standards.

Suggested change

Copilot uses AI. Check for mistakes.
@springfall2008
springfall2008 merged commit 2064fdf into main Oct 26, 2025
1 check passed
@springfall2008
springfall2008 deleted the refactor4 branch October 26, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants