pypetkitapi 1.4.0__tar.gz → 1.5.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pypetkitapi
3
- Version: 1.4.0
3
+ Version: 1.5.0
4
4
  Summary: Python client for PetKit API
5
5
  Home-page: https://github.com/Jezza34000/pypetkit
6
6
  License: MIT
@@ -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
- device_type: str = "pet"
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):
@@ -187,7 +187,7 @@ build-backend = "poetry.core.masonry.api"
187
187
 
188
188
  [tool.poetry]
189
189
  name = "pypetkitapi"
190
- version = "1.4.0"
190
+ version = "1.5.0"
191
191
  description = "Python client for PetKit API"
192
192
  authors = ["Jezza34000 <info@mail.com>"]
193
193
  readme = "README.md"
@@ -204,7 +204,7 @@ black = "^24.10.0"
204
204
  ruff = "^0.8.1"
205
205
 
206
206
  [tool.bumpver]
207
- current_version = "1.4.0"
207
+ current_version = "1.5.0"
208
208
  version_pattern = "MAJOR.MINOR.PATCH"
209
209
  commit_message = "bump version {old_version} -> {new_version}"
210
210
  tag_message = "{new_version}"
File without changes
File without changes