Skip to content

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

Open
Herbertmt978 wants to merge 3 commits into
edge-mining:mainfrom
Herbertmt978:Herb/allow-partial-ha-forecast-config
Open

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

Conversation

@Herbertmt978

@Herbertmt978 Herbertmt978 commented Jul 13, 2026

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 any non-empty subset of its forecast entity IDs.
  • Reject an all-empty configuration so the application cannot install a provider that can only return an empty forecast.
  • Add regression tests for both the partial and all-empty cases.

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.

The builder now accepts partial configurations while still requiring at least one usable forecast entity.

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 tests/unit/adapters/domain/forecast/test_home_assistant_api.py -q — 2 passed.
  • python -m pytest tests/unit -q — 619 passed.
  • python -m ruff format --check edge_mining tests — 394 files already formatted.
  • python -m ruff check edge_mining — passed.
  • python -m pytest tests -q — 665 passed, with 5 Windows-only persistence teardown errors. Each error was PermissionError: [WinError 32] while deleting a temporary SQLite database that was still open; the affected integration cleanup paths are outside this change.
  • The latest upstream CI run is waiting for maintainer approval because this branch comes from a fork.

@GitGab19
GitGab19 requested a review from markoceri July 17, 2026 14:15
@Herbertmt978
Herbertmt978 marked this pull request as ready for review July 27, 2026 22:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fe8bb7efa3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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