Skip to content

Commit

Permalink
Merge pull request #95 from crkochan/patch-1
Browse files Browse the repository at this point in the history
Fix potential div zero error in init
krbaker authored Jan 9, 2025

Verified

This commit was signed with the committer’s verified signature.
renovate-bot Mend Renovate
2 parents ba749d0 + 942d052 commit 65a66e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/sunpower/__init__.py
Original file line number Diff line number Diff line change
@@ -71,8 +71,8 @@ def create_vmeter(data):
if "vln_3phavg_v" in inverter:
volts.append(float(inverter["vln_3phavg_v"]))

freq_avg = sum(freq) / len(freq)
volts_avg = sum(volts) / len(volts)
freq_avg = sum(freq) / len(freq) if len(freq) > 0 else None
volts_avg = sum(volts) / len(volts) if len(volts) > 0 else None

pvs_serial = next(iter(data[PVS_DEVICE_TYPE])) # only one PVS
vmeter_serial = f"{pvs_serial}pv"

0 comments on commit 65a66e1

Please sign in to comment.