Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement various new Core features #668

Merged
merged 22 commits into from
Jun 20, 2024
Merged

Implement various new Core features #668

merged 22 commits into from
Jun 20, 2024

Conversation

bouwew
Copy link
Contributor

@bouwew bouwew commented Jun 20, 2024

All changes:

  • Use entry.runtime_data as in Core Plugwise.
  • Improve init of update_listener.
  • Implement a new feature from HA Core config_entries.

Summary by CodeRabbit

  • Refactor

    • Improved internal configuration by standardizing PlugwiseConfigEntry usage across multiple components, simplifying setup and ensuring consistency.
  • Documentation

    • Updated CHANGELOG.md to reflect the ongoing implementation of new Core features for version 0.51.3.

Copy link
Contributor

coderabbitai bot commented Jun 20, 2024

Walkthrough

The recent updates to the Plugwise integration involve refactoring the handling of configuration entries across multiple files. The primary adjustment is shifting from using ConfigEntry to a custom PlugwiseConfigEntry type. This affects functions related to setting up entries, coordinating data, and accessing runtime metadata. Additionally, the change includes cleanup tasks such as removing obsolete code and constants.

Changes

Files Change Summary
.../custom_components/plugwise/__init__.py Refactored to use PlugwiseConfigEntry instead of ConfigEntry and updated function signatures.
.../plugwise/binary_sensor.py, .../plugwise/button.py, .../plugwise/climate.py, .../plugwise/number.py, .../plugwise/select.py, .../plugwise/sensor.py, .../plugwise/switch.py Refactored async_setup_entry to utilize PlugwiseConfigEntry and updated coordinator initialization.
.../plugwise/config_flow.py Adjusted imports, exception handling, and updated method/class signatures for configuration options handling.
.../plugwise/const.py Removed the UNDO_UPDATE_LISTENER constant.
.../plugwise/diagnostics.py Modified entry parameter type from ConfigEntry to PlugwiseConfigEntry and updated access to coordinator.
.../plugwise/entity.py Removed get_coordinator function and the COORDINATOR constant reference.
CHANGELOG.md Documented ongoing implementation of various new Core features in version 0.51.3.

Sequence Diagram(s)

Poem

Through codes and scripts, the changes weave,
A dance of bits, where entries interleave,
With Plugwise’s tune, components align,
And rabbits cheer, in joyous design.
Functions refined, old constants let go,
In this new harmony, our codes now glow. 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cd2b78a and f23bd33.

Files selected for processing (12)
  • custom_components/plugwise/init.py (4 hunks)
  • custom_components/plugwise/binary_sensor.py (3 hunks)
  • custom_components/plugwise/button.py (2 hunks)
  • custom_components/plugwise/climate.py (2 hunks)
  • custom_components/plugwise/config_flow.py (6 hunks)
  • custom_components/plugwise/const.py (1 hunks)
  • custom_components/plugwise/diagnostics.py (1 hunks)
  • custom_components/plugwise/entity.py (3 hunks)
  • custom_components/plugwise/number.py (3 hunks)
  • custom_components/plugwise/select.py (3 hunks)
  • custom_components/plugwise/sensor.py (4 hunks)
  • custom_components/plugwise/switch.py (3 hunks)
Files not reviewed due to errors (4)
  • custom_components/plugwise/diagnostics.py (no review received)
  • custom_components/plugwise/button.py (no review received)
  • custom_components/plugwise/entity.py (no review received)
  • custom_components/plugwise/switch.py (no review received)
Files skipped from review due to trivial changes (1)
  • custom_components/plugwise/const.py
Additional comments not posted (17)
custom_components/plugwise/select.py (3)

11-11: The import of PlugwiseConfigEntry aligns with the PR's objective to transition from ConfigEntry.


30-30: The import of PlugwiseEntity from .entity is consistent with the rest of the codebase and necessary for subclassing in PlugwiseSelectEntity.


73-73: The function signature and the assignment of coordinator have been updated to use PlugwiseConfigEntry and entry.runtime_data. This is in line with the PR's objectives and should ensure that the component is using the latest methods for accessing coordinator data.

Also applies to: 77-77

custom_components/plugwise/number.py (2)

16-16: The updates to the imports are consistent with the overall changes in the integration, ensuring that the components are using the updated PlugwiseConfigEntry and related classes.

Also applies to: 28-28


66-66: The changes to the function signature and coordinator access align with the new standards set by the integration for handling configuration entries and coordinators.

Also applies to: 70-70

custom_components/plugwise/__init__.py (3)

23-23: Introduction of PlugwiseConfigEntry as a type alias for ConfigEntry specialized with PlugwiseDataUpdateCoordinator is a good practice for type clarity and safety.


26-26: The function signature for async_setup_entry and the assignment of coordinator to entry.runtime_data are crucial updates that align with the new architectural decisions of using PlugwiseConfigEntry.

Also applies to: 44-44


74-74: Updates to the update_listener and async_unload_entry function signatures to use PlugwiseConfigEntry are appropriate and necessary for consistency across the integration.

Also applies to: 84-85, 90-90

custom_components/plugwise/binary_sensor.py (2)

18-18: The updated imports ensure that the binary sensor component uses the new PlugwiseConfigEntry and accesses the coordinator correctly, aligning with the integration's updated practices.

Also applies to: 35-35


93-93: The changes in the function signature for async_setup_entry and the way the coordinator is accessed are in line with the changes across other components of the integration, ensuring consistency and correctness.

Also applies to: 97-97

custom_components/plugwise/config_flow.py (4)

24-25: Correct and necessary updates to imports to support PlugwiseConfigEntry.


231-231: This broad exception handling should be refined to target specific exceptions for clearer error diagnostics.


260-260: Correct inheritance to align with the updated configuration handling requirements.


291-291: The updates to default values and handling in the configuration options are correctly implemented.

Also applies to: 304-304, 310-310

custom_components/plugwise/climate.py (2)

22-22: The import of PlugwiseConfigEntry and its usage in function signatures correctly align with the PR's objectives. Using entry.runtime_data simplifies data access patterns.

Also applies to: 57-57, 61-61


22-22: Implementation of HomeKit emulation settings using entry.options is a clean and effective approach, enhancing functionality.

Also applies to: 57-57, 61-61

custom_components/plugwise/sensor.py (1)

31-31: The import of PlugwiseConfigEntry and its usage in function signatures correctly align with the PR's objectives. Using entry.runtime_data simplifies data access patterns.

Also applies to: 458-458, 462-462

custom_components/plugwise/config_flow.py Show resolved Hide resolved
@bouwew bouwew changed the title Follow Core updating Implement various Core updates Jun 20, 2024
@bouwew bouwew changed the title Implement various Core updates Implement various new Core features Jun 20, 2024
@bouwew bouwew marked this pull request as ready for review June 20, 2024 10:04
@bouwew bouwew requested a review from a team as a code owner June 20, 2024 10:04
Copy link

sonarcloud bot commented Jun 20, 2024

@bouwew bouwew added the downstreaming Things that are changed on HA-core side and to be applied to -beta label Jun 20, 2024
@bouwew bouwew requested a review from CoMPaTech June 20, 2024 10:04
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f23bd33 and 7797635.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional context used
LanguageTool
CHANGELOG.md

[uncategorized] ~315-~315: Possible missing preposition found. (AI_HYDRA_LEO_MISSING_TO)
Context: ...ile P1: add support for 3-phase DMSR - Add 3-phase support, this requires P1 firmw...


[style] ~332-~332: Consider an alternative to strengthen your wording. (IMPROVEMENTS_REFINEMENTS)
Context: ...12) ### NOV 2022 [0.31.3] Thermostats: more improvements - Anna+Elga: remove cooling-switch, ad...


[uncategorized] ~434-~434: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: .... - Add the supported_features as a property as they can change when the cooling-fea...


[style] ~468-~468: Consider using a different verb for a more formal wording. (FIX_RESOLVE)
Context: ...fixing connectivity issues (should also fix issues #268, #274) - Improvements in ...


[grammar] ~682-~682: The plural noun “devices” cannot be used with the article “a”. Did you mean “a new device” or “new devices”? (A_NNS)
Context: ...lt). A notification will be popup after a new devices is joined. - Improved: For quicker re...


[typographical] ~694-~694: Consider adding a comma after this introductory phrase. (AS_A_NN_COMMA)
Context: ...ion, @brefra, has joined the team. As a result we have added support for the Plugwise ...


[typographical] ~707-~707: Consider adding a comma here. (TO_THAT_COMMA)
Context: ... the HA Core Plugwise component. Due to this it behaves exactly as the HA Core Plugw...


[style] ~709-~709: For conciseness, consider replacing this expression with an adverb. (AT_THE_MOMENT)
Context: ...tures and improvements! PLEASE NOTE: ~~at the moment you will need to remove the existing Co...


[style] ~709-~709: For conciseness, consider replacing this expression with an adverb. (AT_THE_MOMENT)
Context: ...all this beta custom_component. This is at the moment also needed when you want to return to ...

Additional comments not posted (1)
CHANGELOG.md (1)

7-7: This entry succinctly captures the ongoing efforts. Ensure that specific features and fixes are detailed in future releases for better tracking.

@bouwew bouwew merged commit 46e9d62 into main Jun 20, 2024
7 checks passed
@bouwew bouwew deleted the coordinator-use branch June 20, 2024 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
downstreaming Things that are changed on HA-core side and to be applied to -beta
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants