File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -816,14 +816,16 @@ def wifi_serial(self) -> str | None:
816816 return None
817817
818818 @property
819- def charging_power (self ) -> float :
819+ def charging_power (self ) -> float | None :
820820 """Return the charge power.
821821
822822 Calculate Watts base on V*I
823823 """
824- assert self ._status is not None
825- value = round (self ._status ["voltage" ] * self ._status ["amp" ], 2 )
826- return value
824+ if self ._status is not None and any (
825+ key in self ._status for key in ["voltage" , "amp" ]
826+ ):
827+ return round (self ._status ["voltage" ] * self ._status ["amp" ], 2 )
828+ return None
827829
828830 # There is currently no min/max amps JSON data
829831 # available via HTTP API methods
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ max-attributes=15
1616# too-few-* - same as too-many-*
1717# import-outside-toplevel - TODO
1818disable =
19- bad-continuation,
2019 duplicate-code,
2120 fixme,
2221 import-outside-toplevel,
@@ -26,7 +25,6 @@ disable=
2625 too-many-public-methods,
2726 too-many-instance-attributes,
2827 too-many-branches,
29- no-self-use,
3028 too-many-statements
3129
3230[REPORTS]
You can’t perform that action at this time.
0 commit comments