Skip to content

Conversation

@woopstar
Copy link
Owner

@woopstar woopstar commented Sep 9, 2025

This refactor simplifies and stabilizes the _async_fetch_entity_states function by introducing a unified helper method for reading entity states.

Key improvements:

  • Added _read_entity helper to standardize state fetching and error handling.
  • Each entity is processed independently, ensuring one failure does not block the others.
  • self._missing_input_entities_list is now reset at the start and filled with descriptive error messages.
  • Clear distinction between missing entities and failed reads/conversions.
  • Improved log messages to aid debugging and monitoring.
  • Special handling for TOU charging/discharging periods remains, but now includes better error reporting.

Benefits:

  • Cleaner, more maintainable code.
  • Easier troubleshooting when entities are misconfigured or unavailable.
  • Improved resilience: partial data is still processed even when some entities fail.

Fixes #153

@woopstar woopstar added this to the 3.5 milestone Sep 9, 2025
@woopstar woopstar self-assigned this Sep 9, 2025
@woopstar woopstar added enhancement New feature or request minor Bump minor version number size/M Denotes a PR that changes 30-99 lines labels Sep 9, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 9, 2025

@woopstar woopstar merged commit e524026 into main Sep 9, 2025
18 checks passed
@woopstar woopstar deleted the improve-missing-entities branch September 9, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request minor Bump minor version number size/M Denotes a PR that changes 30-99 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enhancement: When input sensors are failing - report them in the attributes

2 participants