Skip to content

Commit

Permalink
Merge pull request #184 from vincentwolsink/device_data_active
Browse files Browse the repository at this point in the history
Only read device_data for active devices
  • Loading branch information
vincentwolsink authored Dec 1, 2024
2 parents 6b2d3a5 + 6196621 commit ffe809f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions custom_components/enphase_envoy/envoy_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ def has_metering_setup(json):
def parse_devicedata(data):
idd = {}
for key, value in data.items():
if isinstance(value, dict) and "devName" in value and value["devName"] == "pcu":
if (
isinstance(value, dict)
and value.get("devName") == "pcu"
and value.get("active") is True
):
channel = value["channels"][0] # unclear when there might be a channel > 0
lifetime = channel["lifetime"]
last_reading = channel["lastReading"]
Expand Down Expand Up @@ -97,8 +101,8 @@ def parse_devicedata(data):
}
elif (
isinstance(value, dict)
and "devName" in value
and value["devName"] == "nsrb"
and value.get("devName") == "nsrb"
and value.get("active") is True
):
channel = value["channels"][0] # unclear when there might be a channel > 0
last_reading = channel["lastReading"]
Expand Down

0 comments on commit ffe809f

Please sign in to comment.