Skip to content

Commit

Permalink
Merge pull request #43 from Morteum9/patch-3
Browse files Browse the repository at this point in the history
Update responses.py
  • Loading branch information
filcole authored Dec 29, 2022
2 parents 753ce06 + e1b3678 commit 2e04958
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pycarwings2/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,10 @@ def __init__(self, status):
log.debug("battery_capacity=0, status=%s", status)
self.battery_percent = 0
else:
self.battery_percent = 100 * float(self.battery_remaining_amount) / 12
if self.battery_remaining_amount == '':
self.battery_percent = 0
else:
self.battery_percent = 100 * float(self.battery_remaining_amount) / 12

# Leaf 2016 has SOC (State Of Charge) in BatteryStatus, a more accurate battery_percentage
if "SOC" in bs:
Expand Down

0 comments on commit 2e04958

Please sign in to comment.