Repository navigation
Add an option to send Session Current Limit as a TxDefaultProfile (#2158) - #2183
Conversation
…brhzn#2158) Some chargers (Timxon A0, ABB Terra AC, Morek MEV11 on OCPP 1.6) refuse both the station ChargePointMaxProfile and a transaction-bound TxProfile, but accept a TxDefaultProfile on the connector and apply it to the running transaction. Before lbbrhzn#2131 the station slider reached them through its TxDefaultProfile fallback; since 0.12.0 nothing does. A per-charger option, session_limit_default_profile (off by default), makes Session Current Limit send a Relative TxDefaultProfile instead: on the connector on 1.6, on the connector's EVSE on 2.0.1. It uses profile id 2000+n and one stack level below the reported maximum (at least 1, and 0 for a maximum of 0), which on 1.6 is the profile the set_charge_rate action writes for its TxDefaultProfile leg. With the option on, the slider needs no transaction. It is available whenever the charger is up with SmartCharging and, on 2.0.1, has reported which EVSE the connector is on; nothing is sent to a guessed EVSE. Its value is the last limit the charger accepted, kept across transactions and restored after a restart, saving only accepted values and only those this mode set. A cancelled request reverts the display, in both modes. The option is stored only while it is on and needs no migration, so a charger that never enables it stays loadable by older releases. Settings are now built from the keys their dataclass knows, so later releases can add settings without breaking a rollback to this one. The station slider and the transaction-bound mode are unchanged.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (16)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughAdds an optional default-profile mode for session current limits. The mode sends connector-scoped ChangesSession default current limit
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant SessionDefaultLimitNumber
participant CentralSystem
participant ChargePoint
participant OCPPCharger
SessionDefaultLimitNumber->>CentralSystem: Set connector session limit
CentralSystem->>ChargePoint: Dispatch default limit
ChargePoint->>OCPPCharger: Send SetChargingProfile with TxDefaultProfile
OCPPCharger-->>ChargePoint: Return response status
ChargePoint-->>SessionDefaultLimitNumber: Return result or error
Suggested reviewers: Merge Risk: 🔵 Low · up to This adds an optional session-limit mode that is off by default, so existing behavior is unchanged. It has not been tested on real chargers, so users who enable it should confirm their charger accepts the profile. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The change is opt-in and remains scoped to the selected charger. However, a request with an uncertain outcome can leave a persistent charger limit different from the value displayed and restored. Disabling the option does not remove that limit, and connectors sharing an EVSE cannot be controlled independently through this mode. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Issue Full details: Docstring CoverageExplanation Docstring coverage is 72.37% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 76 functions across 13 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2183 +/- ##
==========================================
+ Coverage 97.30% 97.35% +0.05%
==========================================
Files 12 12
Lines 4265 4354 +89
==========================================
+ Hits 4150 4239 +89
Misses 115 115 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Tested on Timxon EAW-A007S (A0 platform), firmware A0-V2.2.4, OCPP 1.6J, Session Current Limit with the option on: works. The slider is accepted Across a restart: set to 16 A, restarted Home Assistant with the car Only tested with a car connected so far — I'll check the no-transaction Maximum Current: unchanged, still ChargePointMaxProfile: NotSupported, One note for other testers: before this test I reset the charger's own |
|
Follow-up: tested with no car connected — Session Current Limit accepted |
Fixes #2158.
Some chargers refuse both the station
ChargePointMaxProfileand a transaction-boundTxProfile, but accept aTxDefaultProfileon the connector and apply it to the running transaction (Timxon A0, ABB Terra AC, Morek MEV11 in #2158). Before #2131 the station slider reached them through itsTxDefaultProfilefallback; since 0.12.0 nothing does.What it does
A new per-charger option, Send Session Current Limit as a default profile (
session_limit_default_profile, off by default), changes only how Session Current Limit works:TxDefaultProfilewith no transaction id: on the connector on 1.6, on the connector's EVSE on 2.0.1. Profile id2000+n, one stack level below the reported maximum (at least 1, and 0 when the charger reports 0). On 1.6 that is the profile theocpp.set_charge_rateaction already writes for itsTxDefaultProfileleg, and the shape 0.11.4 sent, which the capture in Timxon A0 (OCPP 1.6J): Maximum Current broken since 0.12.0 — ChargePointMaxProfile NotSupported, absolute schedule gets no response #2158 shows these chargers apply.Maximum Current and the default per-transaction behaviour are unchanged. A cancelled slider request now reverts the display in both modes rather than leaving the in-flight value on show.
Configuration and rollback
Limits (documented)
ocpp.clear_profilealso removes it; on 2.0.1 that action clears onlyChargingStationMaxProfile.Testing
Summary by CodeRabbit