Skip to content

Commit c1ea9f3

Browse files
author
lbbrhzn
authored
sum all reported energy and power phases (#226)
Co-authored-by: lbbrhzn <@lbbrhzn>
1 parent 5df8d5a commit c1ea9f3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

custom_components/ocpp/api.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,13 +818,25 @@ def process_phases(self, data):
818818
Measurand.power_active_import.value,
819819
Measurand.power_active_export.value,
820820
]:
821-
"""Line currents and powers are summed."""
821+
# Currents and powers are always summed.
822822
if Phase.l1.value in phase_info:
823823
metric_value = (
824824
phase_info.get(Phase.l1.value, 0)
825825
+ phase_info.get(Phase.l2.value, 0)
826826
+ phase_info.get(Phase.l3.value, 0)
827827
)
828+
elif Phase.l1_n.value in phase_info:
829+
metric_value = (
830+
phase_info.get(Phase.l1_n.value, 0)
831+
+ phase_info.get(Phase.l2_n.value, 0)
832+
+ phase_info.get(Phase.l3_n.value, 0)
833+
)
834+
elif Phase.l1_l2.value in phase_info:
835+
metric_value = (
836+
phase_info.get(Phase.l1_l2.value, 0)
837+
+ phase_info.get(Phase.l2_l3.value, 0)
838+
+ phase_info.get(Phase.l3_l1.value, 0)
839+
)
828840
if metric_value is not None:
829841
self._metrics[metric].value = round(metric_value, 1)
830842

0 commit comments

Comments
 (0)