pypetkitapi 1.4.0__py3-none-any.whl → 1.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pypetkitapi/containers.py +14 -2
- {pypetkitapi-1.4.0.dist-info → pypetkitapi-1.5.0.dist-info}/METADATA +1 -1
- {pypetkitapi-1.4.0.dist-info → pypetkitapi-1.5.0.dist-info}/RECORD +5 -5
- {pypetkitapi-1.4.0.dist-info → pypetkitapi-1.5.0.dist-info}/LICENSE +0 -0
- {pypetkitapi-1.4.0.dist-info → pypetkitapi-1.5.0.dist-info}/WHEEL +0 -0
pypetkitapi/containers.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"""Dataclasses container for petkit API."""
|
2
2
|
|
3
|
-
from pydantic import BaseModel, Field
|
3
|
+
from pydantic import BaseModel, Field, model_validator
|
4
4
|
|
5
5
|
|
6
6
|
class RegionInfo(BaseModel):
|
@@ -68,8 +68,20 @@ class Pet(BaseModel):
|
|
68
68
|
avatar: str | None = None
|
69
69
|
created_at: int = Field(alias="createdAt")
|
70
70
|
pet_id: int = Field(alias="petId")
|
71
|
+
id: int | None = None # Fictive field (for HA compatibility) copied from id
|
72
|
+
sn: int | None = None # Fictive field (for HA compatibility) copied from id
|
71
73
|
pet_name: str | None = Field(None, alias="petName")
|
72
|
-
|
74
|
+
name: str | None = None # Fictive field (for HA compatibility) copied from pet_name
|
75
|
+
device_type: str = "pet" # Fictive field (for HA compatibility) fixed
|
76
|
+
firmware: str | None = None # Fictive field (for HA compatibility) fixed
|
77
|
+
|
78
|
+
@model_validator(mode="before")
|
79
|
+
def populate_fictive_fields(cls, values): # noqa: N805
|
80
|
+
"""Populate fictive fields based on other fields."""
|
81
|
+
values["id"] = values.get("id") or values.get("petId")
|
82
|
+
values["sn"] = values.get("sn") or values.get("id")
|
83
|
+
values["name"] = values.get("name") or values.get("petName")
|
84
|
+
return values
|
73
85
|
|
74
86
|
|
75
87
|
class User(BaseModel):
|
@@ -2,13 +2,13 @@ pypetkitapi/__init__.py,sha256=eVpyGMD3tkYtiHUkdKEeNSZhQlZ4woI2Y5oVoV7CwXM,61
|
|
2
2
|
pypetkitapi/client.py,sha256=iLf1EZRMvuMVwtJ-1PQQ_WT6YjbDDcF--E-5gB7iM44,16716
|
3
3
|
pypetkitapi/command.py,sha256=gw3_J_oZHuuGLk66P8uRSqSrySjYa8ArpKaPHi2ybCw,7155
|
4
4
|
pypetkitapi/const.py,sha256=9XNLhM9k0GwNmWPgGef5roULpsYVZ7hzxptGgNhjs74,3432
|
5
|
-
pypetkitapi/containers.py,sha256=
|
5
|
+
pypetkitapi/containers.py,sha256=zj0MBEYA7wp2Nieu1oW4JROs_r7il9VZN8AUyQv-gJs,4192
|
6
6
|
pypetkitapi/exceptions.py,sha256=NWmpsI2ewC4HaIeu_uFwCeuPIHIJxZBzjoCP7aNwvhs,1139
|
7
7
|
pypetkitapi/feeder_container.py,sha256=28GXZ8Nbs08PnFZZI4ENBe3UJ63gsXT3rFa151KrPxo,13310
|
8
8
|
pypetkitapi/litter_container.py,sha256=oNjg-A_kNbGB3SvRntosaaL-vwLF8fbIKoLwoVm_ejQ,18036
|
9
9
|
pypetkitapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
pypetkitapi/water_fountain_container.py,sha256=j6FQEgbZAbsPXDVhcIB05RsNnQJftcWUJKmzuX4TrjM,6712
|
11
|
-
pypetkitapi-1.
|
12
|
-
pypetkitapi-1.
|
13
|
-
pypetkitapi-1.
|
14
|
-
pypetkitapi-1.
|
11
|
+
pypetkitapi-1.5.0.dist-info/LICENSE,sha256=4FWnKolNLc1e3w6cVlT61YxfPh0DQNeQLN1CepKKSBg,1067
|
12
|
+
pypetkitapi-1.5.0.dist-info/METADATA,sha256=yzn442SpWo5frMlSVqYUHvWqh4yJ9MjbTVpzaCjvF3A,4590
|
13
|
+
pypetkitapi-1.5.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
14
|
+
pypetkitapi-1.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|