Skip to content

Commit

Permalink
Fix deserialization error for devices without palettes (#1427)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Aug 12, 2024
1 parent 3e87d76 commit 673c5c1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/wled/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,13 @@ def __pre_deserialize__(cls, d: dict[Any, Any]) -> dict[Any, Any]:
palette_id: {"palette_id": palette_id, "name": name}
for palette_id, name in enumerate(_palettes)
}
elif _palettes is None:
# Some less capable devices don't have palettes and
# will return `null`.
# Refs:
# - https://github.com/home-assistant/core/issues/123506
# - https://github.com/Aircoookie/WLED/issues/1974
d["palettes"] = {}

if _presets := d.get("presets"):
_presets = _presets.copy()
Expand Down

0 comments on commit 673c5c1

Please sign in to comment.