diff --git a/src/wled/models.py b/src/wled/models.py index 52f94e87..912a0090 100644 --- a/src/wled/models.py +++ b/src/wled/models.py @@ -612,6 +612,15 @@ class Preset(BaseModel): ) """Segments are individual parts of the LED strip.""" + @classmethod + def __pre_deserialize__(cls, d: dict[Any, Any]) -> dict[Any, Any]: + """Pre deserialize hook for Preset object.""" + # If the segment is a single value, we will convert it to a list. + if "seg" in d and not isinstance(d["seg"], list): + d["seg"] = [d["seg"]] + + return d + @classmethod def __post_deserialize__(cls, obj: Preset) -> Preset: """Post deserialize hook for Preset object."""