pypetkitapi 1.12.1__tar.gz → 1.12.3__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.
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/PKG-INFO +1 -1
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/__init__.py +1 -1
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/client.py +15 -9
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/command.py +4 -3
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/const.py +5 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/containers.py +3 -3
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/media.py +3 -2
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pyproject.toml +2 -2
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/LICENSE +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/README.md +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/bluetooth.py +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/exceptions.py +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/feeder_container.py +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/litter_container.py +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/purifier_container.py +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/py.typed +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/schedule_container.py +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/utils.py +0 -0
- {pypetkitapi-1.12.1 → pypetkitapi-1.12.3}/pypetkitapi/water_fountain_container.py +0 -0
@@ -504,7 +504,6 @@ class PetKitClient:
|
|
504
504
|
"""Collect data from litter data to populate pet stats.
|
505
505
|
:param stats_data: Litter data.
|
506
506
|
"""
|
507
|
-
|
508
507
|
if not stats_data.device_nfo:
|
509
508
|
_LOGGER.warning(
|
510
509
|
"No device info for %s can't populate pet infos", stats_data
|
@@ -513,17 +512,24 @@ class PetKitClient:
|
|
513
512
|
|
514
513
|
pets_list = await self.get_pets_list()
|
515
514
|
for pet in pets_list:
|
516
|
-
if
|
517
|
-
|
518
|
-
and stats_data.device_records
|
519
|
-
):
|
515
|
+
if stats_data.device_nfo.device_type in [T3, T4]:
|
516
|
+
await self.init_pet_stats(pet)
|
520
517
|
await self._process_litter_no_camera(pet, stats_data)
|
521
|
-
elif
|
522
|
-
|
523
|
-
and stats_data.device_pet_graph_out
|
524
|
-
):
|
518
|
+
elif stats_data.device_nfo.device_type in [T5, T6]:
|
519
|
+
await self.init_pet_stats(pet)
|
525
520
|
await self._process_litter_camera(pet, stats_data)
|
526
521
|
|
522
|
+
@staticmethod
|
523
|
+
async def init_pet_stats(pet: Pet) -> None:
|
524
|
+
"""Initialize pet stats.
|
525
|
+
Allow pet stats to be displayed in HA even if no data is available.
|
526
|
+
:param pet: Pet data.
|
527
|
+
"""
|
528
|
+
pet.last_litter_usage = 0
|
529
|
+
pet.last_device_used = "Unknown"
|
530
|
+
pet.last_duration_usage = 0
|
531
|
+
pet.last_measured_weight = 0
|
532
|
+
|
527
533
|
async def _process_litter_no_camera(self, pet: Pet, device_records: Litter) -> None:
|
528
534
|
"""Process litter T3/T4 records (litter without camera).
|
529
535
|
:param pet: Pet data.
|
@@ -17,6 +17,7 @@ from pypetkitapi.const import (
|
|
17
17
|
FEEDER_MINI,
|
18
18
|
K2,
|
19
19
|
K3,
|
20
|
+
PET,
|
20
21
|
T3,
|
21
22
|
T4,
|
22
23
|
T5,
|
@@ -265,11 +266,11 @@ ACTIONS_MAP = {
|
|
265
266
|
supported_device=[D3],
|
266
267
|
),
|
267
268
|
PetCommand.PET_UPDATE_SETTING: CmdData(
|
268
|
-
endpoint=PetkitEndpoint.
|
269
|
+
endpoint=PetkitEndpoint.PET_UPDATE_SETTING,
|
269
270
|
params=lambda pet, setting: {
|
270
|
-
"petId": pet,
|
271
|
+
"petId": pet.pet_id,
|
271
272
|
"kv": json.dumps(setting),
|
272
273
|
},
|
273
|
-
supported_device=
|
274
|
+
supported_device=[PET],
|
274
275
|
),
|
275
276
|
}
|
@@ -139,6 +139,8 @@ class PetkitEndpoint(StrEnum):
|
|
139
139
|
LOGIN = "user/login"
|
140
140
|
GET_LOGIN_CODE = "user/sendcodeforquicklogin"
|
141
141
|
REFRESH_SESSION = "user/refreshsession"
|
142
|
+
DETAILS = "user/details2"
|
143
|
+
UNREAD_STATUS = "user/unreadStatus"
|
142
144
|
FAMILY_LIST = "group/family/list"
|
143
145
|
REFRESH_HOME_V2 = "refreshHomeV2"
|
144
146
|
|
@@ -195,3 +197,6 @@ class PetkitEndpoint(StrEnum):
|
|
195
197
|
SCHEDULE_REMOVE = "schedule/remove"
|
196
198
|
SCHEDULE_COMPLETE = "schedule/complete"
|
197
199
|
SCHEDULE_HISTORY = "schedule/userHistorySchedules"
|
200
|
+
|
201
|
+
# Pet
|
202
|
+
PET_UPDATE_SETTING = "updatepetprops"
|
@@ -84,10 +84,10 @@ class Pet(BaseModel):
|
|
84
84
|
device_nfo: Device | None = None # Device is now optional
|
85
85
|
|
86
86
|
# Litter stats
|
87
|
-
last_litter_usage: int =
|
87
|
+
last_litter_usage: int | None = None
|
88
88
|
last_device_used: str | None = None
|
89
|
-
last_duration_usage: int =
|
90
|
-
last_measured_weight: int =
|
89
|
+
last_duration_usage: int | None = None
|
90
|
+
last_measured_weight: int | None = None
|
91
91
|
|
92
92
|
def __init__(self, **data):
|
93
93
|
"""Initialize the Pet dataclass.
|
@@ -272,13 +272,14 @@ class MediaManager:
|
|
272
272
|
media_cloud: MediaCloud, missing_image: bool, missing_video: bool
|
273
273
|
) -> None:
|
274
274
|
"""Log details about missing media."""
|
275
|
-
log_msg = "Media missing for event %s: "
|
276
275
|
details = []
|
277
276
|
if missing_image:
|
278
277
|
details.append("IMAGE")
|
279
278
|
if missing_video:
|
280
279
|
details.append("VIDEO")
|
281
|
-
_LOGGER.debug(
|
280
|
+
_LOGGER.debug(
|
281
|
+
"Media missing for event : %s %s", media_cloud.event_id, " + ".join(details)
|
282
|
+
)
|
282
283
|
|
283
284
|
async def _process_feeder(self, feeder: Feeder) -> list[MediaCloud]:
|
284
285
|
"""Process media files for a Feeder device.
|
@@ -187,7 +187,7 @@ build-backend = "poetry.core.masonry.api"
|
|
187
187
|
|
188
188
|
[tool.poetry]
|
189
189
|
name = "pypetkitapi"
|
190
|
-
version = "1.12.
|
190
|
+
version = "1.12.3"
|
191
191
|
description = "Python client for PetKit API"
|
192
192
|
authors = ["Jezza34000 <info@mail.com>"]
|
193
193
|
readme = "README.md"
|
@@ -209,7 +209,7 @@ ruff = "^0.8.1"
|
|
209
209
|
types-aiofiles = "^24.1.0.20240626"
|
210
210
|
|
211
211
|
[tool.bumpver]
|
212
|
-
current_version = "1.12.
|
212
|
+
current_version = "1.12.3"
|
213
213
|
version_pattern = "MAJOR.MINOR.PATCH"
|
214
214
|
commit_message = "bump version {old_version} -> {new_version}"
|
215
215
|
tag_message = "{new_version}"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|