Skip to content

Add component error tracking and web UI display#3069

Merged
springfall2008 merged 1 commit intomainfrom
fixes11
Dec 15, 2025
Merged

Add component error tracking and web UI display#3069
springfall2008 merged 1 commit intomainfrom
fixes11

Conversation

@springfall2008
Copy link
Owner

Summary

This PR adds comprehensive error tracking for all Predbat components with visual display in the web UI.

Changes

Component Base Class (component_base.py)

  • Added get_error_count() method to return error count for each component
  • Enhanced error handling in start() loop to call non_fatal_error_occurred() on failures
  • Added non_fatal_error_occurred() method to notify base system of errors
  • Error counter (count_errors) is incremented on both run failures and exceptions

Components Class (components.py)

  • Added get_error_count(name) method to retrieve error counts for specific components
  • Includes proper null checks for component existence and attribute availability

Output Module (output.py)

  • Enhanced record_status() method to track and persist error count in status entity attributes
  • Error count increments on each error occurrence and persists across restarts

Main Predbat (predbat.py)

  • Added component_error_count tracking in component health monitoring
  • Component error counts are included in predbat.components entity attributes

Web Interface (web.py)

  • Added error count display to component cards on the Components page
  • Color-coded display: green for 0 errors, red for >0 errors
  • Only displays when error count is available

Web Helper CSS (web_helper.py)

  • Added .error-count-none class (green) for components with no errors
  • Added .error-count-high class (red) for components with errors
  • Includes both light and dark mode styling

Octopus API (octopus.py)

  • Removed noisy debug logging from run method

Features

  • ✅ Real-time error tracking for all components
  • ✅ Visual feedback in web UI with color coding
  • ✅ Persistent error count storage in entity attributes
  • ✅ Dark mode support for UI elements
  • ✅ Defensive programming with null checks throughout

Testing

  • ✅ All pre-commit checks passed
  • ✅ All unit tests passed (5.12s total)
  • ✅ Manual testing confirmed error counts display correctly

Screenshots

Error counts are displayed on each component card in the Components view, providing immediate visibility into component health and making it easier to identify components experiencing issues.

- Add get_error_count() method to ComponentBase for tracking errors
- Enhance error handling in component start() loop to count failures
- Add non_fatal_error_occurred() method to notify base system
- Add get_error_count() method to Components class
- Display error count on component cards in web UI with color coding
- Add error_count to status entity attributes for persistence
- Add component_error_count to predbat.components entity
- Add CSS styling for error count display (light and dark mode)
- Remove debug logging from Octopus API run method

Error counts are displayed in green (0 errors) or red (>0 errors) on
the Components page, providing immediate visual feedback on component health.
Copy link
Contributor

Copilot AI left a comment

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 adds comprehensive error tracking for Predbat components with visual display in the web UI. The implementation tracks both component-level errors (new) and enhances the main status error count to persist across restarts. Error counts are displayed in the web interface with color coding (green for no errors, red for errors) to provide immediate visibility into component health.

Key Changes

  • Component error tracking infrastructure in ComponentBase with automatic increment on run failures and exceptions
  • Error count retrieval methods in Components class with defensive null checks
  • Enhanced web UI to display component error counts with color-coded visual feedback

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
apps/predbat/component_base.py Added get_error_count() method and error tracking in start() loop with non_fatal_error_occurred() notification
apps/predbat/components.py Added get_error_count(name) method to retrieve component error counts with null safety checks
apps/predbat/output.py Enhanced record_status() to persist main status error count across restarts
apps/predbat/predbat.py Integrated component error counts into health monitoring and entity attributes
apps/predbat/web.py Added error count display to component cards with conditional color coding
apps/predbat/web_helper.py Added CSS classes for error count styling in both light and dark modes
apps/predbat/octopus.py Removed noisy debug logging from run method

@springfall2008 springfall2008 merged commit c637756 into main Dec 15, 2025
7 checks passed
@springfall2008 springfall2008 deleted the fixes11 branch December 15, 2025 08:13
iangregory pushed a commit to iangregory/batpred that referenced this pull request Dec 24, 2025
- Add get_error_count() method to ComponentBase for tracking errors
- Enhance error handling in component start() loop to count failures
- Add non_fatal_error_occurred() method to notify base system
- Add get_error_count() method to Components class
- Display error count on component cards in web UI with color coding
- Add error_count to status entity attributes for persistence
- Add component_error_count to predbat.components entity
- Add CSS styling for error count display (light and dark mode)
- Remove debug logging from Octopus API run method

Error counts are displayed in green (0 errors) or red (>0 errors) on
the Components page, providing immediate visual feedback on component health.
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.

1 participant