Skip to content

Commit

Permalink
fix(nexa): ensure last events is set on enum
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Apr 10, 2024
1 parent 4470997 commit 0f73dc7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions custom_components/nexa_bridge_x/nexa.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ def values_from_events(node: NexaNodeData, legacy: bool) -> list[NexaNodeValue]:
ignores = ("methodCall")
values = []

for key, data in node["lastEvents"].items():
if key not in ignores and all(k in data for k in keys):
values.append(NexaNodeValue(
key,
data["value"],
data[prev_key],
data["time"]
))
if "lastEvents" in node:
for key, data in node["lastEvents"].items():
if key not in ignores and all(k in data for k in keys):
values.append(NexaNodeValue(
key,
data["value"],
data[prev_key],
data["time"]
))

return values

Expand Down

0 comments on commit 0f73dc7

Please sign in to comment.