pypetkitapi 1.16.4__tar.gz → 1.16.6__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.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.
@@ -37,11 +37,11 @@
37
37
 
38
38
  ---
39
39
 
40
- ## Overview
40
+ ## ℹ️ Overview
41
41
 
42
42
  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.
43
43
 
44
- ## Features
44
+ ## 🚀 Features
45
45
 
46
46
  - Login and session management
47
47
  - Fetch account and device data
@@ -49,7 +49,7 @@ PetKit Client is a Python library for interacting with the PetKit API. It allows
49
49
  - Fetch images & videos produced by devices
50
50
  > Pictures are available **with or without** Care+ subscription, Videos are only available **with** Care+ subscription
51
51
 
52
- ## Installation
52
+ ## ⬇️ Installation
53
53
 
54
54
  Install the library using pip:
55
55
 
@@ -57,7 +57,7 @@ Install the library using pip:
57
57
  pip install pypetkitapi
58
58
  ```
59
59
 
60
- ## Usage Example:
60
+ ## 💡 Usage Example:
61
61
 
62
62
  Here is a simple example of how to use the library to interact with the PetKit API \
63
63
  This example is not an exhaustive list of all the features available in the library.
@@ -116,17 +116,41 @@ if __name__ == "__main__":
116
116
  asyncio.run(main())
117
117
  ```
118
118
 
119
- ## More example usage
119
+ ## 💡 More example usage
120
120
 
121
121
  Check at the usage in the Home Assistant integration : [here](https://github.com/Jezza34000/homeassistant_petkit)
122
122
 
123
- ## Help and Support
123
+ ## ☑️ Supported Devices
124
+
125
+ | **Category** | **Name** | **Device** |
126
+ | ---------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
127
+ | **🍗 Feeders** | ✅ Fresh Element | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/feeder.png" width="40"/></a> |
128
+ | | ✅ 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> |
129
+ | | ✅ Fresh Element Infinity | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d3.png" width="40"/></a> |
130
+ | | ✅ Fresh Element Solo | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d4.png" width="40"/></a> |
131
+ | | ✅ Fresh Element Gemini | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d4s.png" width="40"/></a> |
132
+ | | ✅ YumShare Solo | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d4h.png" width="40"/></a> |
133
+ | | ✅ YumShare Dual-hopper | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/d4sh.png" width="40"/></a> |
134
+ | **🚽 Litters** | ✅ PuraX | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t3.png" width="40"/></a> |
135
+ | | ✅ PuraMax | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t4.1.png" width="40"/></a> |
136
+ | | ✅ PuraMax 2 | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t4.png" width="40"/></a> |
137
+ | | ✅ Purobot Max Pro | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t5.png" width="40"/></a> |
138
+ | | ✅ Purobot Ultra | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/t6.png" width="40"/></a> |
139
+ | **⛲ 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> |
140
+ | | ✅ Eversweet 3 Pro | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/4w5.png" width="40"/></a> |
141
+ | | ✅ 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> |
142
+ | | ✅ Eversweet 5 Mini | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/2w5.png" width="40"/></a> |
143
+ | | ✅ Eversweet Max | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/ctw3.png" width="40"/></a> |
144
+ | **🧴 Purifiers** | ✅ Air Magicube | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/k2.png" width="40"/></a> |
145
+ | | ✅ Air Smart Spray | <a href=""><img src="https://raw.githubusercontent.com/Jezza34000/homeassistant_petkit/refs/heads/main/images/devices/k3.png" width="40"/></a> |
146
+
147
+ ## 🛟 Help and Support
124
148
 
125
149
  Developers? Want to help? Join us on our Discord channel dedicated to developers and contributors.
126
150
 
127
151
  [![Discord][discord-shield]][discord]
128
152
 
129
- ## Contributing
153
+ ## 👨‍💻 Contributing
130
154
 
131
155
  Contributions are welcome!\
132
156
  Please open an issue or submit a pull request.
@@ -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",
@@ -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
@@ -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()
@@ -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"
@@ -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."""
@@ -116,6 +116,7 @@ ignore = [
116
116
  "E501", # line too long
117
117
 
118
118
  "PLC1901", # {existing} can be simplified to {replacement} as an empty string is falsey; too many false positives
119
+ "PLC0415", # import should be at the top-level of a file
119
120
  "PLR0911", # Too many return statements ({returns} > {max_returns})
120
121
  "PLR0912", # Too many branches ({branches} > {max_branches})
121
122
  "PLR0913", # Too many arguments to function call ({c_args} > {max_args})
@@ -186,7 +187,7 @@ build-backend = "poetry.core.masonry.api"
186
187
 
187
188
  [tool.poetry]
188
189
  name = "pypetkitapi"
189
- version = "1.16.4"
190
+ version = "1.16.6"
190
191
  description = "Python client for PetKit API"
191
192
  authors = ["Jezza34000 <info@mail.com>"]
192
193
  readme = "README.md"
@@ -208,7 +209,7 @@ ruff = "^0.8.1"
208
209
  types-aiofiles = "^24.1.0.20240626"
209
210
 
210
211
  [tool.bumpver]
211
- current_version = "1.16.4"
212
+ current_version = "1.16.6"
212
213
  version_pattern = "MAJOR.MINOR.PATCH"
213
214
  commit_message = "bump version {old_version} -> {new_version}"
214
215
  tag_message = "{new_version}"
File without changes