Răsfoiți Sursa

Adapt slot fetch to new UserData model: active bool replaces status enum

ZiB 4 luni în urmă
părinte
comite
ea15a23d42
1 a modificat fișierele cu 1 adăugiri și 8 ștergeri
  1. 1 8
      custom_components/zlock_slots/coordinator.py

+ 1 - 8
custom_components/zlock_slots/coordinator.py

@@ -113,20 +113,13 @@ class ZLockCoordinator(DataUpdateCoordinator[dict[str, LockState]]):
       _LOGGER.exception("Failed to fetch code slots for %s", lock_entity_id)
       return {}
 
-    if users:
-      _LOGGER.debug("UserData[0]: %s", vars(users[0]) if hasattr(users[0], "__dict__") else users[0])
-
     slots: dict[int, SlotInfo] = {}
     for user in users:
       slot_num = user.user_id
       if slot_num == 0:
         continue
-      status = user.user_id_status
-      status_name = status.name if hasattr(status, "name") else str(status)
-      if status_name == "Available":
-        continue
       slots[slot_num] = SlotInfo(
-        status=status_name.lower(),
+        status="enabled" if user.active else "disabled",
         name=self.get_name(lock_entity_id, slot_num),
       )
     return slots