pystuderxcom 3.6.0__tar.gz → 3.6.1__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.
- {pystuderxcom-3.6.0/src/pystuderxcom.egg-info → pystuderxcom-3.6.1}/PKG-INFO +1 -1
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/pyproject.toml +1 -1
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/__init__.py +3 -2
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/api_base_async.py +6 -1
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/api_base_sync.py +8 -2
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/const.py +3 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/shared/studer_valueset.py +18 -5
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/values.py +0 -2
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1/src/pystuderxcom.egg-info}/PKG-INFO +1 -1
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/LICENSE +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/README.md +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/setup.cfg +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/api_serial.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/api_tcp.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/api_udp.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/data.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/datapoints.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/datapoints_120v.json +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/datapoints_240v.json +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/datapoints_xcom.json +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/discover_async.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/discover_sync.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/families.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/messages.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/messages_en.json +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/protocol.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/shared/helpers.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/shared/studer_dataset.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/shared/studer_families.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/shared/studer_interfaces_async.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/shared/studer_interfaces_sync.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/shared/studer_messageset.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/shared/studer_types.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom.egg-info/SOURCES.txt +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom.egg-info/dependency_links.txt +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom.egg-info/requires.txt +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom.egg-info/top_level.txt +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_api_base_async.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_api_base_sync.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_api_serial_async.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_api_serial_sync.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_api_tcp_async.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_api_tcp_sync.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_api_udp_async.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_api_udp_sync.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_const.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_data.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_datapoints.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_discover_async.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_discover_sync.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_families.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_messages.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_package_async.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_package_sync.py +0 -0
- {pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/tests/test_values.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pystuderxcom
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.1
|
|
4
4
|
Summary: Python library to communicate with Studer-Innotec devices on the local network via Xcom protocol
|
|
5
5
|
Author-email: Anko Hanse <anko_hanse@hotmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/ankohanse/pystuderxcom
|
|
@@ -4,8 +4,9 @@ from .shared.studer_types import StuderParamException
|
|
|
4
4
|
from .shared.studer_dataset import StuderDataset, StuderDatapoint, StuderDatapointUnknownException, StuderDatapointSyntaxException, StuderDatapointEnumNotFoundException
|
|
5
5
|
from .shared.studer_families import StuderDeviceFamily, StuderDeviceFamilies, StuderDeviceFamilyUnknownException, StuderDeviceCodeUnknownException, StuderDeviceAddressUnknownException, StuderDeviceSlaveUnknownException
|
|
6
6
|
from .shared.studer_messageset import StuderMessageSet, StuderMessageDef, StuderMessageUnknownException, StuderMessageSyntaxException
|
|
7
|
-
from .shared.studer_interfaces_async import AsyncStuderDiscover, StuderDiscoverFlags
|
|
8
|
-
from .shared.studer_interfaces_sync import StuderDiscover
|
|
7
|
+
from .shared.studer_interfaces_async import AsyncStuderApi, AsyncStuderDiscover, StuderDiscoverFlags
|
|
8
|
+
from .shared.studer_interfaces_sync import StuderApi, StuderDiscover
|
|
9
|
+
from .shared.studer_valueset import StuderValueSet, StuderValueItem
|
|
9
10
|
|
|
10
11
|
from .api_tcp import AsyncXcomApiTcp, XcomApiTcp
|
|
11
12
|
from .api_udp import AsyncXcomApiUdp, XcomApiUdp
|
|
@@ -12,6 +12,7 @@ from .shared.studer_interfaces_async import AsyncStuderApi
|
|
|
12
12
|
from .shared.studer_interfaces_sync import StuderApi
|
|
13
13
|
from .shared.studer_types import StuderAccess, StuderDataType, StuderDiscoveredDevice, StuderTarget, StuderUserLevel
|
|
14
14
|
from .shared.studer_dataset import StuderDatapoint
|
|
15
|
+
from .shared.studer_valueset import StuderValueSet, StuderValueItem
|
|
15
16
|
from .const import START_TIMEOUT, STOP_TIMEOUT, REQ_TIMEOUT, REQ_RETRIES, REQ_BURST_PERIOD
|
|
16
17
|
from .const import ScomAddress, XcomAggregationType, ScomFrameFlag, ScomObjType, ScomObjId, ScomServiceId, ScomQspId
|
|
17
18
|
from .const import XcomApiReadException, XcomApiWriteException, XcomApiUnpackException, XcomApiTimeoutException, XcomApiResponseIsError, XcomParamException
|
|
@@ -294,7 +295,7 @@ class AsyncXcomApiBase(AsyncStuderApi):
|
|
|
294
295
|
raise XcomApiUnpackException(msg) from None
|
|
295
296
|
|
|
296
297
|
|
|
297
|
-
async def request_values(self, request_data:
|
|
298
|
+
async def request_values(self, request_data: StuderValueSet, retries = None, timeout = None, verbose=False) -> StuderValueSet:
|
|
298
299
|
"""
|
|
299
300
|
Request multiple infos, params or virtuals in one call.
|
|
300
301
|
Can only retrieve actual device values, NOT the average or sum over multiple devices.
|
|
@@ -319,6 +320,10 @@ class AsyncXcomApiBase(AsyncStuderApi):
|
|
|
319
320
|
idx_last = safe_len(request_data.items)-1
|
|
320
321
|
|
|
321
322
|
for idx,item in enumerate(request_data.items):
|
|
323
|
+
|
|
324
|
+
# If needed, cast StuderValueItem into XcomValueItem so that extra fields are resolved
|
|
325
|
+
if not isinstance(item, XcomValueItem) and isinstance(item, StuderValueItem):
|
|
326
|
+
item = XcomValueItem(datapoint=item.datapoint, device=item.code or item.address)
|
|
322
327
|
|
|
323
328
|
match item.datapoint.target:
|
|
324
329
|
case StuderTarget.VIRTUAL:
|
|
@@ -14,6 +14,7 @@ from .shared.studer_interfaces_async import AsyncStuderApi
|
|
|
14
14
|
from .shared.studer_interfaces_sync import StuderApi
|
|
15
15
|
from .shared.studer_types import StuderAccess, StuderDataType, StuderDiscoveredDevice, StuderTarget, StuderUserLevel
|
|
16
16
|
from .shared.studer_dataset import StuderDatapoint
|
|
17
|
+
from .shared.studer_valueset import StuderValueSet, StuderValueItem
|
|
17
18
|
from .const import START_TIMEOUT, STOP_TIMEOUT, REQ_TIMEOUT, REQ_RETRIES, REQ_BURST_PERIOD
|
|
18
19
|
from .const import ScomAddress, XcomAggregationType, ScomFrameFlag, ScomObjType, ScomObjId, ScomServiceId, ScomQspId
|
|
19
20
|
from .const import XcomApiReadException, XcomApiWriteException, XcomApiUnpackException, XcomApiTimeoutException, XcomApiResponseIsError, XcomParamException
|
|
@@ -23,8 +24,8 @@ from .families import XcomDeviceFamilies
|
|
|
23
24
|
from .messages import XcomMessage, XcomMessageSet
|
|
24
25
|
from .protocol import XcomFrame, XcomHeader, XcomPackage
|
|
25
26
|
from .values import XcomValueSet, XcomValueItem
|
|
26
|
-
import time
|
|
27
27
|
import threading
|
|
28
|
+
import time
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
_LOGGER = logging.getLogger(__name__)
|
|
@@ -298,7 +299,7 @@ class XcomApiBase(StuderApi):
|
|
|
298
299
|
raise XcomApiUnpackException(msg) from None
|
|
299
300
|
|
|
300
301
|
|
|
301
|
-
def request_values(self, request_data:
|
|
302
|
+
def request_values(self, request_data: StuderValueSet, retries = None, timeout = None, verbose=False) -> StuderValueSet:
|
|
302
303
|
"""
|
|
303
304
|
Request multiple infos, params or virtuals in one call.
|
|
304
305
|
Can only retrieve actual device values, NOT the average or sum over multiple devices.
|
|
@@ -323,6 +324,10 @@ class XcomApiBase(StuderApi):
|
|
|
323
324
|
idx_last = safe_len(request_data.items)-1
|
|
324
325
|
|
|
325
326
|
for idx,item in enumerate(request_data.items):
|
|
327
|
+
|
|
328
|
+
# If needed, cast StuderValueItem into XcomValueItem so that extra fields are resolved
|
|
329
|
+
if not isinstance(item, XcomValueItem) and isinstance(item, StuderValueItem):
|
|
330
|
+
item = XcomValueItem(datapoint=item.datapoint, device=item.code or item.address)
|
|
326
331
|
|
|
327
332
|
match item.datapoint.target:
|
|
328
333
|
case StuderTarget.VIRTUAL:
|
|
@@ -343,6 +348,7 @@ class XcomApiBase(StuderApi):
|
|
|
343
348
|
req_multi_items.append(item)
|
|
344
349
|
|
|
345
350
|
elif item.address is not None:
|
|
351
|
+
|
|
346
352
|
# Any others need to be done via an individual request_value cal
|
|
347
353
|
req_singles.append(item)
|
|
348
354
|
|
|
@@ -13,6 +13,9 @@ from .shared.studer_types import (
|
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
class XcomApiConnectException(Exception):
|
|
17
|
+
"""Exception to indicate failure to connect to the xcom client"""
|
|
18
|
+
|
|
16
19
|
class XcomApiWriteException(Exception):
|
|
17
20
|
"""Exception to indicate failure while writing data to the xcom client"""
|
|
18
21
|
|
|
@@ -17,14 +17,24 @@ from .studer_dataset import StuderDatapoint
|
|
|
17
17
|
_LOGGER = logging.getLogger(__name__)
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
@dataclass
|
|
21
20
|
class StuderValueItem():
|
|
22
21
|
datapoint: StuderDatapoint # Both in request and response
|
|
23
|
-
code: str
|
|
24
|
-
address_or_slave: int
|
|
25
|
-
value: Any
|
|
22
|
+
code: str # Both in request and response
|
|
23
|
+
address_or_slave: int # Both in request and response
|
|
24
|
+
value: Any | None # Only in response from request_values()
|
|
26
25
|
error: str|None # Only in response from request_values()
|
|
27
26
|
|
|
27
|
+
def __init__(self, datapoint: StuderDatapoint, code: str=None, address_or_slave: int=None, value: Any=None, error: str=None):
|
|
28
|
+
|
|
29
|
+
if code is None and address_or_slave is None:
|
|
30
|
+
raise StuderParamException(f"At least one of parameters 'code' or 'address_or_slave' must be specified")
|
|
31
|
+
|
|
32
|
+
self.datapoint = datapoint
|
|
33
|
+
self.code = code
|
|
34
|
+
self.address_or_slave = address_or_slave
|
|
35
|
+
self.value = value
|
|
36
|
+
self.error = error
|
|
37
|
+
|
|
28
38
|
@property
|
|
29
39
|
def address(self):
|
|
30
40
|
return self.address_or_slave
|
|
@@ -34,7 +44,10 @@ class StuderValueItem():
|
|
|
34
44
|
return self.address_or_slave
|
|
35
45
|
|
|
36
46
|
|
|
37
|
-
class StuderValueSet(
|
|
47
|
+
class StuderValueSet():
|
|
38
48
|
items: Iterable[StuderValueItem] # Both in request and response
|
|
39
49
|
|
|
50
|
+
def __init__(self, items: Iterable[StuderValueItem] ):
|
|
51
|
+
self.items = items
|
|
52
|
+
|
|
40
53
|
|
|
@@ -29,7 +29,6 @@ from .families import XcomDeviceFamilies
|
|
|
29
29
|
_LOGGER = logging.getLogger(__name__)
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
@dataclass
|
|
33
32
|
class XcomValueItem(StuderValueItem):
|
|
34
33
|
# From parent class:
|
|
35
34
|
# datapoint: StuderDatapoint # Both in request and response, for request_infos and request_values
|
|
@@ -77,7 +76,6 @@ class XcomValueItem(StuderValueItem):
|
|
|
77
76
|
self.error = error
|
|
78
77
|
|
|
79
78
|
|
|
80
|
-
@dataclass
|
|
81
79
|
class XcomValueSet(StuderValueSet):
|
|
82
80
|
# From parent
|
|
83
81
|
# items: Iterable[StuderValueItem] # Both in request and response
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pystuderxcom
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.1
|
|
4
4
|
Summary: Python library to communicate with Studer-Innotec devices on the local network via Xcom protocol
|
|
5
5
|
Author-email: Anko Hanse <anko_hanse@hotmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/ankohanse/pystuderxcom
|
|
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
|
{pystuderxcom-3.6.0 → pystuderxcom-3.6.1}/src/pystuderxcom/shared/studer_interfaces_async.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|