api: fix response generation with new "is_main_lock" field
All checks were successful
Build Container / Build Container (push) Successful in 4m30s
All checks were successful
Build Container / Build Container (push) Successful in 4m30s
This commit is contained in:
parent
ecd6c2c48f
commit
69148ebef4
2 changed files with 6 additions and 1 deletions
|
|
@ -233,11 +233,16 @@ async def list_locks(ccujack: deps.CCUJackClient) -> List[models.Lock]:
|
||||||
case "UNREACH":
|
case "UNREACH":
|
||||||
status_data["is_unreachable"] = value.v
|
status_data["is_unreachable"] = value.v
|
||||||
|
|
||||||
|
is_main_lock = (
|
||||||
|
i_lock.identifier.lower() == app_config.get().main_lock.lower()
|
||||||
|
or i_lock.title.lower() == app_config.get().main_lock.lower()
|
||||||
|
)
|
||||||
result.append(
|
result.append(
|
||||||
models.Lock(
|
models.Lock(
|
||||||
id=i_lock.identifier,
|
id=i_lock.identifier,
|
||||||
name=i_lock.title,
|
name=i_lock.title,
|
||||||
status=models.LockStatus(**status_data),
|
status=models.LockStatus(**status_data),
|
||||||
|
is_main_lock=is_main_lock,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ class LockStatus(BaseModel):
|
||||||
is_unreachable: bool
|
is_unreachable: bool
|
||||||
is_low_battery: bool
|
is_low_battery: bool
|
||||||
is_error_jammed: bool
|
is_error_jammed: bool
|
||||||
is_main_lock: bool
|
|
||||||
lock_target_level: Literal["locked", "unlocked", "open"]
|
lock_target_level: Literal["locked", "unlocked", "open"]
|
||||||
lock_state: Literal["unknown", "locked", "unlocked"]
|
lock_state: Literal["unknown", "locked", "unlocked"]
|
||||||
activity_state: Literal["unknown", "locking", "unlocking", "stable"]
|
activity_state: Literal["unknown", "locking", "unlocking", "stable"]
|
||||||
|
|
@ -63,6 +62,7 @@ class LockStatus(BaseModel):
|
||||||
class Lock(BaseModel):
|
class Lock(BaseModel):
|
||||||
name: str
|
name: str
|
||||||
id: str
|
id: str
|
||||||
|
is_main_lock: bool
|
||||||
status: LockStatus
|
status: LockStatus
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue