diff --git a/openevsehttp/__init__.py b/openevsehttp/__init__.py index 1af82d4..b8e0c2b 100644 --- a/openevsehttp/__init__.py +++ b/openevsehttp/__init__.py @@ -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 diff --git a/pylintrc b/pylintrc index 87f96a1..aa7931e 100644 --- a/pylintrc +++ b/pylintrc @@ -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, @@ -26,7 +25,6 @@ disable= too-many-public-methods, too-many-instance-attributes, too-many-branches, - no-self-use, too-many-statements [REPORTS]