Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions openevsehttp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,14 +816,16 @@ def wifi_serial(self) -> str | None:
return None

@property
def charging_power(self) -> float:
def charging_power(self) -> float | None:
"""Return the charge power.

Calculate Watts base on V*I
"""
assert self._status is not None
value = round(self._status["voltage"] * self._status["amp"], 2)
return value
if self._status is not None and any(
key in self._status for key in ["voltage", "amp"]
):
return round(self._status["voltage"] * self._status["amp"], 2)
return None

# There is currently no min/max amps JSON data
# available via HTTP API methods
Expand Down
2 changes: 0 additions & 2 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ max-attributes=15
# too-few-* - same as too-many-*
# import-outside-toplevel - TODO
disable=
bad-continuation,
duplicate-code,
fixme,
import-outside-toplevel,
Expand All @@ -26,7 +25,6 @@ disable=
too-many-public-methods,
too-many-instance-attributes,
too-many-branches,
no-self-use,
too-many-statements

[REPORTS]
Expand Down