pypetkitapi 1.16.4__py3-none-any.whl → 1.16.6__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/__init__.py CHANGED
@@ -51,7 +51,7 @@ from .media import DownloadDecryptMedia, MediaCloud, MediaFile, MediaManager
51
51
  from .purifier_container import Purifier
52
52
  from .water_fountain_container import WaterFountain
53
53
 
54
- __version__ = "1.16.4"
54
+ __version__ = "1.16.6"
55
55
 
56
56
  __all__ = [
57
57
  "CTW3",
pypetkitapi/bluetooth.py CHANGED
@@ -185,7 +185,7 @@ class BluetoothManager:
185
185
  :return: The BLE command code and the encoded BLE data.
186
186
  """
187
187
  cmd_code = fountain_command[0]
188
- modified_command = fountain_command[:2] + [counter] + fountain_command[2:]
188
+ modified_command = [*fountain_command[:2], counter, *fountain_command[2:]]
189
189
  ble_data = [*BLE_START_TRAME, *modified_command, *BLE_END_TRAME]
190
190
  encoded_data = await self._encode_ble_data(ble_data)
191
191
  return cmd_code, encoded_data
pypetkitapi/client.py CHANGED
@@ -16,6 +16,8 @@ from pypetkitapi.bluetooth import BluetoothManager
16
16
  from pypetkitapi.command import ACTIONS_MAP
17
17
  from pypetkitapi.const import (
18
18
  CLIENT_NFO,
19
+ DEFAULT_COUNTRY,
20
+ DEFAULT_TZ,
19
21
  DEVICE_DATA,
20
22
  DEVICE_RECORDS,
21
23
  DEVICE_STATS,
@@ -91,6 +93,12 @@ class PetKitClient:
91
93
  session: aiohttp.ClientSession | None = None,
92
94
  ) -> None:
93
95
  """Initialize the PetKit Client."""
96
+
97
+ if region is None or not region.strip():
98
+ region = DEFAULT_COUNTRY
99
+ if timezone is None or not timezone.strip():
100
+ timezone = DEFAULT_TZ
101
+
94
102
  self.username = username
95
103
  self.password = password
96
104
  self.region = region.lower()
pypetkitapi/const.py CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  from enum import StrEnum
4
4
 
5
+ DEFAULT_COUNTRY = "DE"
6
+ DEFAULT_TZ = "Europe/Berlin"
7
+
5
8
  RES_KEY = "result"
6
9
  ERR_KEY = "error"
7
10
  SUCCESS_KEY = "success"
pypetkitapi/containers.py CHANGED
@@ -55,13 +55,20 @@ class Device(BaseModel):
55
55
 
56
56
  created_at: int = Field(alias="createdAt")
57
57
  device_id: int = Field(alias="deviceId")
58
- device_name: str = Field(alias="deviceName")
58
+ device_name: str | None = Field("unnamed_device", alias="deviceName")
59
59
  device_type: str = Field(alias="deviceType")
60
60
  group_id: int = Field(alias="groupId")
61
61
  type: int
62
62
  type_code: int = Field(0, alias="typeCode")
63
63
  unique_id: str = Field(alias="uniqueId")
64
64
 
65
+ @field_validator("device_name", mode="before")
66
+ def set_default_name(cls, value): # noqa: N805
67
+ """Set default device_name if None or empty to avoid issues."""
68
+ if value is None or not isinstance(value, str) or not value.strip():
69
+ return "unnamed_device"
70
+ return value.lower()
71
+
65
72
  @field_validator("device_name", "device_type", "unique_id", mode="before")
66
73
  def convert_to_lower(cls, value): # noqa: N805
67
74
  """Convert device_name, device_type and unique_id to lowercase."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pypetkitapi
3
- Version: 1.16.4
3
+ Version: 1.16.6
4
4
  Summary: Python client for PetKit API
5
5
  License: MIT
6
6
  Author: Jezza34000
@@ -58,11 +58,11 @@ Description-Content-Type: text/markdown
58
58
 
59
59
  ---
60
60
 
61
- ## Overview
61
+ ## ℹ️ Overview
62
62
 
63
63
  PetKit Client is a Python library for interacting with the PetKit API. It allows you to manage your PetKit devices, retrieve account data, and control devices through the API.
64
64
 
65
- ## Features
65
+ ## 🚀 Features
66
66
 
67
67
  - Login and session management
68
68
  - Fetch account and device data
@@ -70,7 +70,7 @@ PetKit Client is a Python library for interacting with the PetKit API. It allows
70
70
  - Fetch images & videos produced by devices
71
71
  > Pictures are available **with or without** Care+ subscription, Videos are only available **with** Care+ subscription
72
72
 
73
- ## Installation
73
+ ## ⬇️ Installation
74
74
 
75
75
  Install the library using pip:
76
76
 
@@ -78,7 +78,7 @@ Install the library using pip:
78
78
  pip install pypetkitapi
79
79
  ```
80
80
 
81
- ## Usage Example:
81
+ ## 💡 Usage Example:
82
82
 
83
83
  Here is a simple example of how to use the library to interact with the PetKit API \
84
84
  This example is not an exhaustive list of all the features available in the library.
@@ -137,17 +137,41 @@ if __name__ == "__main__":
137
137
  asyncio.run(main())
138
138
  ```
139
139
 
140
- ## More example usage
140
+ ## 💡 More example usage
141
141
 
142
142
  Check at the usage in the Home Assistant integration : [here](https://github.com/Jezza34000/homeassistant_petkit)
143
143
 
144
- ## Help and Support
144
+ ## ☑️ Supported Devices
145
+
146
+ | **Category** | **Name** | **Device** |
147
+ | ---------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
148
+ | **🍗 Feeders** | ✅ Fresh Element | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/feeder.png" width="40"/></a> |
149
+ | | ✅ Fresh Element Mini Pro | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/feedermini.png" width="40"/></a> |
150
+ | | ✅ Fresh Element Infinity | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d3.png" width="40"/></a> |
151
+ | | ✅ Fresh Element Solo | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d4.png" width="40"/></a> |
152
+ | | ✅ Fresh Element Gemini | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d4s.png" width="40"/></a> |
153
+ | | ✅ YumShare Solo | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d4h.png" width="40"/></a> |
154
+ | | ✅ YumShare Dual-hopper | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d4sh.png" width="40"/></a> |
155
+ | **🚽 Litters** | ✅ PuraX | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t3.png" width="40"/></a> |
156
+ | | ✅ PuraMax | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t4.1.png" width="40"/></a> |
157
+ | | ✅ PuraMax 2 | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t4.png" width="40"/></a> |
158
+ | | ✅ Purobot Max Pro | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t5.png" width="40"/></a> |
159
+ | | ✅ Purobot Ultra | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t6.png" width="40"/></a> |
160
+ | **⛲ Fountains** | ✅ Eversweet Solo 2 | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/5w5.png" width="40"/></a> |
161
+ | | ✅ Eversweet 3 Pro | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/4w5.png" width="40"/></a> |
162
+ | | ✅ Eversweet 3 Pro UVC | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/6w5.png" width="40"/></a> |
163
+ | | ✅ Eversweet 5 Mini | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/2w5.png" width="40"/></a> |
164
+ | | ✅ Eversweet Max | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/ctw3.png" width="40"/></a> |
165
+ | **🧴 Purifiers** | ✅ Air Magicube | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/k2.png" width="40"/></a> |
166
+ | | ✅ Air Smart Spray | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/k3.png" width="40"/></a> |
167
+
168
+ ## 🛟 Help and Support
145
169
 
146
170
  Developers? Want to help? Join us on our Discord channel dedicated to developers and contributors.
147
171
 
148
172
  [![Discord][discord-shield]][discord]
149
173
 
150
- ## Contributing
174
+ ## 👨‍💻 Contributing
151
175
 
152
176
  Contributions are welcome!\
153
177
  Please open an issue or submit a pull request.
@@ -1,9 +1,9 @@
1
- pypetkitapi/__init__.py,sha256=oCd0MKsaUm2x-RKC_Zf-BY7Xo4dhOQb-FGvvFbz8L2I,2107
2
- pypetkitapi/bluetooth.py,sha256=1zEZIrKNTttrZpqBiQ-6V37Uphft5_T8CH9OBfYjwxE,9915
3
- pypetkitapi/client.py,sha256=cn3JIh-3AU5Rzka2rX7FgkSfWeQCG9Vw82-moK_rOPY,30889
1
+ pypetkitapi/__init__.py,sha256=goBSd-5R2ZUGhJ4jnWsnJ53NcJAllu10gqJfb_CnZEE,2107
2
+ pypetkitapi/bluetooth.py,sha256=VNoJ3E9WXzEfqRoWwKiemITKIt9aa9ICRzDvFuJ3PP0,9915
3
+ pypetkitapi/client.py,sha256=nZJnjcCi3T0rSbJ0yTMKIFJPgPH8hkAEPqMCnJ3Q0Pg,31101
4
4
  pypetkitapi/command.py,sha256=zw4h1SCInG2T0-wAA_al59_FTL36TUZldtJkYKw6ATI,7655
5
- pypetkitapi/const.py,sha256=MMxkCCKrlRCh29kqJT8MSKz98hCwqS34qzxwBILAbvQ,4779
6
- pypetkitapi/containers.py,sha256=7wYKmaoBpMKrqIVMsoD4Iv2in7Kh5nNxrl4vC4eF2fg,6305
5
+ pypetkitapi/const.py,sha256=7SDIADq3WxauFpDBARv9VxiCQTG2ZCYyShRLRCyf4WE,4832
6
+ pypetkitapi/containers.py,sha256=MWfSHLU-ZEIf220nv3-96U41PhCl9Gh6ETBV_SYBvV4,6648
7
7
  pypetkitapi/exceptions.py,sha256=4BXUyYXLfZjNxdnOGJPjyE9ASIl7JmQphjws87jvHtE,1631
8
8
  pypetkitapi/feeder_container.py,sha256=PhidWd5WpsZqtdKZy60PzE67YXgQfApjm8CqvMCHK3U,14743
9
9
  pypetkitapi/litter_container.py,sha256=g3PCVN2Yz5JGVzXXQK_jq5LApTiQR-td9kzS8JKW3Sk,20580
@@ -13,7 +13,7 @@ pypetkitapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  pypetkitapi/schedule_container.py,sha256=ycIHeQHkVILDp7ZBjaVdGI_9rhHrgqeKBfvQAX3JMGE,2071
14
14
  pypetkitapi/utils.py,sha256=z7325kcJQUburnF28HSXrJMvY_gY9007K73Zwxp-4DQ,743
15
15
  pypetkitapi/water_fountain_container.py,sha256=5J0b-fDZYcFLNX2El7fifv8H6JMhBCt-ttxSow1ozRQ,6787
16
- pypetkitapi-1.16.4.dist-info/LICENSE,sha256=u5jNkZEn6YMrtN4Kr5rU3TcBJ5-eAt0qMx4JDsbsnzM,1074
17
- pypetkitapi-1.16.4.dist-info/METADATA,sha256=OURQVCLN1F8F_3loIGfdeC9NdumumlwkG2v92HcY11A,8633
18
- pypetkitapi-1.16.4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
19
- pypetkitapi-1.16.4.dist-info/RECORD,,
16
+ pypetkitapi-1.16.6.dist-info/LICENSE,sha256=u5jNkZEn6YMrtN4Kr5rU3TcBJ5-eAt0qMx4JDsbsnzM,1074
17
+ pypetkitapi-1.16.6.dist-info/METADATA,sha256=LS7kMY8S3eplrNKxDBWmEDJg9PdiSxe9OWxogfCyMXU,12977
18
+ pypetkitapi-1.16.6.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
19
+ pypetkitapi-1.16.6.dist-info/RECORD,,