-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Fixed #1466 #1477
base: main
Are you sure you want to change the base?
Fixed #1466 #1477
Conversation
@altserg can you add a description to this pull request please? |
Now the Active.Import.Register sensor also gets updated
WalkthroughThe pull request introduces a modification to the OCPP (Open Charge Point Protocol) charge point processing logic. Specifically, it adds a new Changes
Sequence DiagramsequenceDiagram
participant CP as Charge Point
participant MS as Meter Service
CP->>MS: Receive Meter Values
alt Transaction Begin Context
MS-->>CP: Ignore Specific Measurands
else Normal Context
MS->>CP: Process Meter Values
end
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
custom_components/ocpp/chargepoint.py (1)
780-792
: Consider improving readability.The nested conditions could be simplified and the comment could be more descriptive. Here's a suggested refactor:
- # Ignore messages with Transaction Begin context - if context != ReadingContext.transaction_begin.value: - if is_transaction: - self._metrics[csess.session_energy.value].value = value - self._metrics[csess.session_energy.value].unit = unit - self._metrics[csess.session_energy.value].extra_attr[ - cstat.id_tag.name - ] = self._metrics[cstat.id_tag.value].value - else: - self._metrics[measurand].value = value - self._metrics[measurand].unit = unit - else: - continue + # Skip processing for Transaction Begin context as these values + # should not contribute to energy metrics + if context == ReadingContext.transaction_begin.value: + continue + + if is_transaction: + self._metrics[csess.session_energy.value].value = value + self._metrics[csess.session_energy.value].unit = unit + self._metrics[csess.session_energy.value].extra_attr[ + cstat.id_tag.name + ] = self._metrics[cstat.id_tag.value].value + else: + self._metrics[measurand].value = value + self._metrics[measurand].unit = unit
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
custom_components/ocpp/chargepoint.py
(2 hunks)
🔇 Additional comments (2)
custom_components/ocpp/chargepoint.py (2)
31-37
: LGTM! Import changes are appropriate.The addition of
ReadingContext
enum is necessary for the new functionality and is correctly grouped with other enums from the same module.
780-792
: LGTM! Changes correctly address the issue.The implementation properly ignores energy report messages with Transaction Begin context, which aligns with the PR objective to fix issue #1466.
Ignore energy report messages for Transaction.Begin context
Summary by CodeRabbit
New Features
Bug Fixes