Skip to content

Commit

Permalink
Add code to handle empty msa payload
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonacox committed Nov 27, 2024
1 parent f7e8f7a commit afd9871
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pypowerwall/tedapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,10 +1189,9 @@ def calculate_dc_power(V, I):
# Get Dictionary of Powerwall Temperatures
temp_sensors = {}
for i in lookup(status, ['components', 'msa']) or []:
i_keys = i.keys()
if "signals" in i_keys and "serialNumber" in i_keys and i["serialNumber"]:
if "signals" in i and "serialNumber" in i and i["serialNumber"]:
for s in i["signals"]:
if "name" in s and s["name"] == "THC_AmbientTemp" and "serialNumber" in i and "value" in s:
if "name" in s and s["name"] == "THC_AmbientTemp" and "value" in s:
temp_sensors[i["serialNumber"]] = s["value"]

# Create TETHC, TEPINV and TEPOD blocks
Expand Down

0 comments on commit afd9871

Please sign in to comment.