Next HA required updates#1079
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis 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. ChangesPlugwise Integration Refactoring and Modernization
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)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 winFix orphaned
update_listenerso options changes reload the entry
custom_components/plugwise/__init__.pydefinesupdate_listener()(lines 63-67) butasync_setup_entry()never registers it (noentry.add_update_listener(update_listener)), so updating options likeCONF_REFRESH_INTERVAL/CONF_SCAN_INTERVALwon’t triggerasync_reload(). Since the coordinator sets its cooldown/update interval fromentry.optionsduring 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 removeupdate_listenerif 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
📒 Files selected for processing (15)
CHANGELOG.mdcustom_components/plugwise/__init__.pycustom_components/plugwise/binary_sensor.pycustom_components/plugwise/button.pycustom_components/plugwise/climate.pycustom_components/plugwise/config_flow.pycustom_components/plugwise/const.pycustom_components/plugwise/diagnostics.pycustom_components/plugwise/entity.pycustom_components/plugwise/number.pycustom_components/plugwise/select.pycustom_components/plugwise/sensor.pycustom_components/plugwise/services.pycustom_components/plugwise/switch.pycustom_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
|
Hmmm, bot drunk? Both are successful now, right? Edit: => it was not |
|
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)? |
CoMPaTech
left a comment
There was a problem hiding this comment.
As discussed lets clean-up (ignore) the remaining linters so the bot can assume status properly (and doesn't keep creating Wednesday-tickets) 📟
|
Lets' fix it after relase |
|



Summary by CodeRabbit
New Features
Improvements