pypetkitapi 1.12.4__tar.gz → 1.12.5__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.4 → pypetkitapi-1.12.5}/PKG-INFO +1 -1
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/__init__.py +1 -1
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/bluetooth.py +15 -8
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/const.py +1 -1
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pyproject.toml +2 -2
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/LICENSE +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/README.md +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/client.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/command.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/containers.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/exceptions.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/feeder_container.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/litter_container.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/media.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/purifier_container.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/py.typed +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/schedule_container.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/utils.py +0 -0
- {pypetkitapi-1.12.4 → pypetkitapi-1.12.5}/pypetkitapi/water_fountain_container.py +0 -0
@@ -88,12 +88,13 @@ class BluetoothManager:
|
|
88
88
|
"""
|
89
89
|
_LOGGER.debug("Opening BLE connection to fountain %s", fountain_id)
|
90
90
|
water_fountain = await self._get_fountain_instance(fountain_id)
|
91
|
-
if await self.check_relay_availability(fountain_id) is False:
|
92
|
-
_LOGGER.debug("BLE relay not available (id: %s).", fountain_id)
|
93
|
-
return False
|
94
91
|
if water_fountain.is_connected is True:
|
95
92
|
_LOGGER.debug("BLE connection already established (id %s)", fountain_id)
|
96
93
|
return True
|
94
|
+
water_fountain.is_connected = False
|
95
|
+
if await self.check_relay_availability(fountain_id) is False:
|
96
|
+
_LOGGER.debug("BLE relay not available (id: %s).", fountain_id)
|
97
|
+
return False
|
97
98
|
response = await self.client.req.request(
|
98
99
|
method=HTTPMethod.POST,
|
99
100
|
url=PetkitEndpoint.BLE_CONNECT,
|
@@ -106,7 +107,6 @@ class BluetoothManager:
|
|
106
107
|
)
|
107
108
|
if response != {"state": 1}:
|
108
109
|
_LOGGER.debug("Unable to open a BLE connection (id %s)", fountain_id)
|
109
|
-
water_fountain.is_connected = False
|
110
110
|
return False
|
111
111
|
for attempt in range(BLE_CONNECT_ATTEMPT):
|
112
112
|
_LOGGER.debug(
|
@@ -125,7 +125,16 @@ class BluetoothManager:
|
|
125
125
|
},
|
126
126
|
headers=await self.client.get_session_id(),
|
127
127
|
)
|
128
|
-
if response ==
|
128
|
+
if response == 0:
|
129
|
+
# Wait for 4 seconds before polling again, connection is still in progress
|
130
|
+
await asyncio.sleep(4)
|
131
|
+
elif response == -1:
|
132
|
+
_LOGGER.debug("Failed to establish BLE connection (id %s)", fountain_id)
|
133
|
+
water_fountain.last_ble_poll = datetime.now().strftime(
|
134
|
+
"%Y-%m-%dT%H:%M:%S.%f"
|
135
|
+
)
|
136
|
+
return False
|
137
|
+
elif response == 1:
|
129
138
|
_LOGGER.debug(
|
130
139
|
"BLE connection established successfully (id %s)", fountain_id
|
131
140
|
)
|
@@ -134,13 +143,11 @@ class BluetoothManager:
|
|
134
143
|
"%Y-%m-%dT%H:%M:%S.%f"
|
135
144
|
)
|
136
145
|
return True
|
137
|
-
await asyncio.sleep(4)
|
138
146
|
_LOGGER.debug(
|
139
|
-
"Failed to establish BLE connection
|
147
|
+
"Failed to establish BLE connection reached the max %s attempts allowed (id %s)",
|
140
148
|
BLE_CONNECT_ATTEMPT,
|
141
149
|
fountain_id,
|
142
150
|
)
|
143
|
-
water_fountain.is_connected = False
|
144
151
|
return False
|
145
152
|
|
146
153
|
async def close_ble_connection(self, fountain_id: int) -> None:
|
@@ -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.5"
|
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.5"
|
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
|
File without changes
|
File without changes
|
File without changes
|