pypetkitapi 1.7.7__tar.gz → 1.7.9__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.7.7 → pypetkitapi-1.7.9}/PKG-INFO +1 -1
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/client.py +7 -3
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/command.py +21 -1
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/const.py +4 -0
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/feeder_container.py +3 -1
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/litter_container.py +2 -0
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pyproject.toml +2 -2
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/LICENSE +0 -0
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/README.md +0 -0
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/__init__.py +0 -0
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/containers.py +0 -0
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/exceptions.py +0 -0
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/medias.py +0 -0
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/py.typed +0 -0
- {pypetkitapi-1.7.7 → pypetkitapi-1.7.9}/pypetkitapi/water_fountain_container.py +0 -0
@@ -144,6 +144,8 @@ class PetKitClient:
|
|
144
144
|
response = await self.req.request(
|
145
145
|
method=HTTPMethod.POST,
|
146
146
|
url=PetkitEndpoint.REFRESH_SESSION,
|
147
|
+
data=LOGIN_DATA,
|
148
|
+
headers=await self.get_session_id(),
|
147
149
|
)
|
148
150
|
session_data = response["session"]
|
149
151
|
self._session = SessionInfo(**session_data)
|
@@ -151,6 +153,7 @@ class PetKitClient:
|
|
151
153
|
async def validate_session(self) -> None:
|
152
154
|
"""Check if the session is still valid and refresh or re-login if necessary."""
|
153
155
|
if self._session is None:
|
156
|
+
_LOGGER.debug("No token, logging in")
|
154
157
|
await self.login()
|
155
158
|
return
|
156
159
|
|
@@ -195,6 +198,8 @@ class PetKitClient:
|
|
195
198
|
|
196
199
|
async def get_devices_data(self) -> None:
|
197
200
|
"""Get the devices data from the PetKit servers."""
|
201
|
+
await self.validate_session()
|
202
|
+
|
198
203
|
start_time = datetime.now()
|
199
204
|
if not self.account_data:
|
200
205
|
await self._get_account_data()
|
@@ -202,7 +207,6 @@ class PetKitClient:
|
|
202
207
|
main_tasks = []
|
203
208
|
record_tasks = []
|
204
209
|
device_list: list[Device] = []
|
205
|
-
stats_tasks = []
|
206
210
|
|
207
211
|
for account in self.account_data:
|
208
212
|
_LOGGER.debug("List devices data for account: %s", account)
|
@@ -268,8 +272,6 @@ class PetKitClient:
|
|
268
272
|
],
|
269
273
|
) -> None:
|
270
274
|
"""Fetch the device data from the PetKit servers."""
|
271
|
-
await self.validate_session()
|
272
|
-
|
273
275
|
device_type = device.device_type.lower()
|
274
276
|
|
275
277
|
_LOGGER.debug("Reading device type : %s (id=%s)", device_type, device.device_id)
|
@@ -399,6 +401,8 @@ class PetKitClient:
|
|
399
401
|
setting: dict | None = None,
|
400
402
|
) -> bool:
|
401
403
|
"""Control the device using the PetKit API."""
|
404
|
+
await self.validate_session()
|
405
|
+
|
402
406
|
device = self.petkit_entities.get(device_id)
|
403
407
|
if not device:
|
404
408
|
raise PypetkitError(f"Device with ID {device_id} not found.")
|
@@ -39,7 +39,9 @@ class FeederCommand(StrEnum):
|
|
39
39
|
MANUAL_FEED_DUAL = "manual_feed_dual"
|
40
40
|
CANCEL_MANUAL_FEED = "cancelRealtimeFeed"
|
41
41
|
FOOD_REPLENISHED = "food_replenished"
|
42
|
-
RESET_DESICCANT = "
|
42
|
+
RESET_DESICCANT = "desiccant_reset"
|
43
|
+
REMOVE_DAILY_FEED = "remove_daily_feed"
|
44
|
+
RESTORE_DAILY_FEED = "restore_daily_feed"
|
43
45
|
|
44
46
|
|
45
47
|
class LitterCommand(StrEnum):
|
@@ -160,6 +162,24 @@ ACTIONS_MAP = {
|
|
160
162
|
},
|
161
163
|
supported_device=ALL_DEVICES,
|
162
164
|
),
|
165
|
+
FeederCommand.REMOVE_DAILY_FEED: CmdData(
|
166
|
+
endpoint=PetkitEndpoint.REMOVE_DAILY_FEED,
|
167
|
+
params=lambda device, setting: {
|
168
|
+
"deviceId": device.id,
|
169
|
+
"day": datetime.datetime.now().strftime("%Y%m%d"),
|
170
|
+
**setting, # Need the id of the feed to remove
|
171
|
+
},
|
172
|
+
supported_device=DEVICES_FEEDER,
|
173
|
+
),
|
174
|
+
FeederCommand.RESTORE_DAILY_FEED: CmdData(
|
175
|
+
endpoint=PetkitEndpoint.RESTORE_DAILY_FEED,
|
176
|
+
params=lambda device, setting: {
|
177
|
+
"deviceId": device.id,
|
178
|
+
"day": datetime.datetime.now().strftime("%Y%m%d"),
|
179
|
+
**setting, # Need the id of the feed to restore
|
180
|
+
},
|
181
|
+
supported_device=DEVICES_FEEDER,
|
182
|
+
),
|
163
183
|
FeederCommand.MANUAL_FEED: CmdData(
|
164
184
|
endpoint=lambda device: get_endpoint_manual_feed(device),
|
165
185
|
params=lambda device, setting: {
|
@@ -133,3 +133,7 @@ class PetkitEndpoint(StrEnum):
|
|
133
133
|
MANUAL_FEED_DUAL = "saveDailyFeed"
|
134
134
|
DAILY_FEED_AND_EAT = "dailyFeedAndEat" # D3
|
135
135
|
FEED_STATISTIC = "feedStatistic" # D4
|
136
|
+
DAILY_FEED = "dailyFeeds" # D4S
|
137
|
+
REMOVE_DAILY_FEED = "removeDailyFeed"
|
138
|
+
RESTORE_DAILY_FEED = "restoreDailyFeed"
|
139
|
+
SAVE_FEED = "saveFeed" # For Feeding plan
|
@@ -5,7 +5,7 @@ from typing import Any, ClassVar
|
|
5
5
|
|
6
6
|
from pydantic import BaseModel, Field
|
7
7
|
|
8
|
-
from pypetkitapi.const import D3, D4, DEVICE_DATA, DEVICE_RECORDS, PetkitEndpoint
|
8
|
+
from pypetkitapi.const import D3, D4, D4S, DEVICE_DATA, DEVICE_RECORDS, PetkitEndpoint
|
9
9
|
from pypetkitapi.containers import CloudProduct, Device, FirmwareDetail, Wifi
|
10
10
|
|
11
11
|
|
@@ -273,6 +273,8 @@ class FeederRecord(BaseModel):
|
|
273
273
|
return PetkitEndpoint.DAILY_FEED_AND_EAT
|
274
274
|
if device_type == D4:
|
275
275
|
return PetkitEndpoint.FEED_STATISTIC
|
276
|
+
if device_type == D4S:
|
277
|
+
return PetkitEndpoint.DAILY_FEED
|
276
278
|
return PetkitEndpoint.GET_DEVICE_RECORD
|
277
279
|
|
278
280
|
@classmethod
|
@@ -51,6 +51,7 @@ class SettingsLitter(BaseModel):
|
|
51
51
|
lightest: int | None = Field(None, alias="lightest")
|
52
52
|
litter_full_notify: int | None = Field(None, alias="litterFullNotify")
|
53
53
|
manual_lock: int | None = Field(None, alias="manualLock")
|
54
|
+
no_remind: int | None = Field(None, alias="noRemind")
|
54
55
|
pet_in_notify: int | None = Field(None, alias="petInNotify")
|
55
56
|
relate_k3_switch: int | None = Field(None, alias="relateK3Switch")
|
56
57
|
sand_type: int | None = Field(None, alias="sandType")
|
@@ -76,6 +77,7 @@ class SettingsLitter(BaseModel):
|
|
76
77
|
pet_detection: int | None = Field(None, alias="petDetection")
|
77
78
|
pet_notify: int | None = Field(None, alias="petNotify")
|
78
79
|
pre_live: int | None = Field(None, alias="preLive")
|
80
|
+
shortest: int | None = None
|
79
81
|
system_sound_enable: int | None = Field(None, alias="systemSoundEnable")
|
80
82
|
time_display: int | None = Field(None, alias="timeDisplay")
|
81
83
|
toilet_detection: int | None = Field(None, alias="toiletDetection")
|
@@ -187,7 +187,7 @@ build-backend = "poetry.core.masonry.api"
|
|
187
187
|
|
188
188
|
[tool.poetry]
|
189
189
|
name = "pypetkitapi"
|
190
|
-
version = "1.7.
|
190
|
+
version = "1.7.9"
|
191
191
|
description = "Python client for PetKit API"
|
192
192
|
authors = ["Jezza34000 <info@mail.com>"]
|
193
193
|
readme = "README.md"
|
@@ -208,7 +208,7 @@ ruff = "^0.8.1"
|
|
208
208
|
types-aiofiles = "^24.1.0.20240626"
|
209
209
|
|
210
210
|
[tool.bumpver]
|
211
|
-
current_version = "1.7.
|
211
|
+
current_version = "1.7.9"
|
212
212
|
version_pattern = "MAJOR.MINOR.PATCH"
|
213
213
|
commit_message = "bump version {old_version} -> {new_version}"
|
214
214
|
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
|