Skip to content

fix(home-assistant): allow partial forecast entity configuration#56

Draft
Herbertmt978 wants to merge 1 commit into
edge-mining:mainfrom
Herbertmt978:Herb/allow-partial-ha-forecast-config
Draft

fix(home-assistant): allow partial forecast entity configuration#56
Herbertmt978 wants to merge 1 commit into
edge-mining:mainfrom
Herbertmt978:Herb/allow-partial-ha-forecast-config

Conversation

@Herbertmt978

Copy link
Copy Markdown

Summary

Hi! This is a small backend-focused improvement related to #31.

  • Allow the Home Assistant forecast provider to initialize with only the entity IDs a user configured.
  • Add an async regression test that initializes a partially configured provider and fetches the available forecast data.

Why

The Home Assistant forecast schema presents its entity IDs as optional, and the provider already skips missing entities while returning the data that is available. Two builder guards still required the current-hour power and energy entities, so otherwise valid partial configurations failed during adapter initialization.

Removing those guards aligns initialization with the provider's existing partial-data behavior.

Scope

This intentionally stays small and backend-focused. It does not implement the broader form validation or UI status/error handling discussed in #31, and it is not intended to close #31.

Refs #31

Validation

  • python -m pytest core/tests/unit/adapters/domain/forecast/test_home_assistant_api.py -q — 1 passed.
  • python -m pytest core/tests/unit -q — 557 passed, 44 skipped (optional skforecast coverage was unavailable locally).
  • python -m ruff format --check edge_mining tests — 382 files already formatted.
  • python -m ruff check edge_mining — passed.
  • Intended-file pre-commit run — all applicable hooks passed.
  • python -m pytest core/tests -q — 603 passed and 44 skipped, but the command exited non-zero with 7 Windows-only persistence teardown errors. Each was PermissionError: [WinError 32] while deleting a still-open temporary SQLite database; these integration cleanup paths are outside this change.

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.

Forecast Provider (Home Assistant Api): optional entity fields cause runtime errors when partially filled

1 participant