zcc-helper 3.7.dev1__tar.gz → 3.8__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.7.dev1/zcc_helper.egg-info → zcc_helper-3.8}/PKG-INFO +1 -1
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/constants.py +1 -1
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/controller.py +24 -5
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/device.py +4 -2
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/protocol.py +3 -2
- {zcc_helper-3.7.dev1 → zcc_helper-3.8/zcc_helper.egg-info}/PKG-INFO +1 -1
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/LICENSE.txt +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/README.md +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/setup.cfg +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/setup.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/tests/test_device.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/__init__.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/__main__.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/description.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/discovery.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/errors.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/manufacture_info.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/socket.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/trace.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc/watchdog.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc.py +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc_helper.egg-info/SOURCES.txt +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc_helper.egg-info/dependency_links.txt +0 -0
- {zcc_helper-3.7.dev1 → zcc_helper-3.8}/zcc_helper.egg-info/top_level.txt +0 -0
|
@@ -10,6 +10,9 @@ import socket
|
|
|
10
10
|
import time
|
|
11
11
|
import uuid
|
|
12
12
|
from pprint import pformat
|
|
13
|
+
|
|
14
|
+
# Set to True to ignore missing device states during initial fetch
|
|
15
|
+
IGNORE_MISSING_STATES = True
|
|
13
16
|
from typing import Dict, List
|
|
14
17
|
|
|
15
18
|
from zcc.constants import LEVEL_BY_VERBOSITY, NAME, VERSION
|
|
@@ -138,6 +141,11 @@ class ControlPoint:
|
|
|
138
141
|
filter(lambda device: device.type == "garagedoor", self.devices.values())
|
|
139
142
|
)
|
|
140
143
|
|
|
144
|
+
@property
|
|
145
|
+
def warnings(self) -> List[ControlPointDevice]:
|
|
146
|
+
"""Return a list of devices with empty or missing states (incomplete data)."""
|
|
147
|
+
return [device for device in self.devices.values() if not device.states]
|
|
148
|
+
|
|
141
149
|
async def connect(self, fast: bool = False) -> bool:
|
|
142
150
|
"""Connect to ZCC, build device table and subscribe to updates"""
|
|
143
151
|
self.logger.info("Connecting to ZCC %s:%d", self.host, self.port)
|
|
@@ -263,7 +271,7 @@ class ControlPoint:
|
|
|
263
271
|
self.disconnect()
|
|
264
272
|
|
|
265
273
|
def describe(self) -> str:
|
|
266
|
-
"""Return a string representation of ZCC including devices"""
|
|
274
|
+
"""Return a string representation of ZCC including devices and warnings."""
|
|
267
275
|
header = "+" + "-" * 130 + "+"
|
|
268
276
|
if self.host:
|
|
269
277
|
description = header + "\n"
|
|
@@ -300,6 +308,12 @@ class ControlPoint:
|
|
|
300
308
|
)
|
|
301
309
|
)
|
|
302
310
|
description += header + "\n"
|
|
311
|
+
|
|
312
|
+
# Add warnings section if there are devices with incomplete data
|
|
313
|
+
if self.warnings:
|
|
314
|
+
description += "| WARNING: One or more devices have incomplete data. Check for WARNINGS and upgrade firmware with Zimi app |\n"
|
|
315
|
+
description += "+" + "-" * 130 + "+\n"
|
|
316
|
+
|
|
303
317
|
description_details = []
|
|
304
318
|
for key in self.manufacture_infos:
|
|
305
319
|
description_details.append(self.manufacture_infos[key].describe())
|
|
@@ -339,7 +353,7 @@ class ControlPoint:
|
|
|
339
353
|
try:
|
|
340
354
|
await asyncio.wait_for(
|
|
341
355
|
self.manufacture_info_ready,
|
|
342
|
-
timeout=ControlPointProtocol.
|
|
356
|
+
timeout=ControlPointProtocol.DEVICE_INFO_TIMEOUT,
|
|
343
357
|
)
|
|
344
358
|
except asyncio.exceptions.TimeoutError as error:
|
|
345
359
|
raise ControlPointError(
|
|
@@ -390,9 +404,14 @@ class ControlPoint:
|
|
|
390
404
|
self.states_ready, timeout=ControlPointProtocol.DEVICE_GET_TIMEOUT
|
|
391
405
|
)
|
|
392
406
|
except asyncio.exceptions.TimeoutError as error:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
407
|
+
if IGNORE_MISSING_STATES:
|
|
408
|
+
self.logger.info(
|
|
409
|
+
"ZCC connection warning - timeout waiting for device states."
|
|
410
|
+
)
|
|
411
|
+
else:
|
|
412
|
+
raise ControlPointError(
|
|
413
|
+
"ZCC connection failed - didn't receive any states."
|
|
414
|
+
) from error
|
|
396
415
|
|
|
397
416
|
await asyncio.sleep(ControlPointProtocol.STEP_TIMEOUT)
|
|
398
417
|
|
|
@@ -64,6 +64,8 @@ class ControlPointDevice:
|
|
|
64
64
|
@property
|
|
65
65
|
def __states(self) -> str:
|
|
66
66
|
"""Gets a descriptive string of the device state"""
|
|
67
|
+
if self.type == "behaviourlink":
|
|
68
|
+
return ""
|
|
67
69
|
description = ""
|
|
68
70
|
try:
|
|
69
71
|
key = list(self.states["controlState"].keys())[0]
|
|
@@ -76,9 +78,9 @@ class ControlPointDevice:
|
|
|
76
78
|
if fan_speed:
|
|
77
79
|
description += "/" + str(fan_speed)
|
|
78
80
|
except IndexError:
|
|
79
|
-
|
|
81
|
+
description = "WARNING"
|
|
80
82
|
except KeyError:
|
|
81
|
-
|
|
83
|
+
description = "WARNING"
|
|
82
84
|
return description
|
|
83
85
|
|
|
84
86
|
@property
|
|
@@ -16,7 +16,8 @@ class ControlPointProtocol:
|
|
|
16
16
|
START_SESSION_FAILED = "start_session_failed"
|
|
17
17
|
START_SESSION_SUCCESS = "start_session_success"
|
|
18
18
|
START_SESSION_TIMEOUT = 30
|
|
19
|
-
DEVICE_GET_TIMEOUT =
|
|
19
|
+
DEVICE_GET_TIMEOUT = 30
|
|
20
|
+
DEVICE_INFO_TIMEOUT = 120
|
|
20
21
|
CONTROLPOINT_PROPERTIES = "controlpoint_properties"
|
|
21
22
|
CONTROLPOINT_STATES = "controlpoint_states"
|
|
22
23
|
CONTROLPOINT_ACTIONS = "controlpoint_actions"
|
|
@@ -58,7 +59,7 @@ class ControlPointProtocol:
|
|
|
58
59
|
@classmethod
|
|
59
60
|
def discover(cls) -> str:
|
|
60
61
|
"""Return the discover message to be broadcast on LAN."""
|
|
61
|
-
return "ZIMI
|
|
62
|
+
return "ZIMI"
|
|
62
63
|
|
|
63
64
|
@classmethod
|
|
64
65
|
def get(cls, target: str) -> str:
|
|
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
|