zcc-helper 3.6.dev18__tar.gz → 3.6.dev19__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.dev19}/PKG-INFO +1 -1
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/constants.py +1 -1
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/device.py +9 -13
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19/zcc_helper.egg-info}/PKG-INFO +1 -1
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/LICENSE.txt +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/README.md +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/setup.cfg +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/setup.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/tests/test_device.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/__init__.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/__main__.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/controller.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/description.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/discovery.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/errors.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/manufacture_info.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/protocol.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/socket.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/trace.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc/watchdog.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc.py +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc_helper.egg-info/SOURCES.txt +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/zcc_helper.egg-info/dependency_links.txt +0 -0
- {zcc_helper-3.6.dev18 → zcc_helper-3.6.dev19}/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
|
|
|
@@ -172,6 +170,8 @@ class ControlPointDevice:
|
|
|
172
170
|
@property
|
|
173
171
|
def is_closing(self) -> bool:
|
|
174
172
|
"""Returns True if door is closing."""
|
|
173
|
+
if abs(self.percentage - self._target_percentage) <= OPEN_AND_CLOSE_TOLERANCE:
|
|
174
|
+
return False
|
|
175
175
|
if self.percentage and self._target_percentage:
|
|
176
176
|
return self.percentage > self._target_percentage and not self.is_closed
|
|
177
177
|
return False
|
|
@@ -181,7 +181,7 @@ class ControlPointDevice:
|
|
|
181
181
|
"""Returns True if door is closed."""
|
|
182
182
|
|
|
183
183
|
if self.percentage:
|
|
184
|
-
return self.percentage <=
|
|
184
|
+
return self.percentage <= OPEN_AND_CLOSE_TOLERANCE
|
|
185
185
|
return True
|
|
186
186
|
|
|
187
187
|
@property
|
|
@@ -214,7 +214,8 @@ class ControlPointDevice:
|
|
|
214
214
|
@property
|
|
215
215
|
def is_opening(self) -> bool:
|
|
216
216
|
"""Returns True if door is opening and is NOT already open."""
|
|
217
|
-
|
|
217
|
+
if abs(self.percentage - self._target_percentage) <= OPEN_AND_CLOSE_TOLERANCE:
|
|
218
|
+
return False
|
|
218
219
|
if self.percentage and self._target_percentage:
|
|
219
220
|
return self.percentage < self._target_percentage and not self.is_open
|
|
220
221
|
return False
|
|
@@ -224,7 +225,7 @@ class ControlPointDevice:
|
|
|
224
225
|
"""Returns True if door is open."""
|
|
225
226
|
|
|
226
227
|
if self.percentage:
|
|
227
|
-
return self.percentage >= 100 -
|
|
228
|
+
return self.percentage >= 100 - OPEN_AND_CLOSE_TOLERANCE
|
|
228
229
|
return False
|
|
229
230
|
|
|
230
231
|
@property
|
|
@@ -259,17 +260,12 @@ class ControlPointDevice:
|
|
|
259
260
|
|
|
260
261
|
async def open_to_percentage(self, percentage):
|
|
261
262
|
"""OpenToPercentage if the action is supported"""
|
|
263
|
+
if OPEN_AND_CLOSE_WORKAROUND and percentage == 0:
|
|
264
|
+
percentage = 1
|
|
262
265
|
self._target_percentage = percentage
|
|
263
266
|
await self.__action(
|
|
264
267
|
"OpenToPercentage", params={"openpercentage": int(percentage)}
|
|
265
268
|
)
|
|
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
269
|
|
|
274
270
|
@property
|
|
275
271
|
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
|