diff --git a/src/uiprotect/data/base.py b/src/uiprotect/data/base.py index 51c28db4..0633daee 100644 --- a/src/uiprotect/data/base.py +++ b/src/uiprotect/data/base.py @@ -502,6 +502,8 @@ def update_from_dict(cls: ProtectObject, data: dict[str, Any]) -> ProtectObject: api = cls._api _fields = cls.__fields__ unifi_obj: ProtectBaseObject + if "api" in data: + del data["api"] value: Any for key, item in data.items(): @@ -526,8 +528,6 @@ def update_from_dict(cls: ProtectObject, data: dict[str, Any]) -> ProtectObject: for i in item.values(): if isinstance(i, dict): i["api"] = api - elif key == "api": - continue value = convert_unifi_data(item, _fields[key]) setattr(cls, key, value)