Skip to content

Commit

Permalink
Fixed lbbrhzn#1466
Browse files Browse the repository at this point in the history
  • Loading branch information
altserg committed Jan 9, 2025
1 parent 76287e5 commit 301bc05
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion custom_components/ocpp/chargepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from ocpp.charge_point import ChargePoint as cp
from ocpp.v16 import call as callv16
from ocpp.v16 import call_result as call_resultv16
from ocpp.v16.enums import UnitOfMeasure, AuthorizationStatus, Measurand, Phase
from ocpp.v16.enums import UnitOfMeasure, AuthorizationStatus, Measurand, Phase, ReadingContext
from ocpp.v201 import call as callv201
from ocpp.v201 import call_result as call_resultv201
from ocpp.messages import CallError
Expand Down Expand Up @@ -766,6 +766,15 @@ def process_measurands(
# Charger reports Energy.Active.Import.Register directly as Session energy for transactions.
self._charger_reports_session_energy = True

# Only set the meter start value from Transaction begin context
if (
is_transaction
and context == ReadingContext.transaction_begin.value
):
self._metrics[csess.meter_start].value = value
self._metrics[csess.meter_start].unit == unit
continue

if phase is None:
if (
measurand == DEFAULT_MEASURAND
Expand Down

0 comments on commit 301bc05

Please sign in to comment.