Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions custom_components/ocpp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,10 +716,7 @@ def process_phases(self, data):
+ value[Phase.l2.value]
+ value[Phase.l3.value]
)
if sum > 0:
self._metrics[metric] = round(sum / 3, 1)
else:
self._metrics[metric] = round(sum, 1)
self._metrics[metric] = round(sum, 1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why round here? I assume it is for presentation purposes only, so maybe better do that in the sensor entity?
We could extend the upcoming Metric class to have a format, besides value and unit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, only reason is presentation. Agree it would be better to handle format in the sensor. If sensor formats then other round functions can be removed from api also.

self._extra_attr[metric] = value

@on(Action.MeterValues)
Expand Down