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
9 changes: 9 additions & 0 deletions lib/bq27441/bq27441/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ def capacity_remaining(self):

def state_of_charge(self):
"""Return remaining charge %"""
try:
result = self.soc(SocMeasureType.FILTERED)
return result
except Exception as e:
print("Failed to get state of charge (soc): %s" % e)
sys.print_exception(e)

def state_of_health(self):
"""Return state of health %"""
try:
result = self.soh(SohMeasureType.PERCENT)
return result
Expand Down
Loading