pypetkitapi 1.16.5__py3-none-any.whl → 1.16.7__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.5"
54
+ __version__ = "1.16.7"
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
@@ -832,7 +832,9 @@ class PrepReq:
832
832
 
833
833
  match error_code:
834
834
  case 5:
835
- raise PetkitSessionExpiredError(f"Session expired: {error_msg}")
835
+ raise PetkitSessionExpiredError(
836
+ f"Session expired: {error_msg}. WARNING : Make sure you're not using your main PetKit app account. Use a separate one for Home Assistant. Refer to the documentation for more details."
837
+ )
836
838
  case 122:
837
839
  raise PetkitAuthenticationError(
838
840
  f"Authentication failed: {error_msg}"
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."""
@@ -59,7 +59,7 @@ class Purifier(BaseModel):
59
59
  name: str | None = None
60
60
  refreshing: int | None = None
61
61
  relate_t4: int | None = Field(None, alias="relateT4")
62
- relation: dict[str, str]
62
+ relation: dict[str, str] | list | None = None
63
63
  secret: str | None = None
64
64
  settings: Settings | None = None
65
65
  share_open: int | None = Field(None, alias="shareOpen")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pypetkitapi
3
- Version: 1.16.5
3
+ Version: 1.16.7
4
4
  Summary: Python client for PetKit API
5
5
  License: MIT
6
6
  Author: Jezza34000
@@ -1,19 +1,19 @@
1
- pypetkitapi/__init__.py,sha256=ti-6WmzoeF-c9ub3E-LFeGfwENbtdmEDY4hdNNV-5EY,2107
2
- pypetkitapi/bluetooth.py,sha256=1zEZIrKNTttrZpqBiQ-6V37Uphft5_T8CH9OBfYjwxE,9915
3
- pypetkitapi/client.py,sha256=nZJnjcCi3T0rSbJ0yTMKIFJPgPH8hkAEPqMCnJ3Q0Pg,31101
1
+ pypetkitapi/__init__.py,sha256=Rb90lEdrCe8AUFNa5ZP4erGwBGUWWFCbW8m4D284D_s,2107
2
+ pypetkitapi/bluetooth.py,sha256=VNoJ3E9WXzEfqRoWwKiemITKIt9aa9ICRzDvFuJ3PP0,9915
3
+ pypetkitapi/client.py,sha256=D49j-5oks0iJDgQbHKDyapZjhtfCNE7rrowl3yL_YSk,31299
4
4
  pypetkitapi/command.py,sha256=zw4h1SCInG2T0-wAA_al59_FTL36TUZldtJkYKw6ATI,7655
5
5
  pypetkitapi/const.py,sha256=7SDIADq3WxauFpDBARv9VxiCQTG2ZCYyShRLRCyf4WE,4832
6
- pypetkitapi/containers.py,sha256=7wYKmaoBpMKrqIVMsoD4Iv2in7Kh5nNxrl4vC4eF2fg,6305
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
10
10
  pypetkitapi/media.py,sha256=LNY3khU5eZN4i1MGHxJaPHcf3LA1fFaPVkn-wdn0YLI,27168
11
- pypetkitapi/purifier_container.py,sha256=mAnvPF8Mm6YI43fitdxXEWScshM6sPg0KK6GXbylU1I,3179
11
+ pypetkitapi/purifier_container.py,sha256=NlDZ2eAuD3xnqLGfFzaXErQXBPHjSbUI9tXln5K9mG4,3200
12
12
  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.5.dist-info/LICENSE,sha256=u5jNkZEn6YMrtN4Kr5rU3TcBJ5-eAt0qMx4JDsbsnzM,1074
17
- pypetkitapi-1.16.5.dist-info/METADATA,sha256=A91p5BhuysTKC0neY93QRH_RUcAazyte6WoElgn0YbU,12977
18
- pypetkitapi-1.16.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
19
- pypetkitapi-1.16.5.dist-info/RECORD,,
16
+ pypetkitapi-1.16.7.dist-info/LICENSE,sha256=u5jNkZEn6YMrtN4Kr5rU3TcBJ5-eAt0qMx4JDsbsnzM,1074
17
+ pypetkitapi-1.16.7.dist-info/METADATA,sha256=I6V_TNI6ZgmysTEGv_6Z03E8yXtI3gYNTTAv2tFQDNA,12977
18
+ pypetkitapi-1.16.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
19
+ pypetkitapi-1.16.7.dist-info/RECORD,,