Skip to content

Commit

Permalink
Upon SuspendEVSE or SuspendedEV events, energy flow is assumed to be …
Browse files Browse the repository at this point in the history
…0 in both directions (import and export) (#235)
  • Loading branch information
malaiwah authored Dec 13, 2021
1 parent 5fe10fd commit d7cc309
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions custom_components/ocpp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,12 @@ def on_status_notification(self, connector_id, error_code, status, **kwargs):
self._metrics[Measurand.power_active_import.value].value = 0
if Measurand.power_reactive_import.value in self._metrics:
self._metrics[Measurand.power_reactive_import.value].value = 0
if Measurand.current_export.value in self._metrics:
self._metrics[Measurand.current_export.value].value = 0
if Measurand.power_active_export.value in self._metrics:
self._metrics[Measurand.power_active_export.value].value = 0
if Measurand.power_reactive_export.value in self._metrics:
self._metrics[Measurand.power_reactive_export.value].value = 0
self._metrics[cstat.error_code.value].value = error_code
self.hass.async_create_task(self.central.update(self.central.cpid))
return call_result.StatusNotificationPayload()
Expand Down Expand Up @@ -1020,6 +1026,12 @@ def on_stop_transaction(self, meter_stop, timestamp, transaction_id, **kwargs):
self._metrics[Measurand.power_active_import.value].value = 0
if Measurand.power_reactive_import.value in self._metrics:
self._metrics[Measurand.power_reactive_import.value].value = 0
if Measurand.current_export.value in self._metrics:
self._metrics[Measurand.current_export.value].value = 0
if Measurand.power_active_export.value in self._metrics:
self._metrics[Measurand.power_active_export.value].value = 0
if Measurand.power_reactive_export.value in self._metrics:
self._metrics[Measurand.power_reactive_export.value].value = 0
self.hass.async_create_task(self.central.update(self.central.cpid))
return call_result.StopTransactionPayload(
id_tag_info={om.status.value: AuthorizationStatus.accepted.value}
Expand Down

0 comments on commit d7cc309

Please sign in to comment.