zcc-helper 3.6.dev18__tar.gz → 3.6.dev20__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.
- {zcc_helper-3.6.dev18/zcc_helper.egg-info → zcc_helper-3.6.dev20}/PKG-INFO +1 -1
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/constants.py +1 -1
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/device.py +15 -13
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20/zcc_helper.egg-info}/PKG-INFO +1 -1
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/LICENSE.txt +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/README.md +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/setup.cfg +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/setup.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/tests/test_device.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/__init__.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/__main__.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/controller.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/description.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/discovery.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/errors.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/manufacture_info.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/protocol.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/socket.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/trace.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc/watchdog.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc_helper.egg-info/SOURCES.txt +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc_helper.egg-info/dependency_links.txt +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev20}/zcc_helper.egg-info/top_level.txt +0 -0
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
|
-
import asyncio
|
|
8
|
-
|
|
9
7
|
from pprint import pformat
|
|
10
8
|
|
|
11
9
|
from zcc.errors import ControlPointError
|
|
12
10
|
from zcc.manufacture_info import ControlPointManufactureInfo
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
OPEN_AND_CLOSE_TOLERANCE = 5
|
|
15
13
|
OPEN_AND_CLOSE_WORKAROUND = True
|
|
16
14
|
|
|
17
15
|
|
|
@@ -173,6 +171,11 @@ class ControlPointDevice:
|
|
|
173
171
|
def is_closing(self) -> bool:
|
|
174
172
|
"""Returns True if door is closing."""
|
|
175
173
|
if self.percentage and self._target_percentage:
|
|
174
|
+
if (
|
|
175
|
+
abs(self.percentage - self._target_percentage)
|
|
176
|
+
<= OPEN_AND_CLOSE_TOLERANCE
|
|
177
|
+
):
|
|
178
|
+
return False
|
|
176
179
|
return self.percentage > self._target_percentage and not self.is_closed
|
|
177
180
|
return False
|
|
178
181
|
|
|
@@ -181,7 +184,7 @@ class ControlPointDevice:
|
|
|
181
184
|
"""Returns True if door is closed."""
|
|
182
185
|
|
|
183
186
|
if self.percentage:
|
|
184
|
-
return self.percentage <=
|
|
187
|
+
return self.percentage <= OPEN_AND_CLOSE_TOLERANCE
|
|
185
188
|
return True
|
|
186
189
|
|
|
187
190
|
@property
|
|
@@ -214,8 +217,12 @@ class ControlPointDevice:
|
|
|
214
217
|
@property
|
|
215
218
|
def is_opening(self) -> bool:
|
|
216
219
|
"""Returns True if door is opening and is NOT already open."""
|
|
217
|
-
|
|
218
220
|
if self.percentage and self._target_percentage:
|
|
221
|
+
if (
|
|
222
|
+
abs(self.percentage - self._target_percentage)
|
|
223
|
+
<= OPEN_AND_CLOSE_TOLERANCE
|
|
224
|
+
):
|
|
225
|
+
return False
|
|
219
226
|
return self.percentage < self._target_percentage and not self.is_open
|
|
220
227
|
return False
|
|
221
228
|
|
|
@@ -224,7 +231,7 @@ class ControlPointDevice:
|
|
|
224
231
|
"""Returns True if door is open."""
|
|
225
232
|
|
|
226
233
|
if self.percentage:
|
|
227
|
-
return self.percentage >= 100 -
|
|
234
|
+
return self.percentage >= 100 - OPEN_AND_CLOSE_TOLERANCE
|
|
228
235
|
return False
|
|
229
236
|
|
|
230
237
|
@property
|
|
@@ -259,17 +266,12 @@ class ControlPointDevice:
|
|
|
259
266
|
|
|
260
267
|
async def open_to_percentage(self, percentage):
|
|
261
268
|
"""OpenToPercentage if the action is supported"""
|
|
269
|
+
if OPEN_AND_CLOSE_WORKAROUND and percentage == 0:
|
|
270
|
+
percentage = 1
|
|
262
271
|
self._target_percentage = percentage
|
|
263
272
|
await self.__action(
|
|
264
273
|
"OpenToPercentage", params={"openpercentage": int(percentage)}
|
|
265
274
|
)
|
|
266
|
-
if OPEN_AND_CLOSE_WORKAROUND:
|
|
267
|
-
wait_time = 10
|
|
268
|
-
while self.percentage != percentage:
|
|
269
|
-
await asyncio.sleep(1)
|
|
270
|
-
wait_time -= 1
|
|
271
|
-
if wait_time <= 0:
|
|
272
|
-
break
|
|
273
275
|
|
|
274
276
|
@property
|
|
275
277
|
def percentage(self) -> int | None:
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|