Fix sensor data not updating for single-connector chargers (#1835)#1902
Fix sensor data not updating for single-connector chargers (#1835)#1902rishabhvaish wants to merge 2 commits intolbbrhzn:mainfrom
Conversation
For single-connector chargers, non-phased measurands (like Current.Offered) sent with connectorId=0 were stored at connector slot 0, while process_phases correctly remaps phased values to connector 1. This mismatch caused some sensors to never update with periodic data. Remap connector 0 to 1 for non-EAIR measurands on single-connector chargers, matching the existing behavior in process_phases. Fixes lbbrhzn#1835
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTightened mapping of non-EAIR measurands to per-connector metrics: when Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@custom_components/ocpp/chargepoint.py`:
- Around line 927-934: The current remapping block can leave target_cid as None
for multi-connector chargers; change the logic so connector_id values of None or
0 are always remapped to 1 (matching process_phases behavior) and other values
are used as-is—i.e., compute target_cid from connector_id by treating None and 0
the same way—so look for the block that sets target_cid (uses variables
connector_id and single) and update it to map None -> 1 to avoid inserting
(None, measurand) keys that break _ConnectorAwareMetrics.__getitem__.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Current.Offered) sent withconnectorId=0were stored at connector slot 0process_phasescorrectly remaps phased values to connector 1connectorId=0to1for non-EAIR measurands on single-connector chargers, matching the existingprocess_phasesbehaviorFiles changed
custom_components/ocpp/chargepoint.py— added connector ID remapping for non-phased measurandsTest plan
Current.ImportandCurrent.Offeredboth update onSample.PeriodicSample.Clockdata also updates correctlyFixes #1835
Summary by CodeRabbit