Skip to content

Next HA required updates#1079

Open
bouwew wants to merge 8 commits into
mainfrom
next-ha-158
Open

Next HA required updates#1079
bouwew wants to merge 8 commits into
mainfrom
next-ha-158

Conversation

@bouwew
Copy link
Copy Markdown
Contributor

@bouwew bouwew commented May 31, 2026

Summary by CodeRabbit

  • New Features

    • Adds a user-accessible notification deletion service.
  • Improvements

    • Improved compatibility with Python 3.14.
    • Cleaner internal service handling and minor module housekeeping (no change to user workflows).

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 04aebb08-defd-42f3-bd01-af7ba5885107

📥 Commits

Reviewing files that changed from the base of the PR and between 06a48f8 and fe2c81f.

📒 Files selected for processing (3)
  • custom_components/plugwise/__init__.py
  • custom_components/plugwise/config_flow.py
  • custom_components/plugwise/services.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • custom_components/plugwise/services.py

📝 Walkthrough

Walkthrough

This PR extracts the delete_notification service into a new services.py (registered via a new async_setup), adds CONF_CONFIG_ENTRY, simplifies async_setup_entry to only forward platforms and keep options update listener wiring, removes postponed-annotation imports across platform modules, and updates util.py imports to use collections.abc.

Changes

Plugwise Integration Refactoring and Modernization

Layer / File(s) Summary
Service extraction, async_setup, and entry-tail simplification
custom_components/plugwise/__init__.py, custom_components/plugwise/services.py, custom_components/plugwise/const.py
Added async_setup(hass) that calls async_setup_services(hass) and returns True; moved delete_notification service handler to services.py and registered the service there; removed inline service registration from async_setup_entry; added CONF_CONFIG_ENTRY.
Remove postponed annotations from platform modules
custom_components/plugwise/binary_sensor.py, custom_components/plugwise/button.py, custom_components/plugwise/climate.py, custom_components/plugwise/config_flow.py, custom_components/plugwise/diagnostics.py, custom_components/plugwise/entity.py, custom_components/plugwise/number.py, custom_components/plugwise/select.py, custom_components/plugwise/sensor.py, custom_components/plugwise/switch.py
Deleted from __future__ import annotations directives across platform and support modules so annotations are evaluated at runtime.
collections.abc import adjustments in util.py
custom_components/plugwise/util.py
Removed postponed-annotations import and moved Awaitable, Callable, Coroutine imports to collections.abc, keeping Any/Concatenate from typing.
CHANGELOG update
CHANGELOG.md
Added an “Ongoing” section noting Python 3.14 compatibility improvements and that service-related code was moved to services.py.

Sequence Diagram(s)

sequenceDiagram
  participant HA as Home Assistant
  participant async_setup as async_setup(hass)
  participant async_setup_services as async_setup_services(hass)
  participant ServiceHandler as delete_notification(Service)
  participant Coordinator as PlugwiseCoordinator
  participant API as coordinator.api

  HA->>async_setup: initialize integration
  async_setup->>async_setup_services: initialize service handlers
  HA->>ServiceHandler: user triggers delete_notification(service call)
  ServiceHandler->>Coordinator: resolve config entry -> coordinator
  ServiceHandler->>API: await coordinator.api.delete_notification()
  API-->>ServiceHandler: success or raises PlugwiseError
  ServiceHandler-->>ServiceHandler: log result (success/failure)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

core-dev-compat

Suggested reviewers

  • CoMPaTech
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Next HA required updates' is too vague and generic, failing to clearly convey what specific Home Assistant changes are being implemented. Use a more specific title that describes the main change, such as 'Refactor services setup and remove deprecated annotations' or 'Update for Home Assistant Core 2026.6 compatibility'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch next-ha-158

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot requested a review from CoMPaTech May 31, 2026 13:34
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

@coderabbitai coderabbitai Bot added the downstreaming Things that are changed on HA-core side and to be applied to -beta label May 31, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

Copy link
Copy Markdown
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
custom_components/plugwise/__init__.py (1)

63-67: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix orphaned update_listener so options changes reload the entry

custom_components/plugwise/__init__.py defines update_listener() (lines 63-67) but async_setup_entry() never registers it (no entry.add_update_listener(update_listener)), so updating options like CONF_REFRESH_INTERVAL / CONF_SCAN_INTERVAL won’t trigger async_reload(). Since the coordinator sets its cooldown/update interval from entry.options during setup/initial connect, the new option values won’t take effect until a manual reload.

Re-wire the listener (and register/unregister via entry.async_on_unload(...) as appropriate) or remove update_listener if reload-on-options-change is no longer intended.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@custom_components/plugwise/__init__.py` around lines 63 - 67, The
update_listener function is defined but never registered, so option changes
don't reload the entry; in async_setup_entry register the listener (e.g., call
entry.add_update_listener(update_listener) or use
entry.async_on_unload(entry.add_update_listener(...))) so that update_listener
will be invoked on option changes and trigger
hass.config_entries.async_reload(entry.entry_id), and ensure you unregister it
via entry.async_on_unload where appropriate or remove update_listener entirely
if reload-on-options-change is not desired; locate async_setup_entry and
update_listener in custom_components.plugwise.__init__ to make this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@custom_components/plugwise/services.py`:
- Around line 24-51: The service handler delete_notification reads
call.data[CONF_CONFIG_ENTRY] but the registered schema is empty; change the
registration to require and validate CONF_CONFIG_ENTRY (e.g., use
vol.Schema({vol.Required(CONF_CONFIG_ENTRY): cv.string}) or appropriate
validator) so service.async_get_config_entry(call.hass, DOMAIN,
call.data[CONF_CONFIG_ENTRY]) receives a validated entry id and raises
ServiceValidationError when missing/invalid; also simplify/remove the PLATFORMS
loop and register the service directly for Platform.BINARY_SENSOR (or register
unconditionally if intended) using SERVICE_DELETE and the new schema.

---

Outside diff comments:
In `@custom_components/plugwise/__init__.py`:
- Around line 63-67: The update_listener function is defined but never
registered, so option changes don't reload the entry; in async_setup_entry
register the listener (e.g., call entry.add_update_listener(update_listener) or
use entry.async_on_unload(entry.add_update_listener(...))) so that
update_listener will be invoked on option changes and trigger
hass.config_entries.async_reload(entry.entry_id), and ensure you unregister it
via entry.async_on_unload where appropriate or remove update_listener entirely
if reload-on-options-change is not desired; locate async_setup_entry and
update_listener in custom_components.plugwise.__init__ to make this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: be1fc23e-0875-427f-bd84-9871263086fa

📥 Commits

Reviewing files that changed from the base of the PR and between e9040cd and 06a48f8.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • custom_components/plugwise/__init__.py
  • custom_components/plugwise/binary_sensor.py
  • custom_components/plugwise/button.py
  • custom_components/plugwise/climate.py
  • custom_components/plugwise/config_flow.py
  • custom_components/plugwise/const.py
  • custom_components/plugwise/diagnostics.py
  • custom_components/plugwise/entity.py
  • custom_components/plugwise/number.py
  • custom_components/plugwise/select.py
  • custom_components/plugwise/sensor.py
  • custom_components/plugwise/services.py
  • custom_components/plugwise/switch.py
  • custom_components/plugwise/util.py
💤 Files with no reviewable changes (11)
  • custom_components/plugwise/select.py
  • custom_components/plugwise/switch.py
  • custom_components/plugwise/entity.py
  • custom_components/plugwise/sensor.py
  • custom_components/plugwise/button.py
  • custom_components/plugwise/diagnostics.py
  • custom_components/plugwise/util.py
  • custom_components/plugwise/number.py
  • custom_components/plugwise/binary_sensor.py
  • custom_components/plugwise/climate.py
  • custom_components/plugwise/config_flow.py

Comment thread custom_components/plugwise/services.py Outdated
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

@CoMPaTech
Copy link
Copy Markdown
Member

CoMPaTech commented May 31, 2026

Hmmm, bot drunk? Both are successful now, right? Edit: => it was not

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

@bouwew bouwew marked this pull request as ready for review May 31, 2026 15:29
@bouwew bouwew requested a review from a team as a code owner May 31, 2026 15:29
@CoMPaTech
Copy link
Copy Markdown
Member

We've still have the below at some point - but this is part of the (now unused?) former options, isn't it? We can probably scrap that (or fix it)?

... ruff-ing component...
Found 1 error (1 fixed, 0 remaining).
... ruff-ing tests...
Found 11 errors (11 fixed, 0 remaining).
... pylint-ing component...
************* Module homeassistant.components.plugwise.config_flow
homeassistant/components/plugwise/config_flow.py:3:0: W0012: Unknown option value for 'disable', expected a valid pylint message and got 'hass-config-flow-polling-field' (unknown-option-value)
homeassistant/components/plugwise/config_flow.py:323:12: W7407: Config flow should not include a 'CONF_SCAN_INTERVAL' field -- polling intervals should be fixed by the integration, not user-configurable (https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/appropriate-polling) (home-assistant-config-flow-polling-field)
homeassistant/components/plugwise/config_flow.py:323:12: W7407: Config flow should not include a 'CONF_SCAN_INTERVAL' field -- polling intervals should be fixed by the integration, not user-configurable (https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/appropriate-polling) (home-assistant-config-flow-polling-field)
homeassistant/components/plugwise/config_flow.py:331:16: W7407: Config flow should not include a 'CONF_REFRESH_INTERVAL' field -- polling intervals should be fixed by the integration, not user-configurable (https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/appropriate-polling) (home-assistant-config-flow-polling-field)
homeassistant/components/plugwise/config_flow.py:331:16: W7407: Config flow should not include a 'CONF_REFRESH_INTERVAL' field -- polling intervals should be fixed by the integration, not user-configurable (https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/appropriate-polling) (home-assistant-config-flow-polling-field)

Copy link
Copy Markdown
Member

@CoMPaTech CoMPaTech left a comment

Choose a reason for hiding this comment

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

As discussed lets clean-up (ignore) the remaining linters so the bot can assume status properly (and doesn't keep creating Wednesday-tickets) 📟

@CoMPaTech
Copy link
Copy Markdown
Member

Lets' fix it after relase

@sonarqubecloud
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot requested a review from CoMPaTech May 31, 2026 15:45
@coderabbitai coderabbitai Bot added the core-dev-compat Home Assistant Core Release Candidate or Beta compatibility label May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-dev-compat Home Assistant Core Release Candidate or Beta compatibility 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.

2 participants