Skip to content

refactor: parallelizing sensor fetches for improved loading performance#262

Merged
ardevd merged 2 commits into
mainfrom
parallel-sensor-fetches
Feb 25, 2026
Merged

refactor: parallelizing sensor fetches for improved loading performance#262
ardevd merged 2 commits into
mainfrom
parallel-sensor-fetches

Conversation

@ardevd

@ardevd ardevd commented Feb 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

@ardevd ardevd self-assigned this Feb 25, 2026
Copilot AI review requested due to automatic review settings February 25, 2026 16:09
@ardevd ardevd added the enhancement New feature or request label Feb 25, 2026

Copilot AI 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.

Pull request overview

This pull request refactors the get_dimo_sensor_data method to parallelize sensor fetches using asyncio.gather, improving loading performance when multiple sensors need to be fetched. The change is part of an optimization effort to reduce initialization time by fetching sensor data concurrently rather than sequentially.

Changes:

  • Refactored get_dimo_sensor_data to use parallel execution with asyncio.gather instead of sequential fetches
  • Introduced a nested fetch_sensor function to handle individual sensor fetches
  • Updated the method's docstring to reflect the parallel execution behavior
Comments suppressed due to low confidence (1)

custom_components/dimo/init.py:190

  • When hasattr returns False, the new implementation stores None in self.dimo_data[key], whereas the previous implementation would not store any value for that key. While this behavior change is likely acceptable since entity code handles both missing keys and None values identically (using .get()), it's worth verifying this is intentional. Consider only storing the value if result is not None to maintain the previous behavior more closely.
        for key, value in results:
            self.dimo_data[key] = value

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread custom_components/dimo/__init__.py
Comment thread custom_components/dimo/__init__.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@redbird-sonarqube

Copy link
Copy Markdown

@ardevd ardevd merged commit be0fa9f into main Feb 25, 2026
6 checks passed
@ardevd ardevd deleted the parallel-sensor-fetches branch February 25, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants