-
-
Notifications
You must be signed in to change notification settings - Fork 100
Handle disabled entities. #1763
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
Conversation
WalkthroughIntroduces filtered update dispatching from ChargePoint.update that sends a set of active entity_ids via DATA_UPDATED. Entities (sensor/number/button) switch to a local _maybe_update callback that schedules updates only when applicable. Button adds async_added_to_hass to register the dispatcher listener and ensure availability after reload. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CP as ChargePoint.update
participant HA as HA Dispatcher
participant ENT as Entities (Sensor/Number/Button)
CP->>CP: Traverse devices
CP->>CP: Filter disabled/unloaded entities
CP->>HA: dispatch(DATA_UPDATED, active_entities)
note over HA: active_entities: Set[str] or None
par For each subscribed entity
HA-->>ENT: DATA_UPDATED(active_entities)
ENT->>ENT: _maybe_update(active_lookup)
alt included or lookup is None
ENT->>ENT: schedule_update_ha_state(immediate=True)
else not included
ENT-->>ENT: ignore
end
end
note over ENT: Button registers listener in async_added_to_hass
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🧰 Additional context used🧬 Code graph analysis (4)custom_components/ocpp/button.py (2)
custom_components/ocpp/number.py (2)
custom_components/ocpp/sensor.py (2)
custom_components/ocpp/chargepoint.py (1)
🔇 Additional comments (4)
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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1763 +/- ##
==========================================
- Coverage 95.42% 95.19% -0.23%
==========================================
Files 12 12
Lines 2883 2914 +31
==========================================
+ Hits 2751 2774 +23
- Misses 132 140 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Resolves #1762.
Summary by CodeRabbit