pystuderxcom 3.6.0__tar.gz → 3.6.2__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.
Files changed (56) hide show
  1. {pystuderxcom-3.6.0/src/pystuderxcom.egg-info → pystuderxcom-3.6.2}/PKG-INFO +1 -1
  2. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/pyproject.toml +1 -1
  3. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/__init__.py +3 -2
  4. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/api_base_async.py +6 -1
  5. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/api_base_sync.py +8 -2
  6. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/const.py +3 -0
  7. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_dataset.py +2 -2
  8. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_families.py +1 -1
  9. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_messageset.py +2 -2
  10. pystuderxcom-3.6.2/src/pystuderxcom/shared/studer_valueset.py +63 -0
  11. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/values.py +0 -2
  12. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2/src/pystuderxcom.egg-info}/PKG-INFO +1 -1
  13. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_api_base_async.py +32 -1
  14. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_api_base_sync.py +32 -1
  15. pystuderxcom-3.6.0/src/pystuderxcom/shared/studer_valueset.py +0 -40
  16. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/LICENSE +0 -0
  17. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/README.md +0 -0
  18. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/setup.cfg +0 -0
  19. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/api_serial.py +0 -0
  20. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/api_tcp.py +0 -0
  21. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/api_udp.py +0 -0
  22. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/data.py +0 -0
  23. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/datapoints.py +0 -0
  24. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/datapoints_120v.json +0 -0
  25. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/datapoints_240v.json +0 -0
  26. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/datapoints_xcom.json +0 -0
  27. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/discover_async.py +0 -0
  28. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/discover_sync.py +0 -0
  29. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/families.py +0 -0
  30. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/messages.py +0 -0
  31. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/messages_en.json +0 -0
  32. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/protocol.py +0 -0
  33. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/helpers.py +0 -0
  34. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_interfaces_async.py +0 -0
  35. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_interfaces_sync.py +0 -0
  36. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_types.py +0 -0
  37. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom.egg-info/SOURCES.txt +0 -0
  38. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom.egg-info/dependency_links.txt +0 -0
  39. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom.egg-info/requires.txt +0 -0
  40. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/src/pystuderxcom.egg-info/top_level.txt +0 -0
  41. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_api_serial_async.py +0 -0
  42. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_api_serial_sync.py +0 -0
  43. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_api_tcp_async.py +0 -0
  44. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_api_tcp_sync.py +0 -0
  45. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_api_udp_async.py +0 -0
  46. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_api_udp_sync.py +0 -0
  47. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_const.py +0 -0
  48. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_data.py +0 -0
  49. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_datapoints.py +0 -0
  50. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_discover_async.py +0 -0
  51. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_discover_sync.py +0 -0
  52. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_families.py +0 -0
  53. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_messages.py +0 -0
  54. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_package_async.py +0 -0
  55. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_package_sync.py +0 -0
  56. {pystuderxcom-3.6.0 → pystuderxcom-3.6.2}/tests/test_values.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pystuderxcom
3
- Version: 3.6.0
3
+ Version: 3.6.2
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pystuderxcom"
3
- version = "3.6.0"
3
+ version = "3.6.2"
4
4
  authors = [
5
5
  { name="Anko Hanse", email="anko_hanse@hotmail.com" },
6
6
  ]
@@ -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: XcomValueSet, retries = None, timeout = None, verbose=False) -> XcomValueSet:
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: XcomValueSet, retries = None, timeout = None, verbose=False) -> XcomValueSet:
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
 
@@ -10,14 +10,14 @@ import logging
10
10
 
11
11
  from dataclasses import dataclass
12
12
 
13
- from .studer_types import (
13
+ from ..shared.studer_types import (
14
14
  StuderAccess,
15
15
  StuderDataType,
16
16
  StuderTarget,
17
17
  StuderUserLevel,
18
18
  StuderParamException,
19
19
  )
20
- from .studer_families import (
20
+ from ..shared.studer_families import (
21
21
  StuderDeviceFamilies,
22
22
  StuderDeviceFamily,
23
23
  StuderDeviceFamilyUnknownException,
@@ -10,7 +10,7 @@ import logging
10
10
 
11
11
  from dataclasses import dataclass
12
12
 
13
- from .studer_types import (
13
+ from ..shared.studer_types import (
14
14
  StuderAccess,
15
15
  StuderDataType,
16
16
  StuderTarget,
@@ -10,14 +10,14 @@ import logging
10
10
 
11
11
  from dataclasses import dataclass
12
12
 
13
- from .studer_types import (
13
+ from ..shared.studer_types import (
14
14
  StuderAccess,
15
15
  StuderDataType,
16
16
  StuderTarget,
17
17
  StuderUserLevel,
18
18
  StuderParamException,
19
19
  )
20
- from .studer_families import (
20
+ from ..shared.studer_families import (
21
21
  StuderDeviceFamilies,
22
22
  StuderDeviceFamily,
23
23
  StuderDeviceFamilyUnknownException,
@@ -0,0 +1,63 @@
1
+ """
2
+ Shared Data Types
3
+
4
+ Note that this file is shared as is between pystuderxcom and pystudernext.
5
+ Do not place code that is specific to only one of these libraries in here!
6
+ """
7
+
8
+ import logging
9
+
10
+ from dataclasses import dataclass
11
+ from enum import IntEnum, StrEnum
12
+ from typing import Any, Iterable
13
+
14
+ from ..shared.studer_dataset import StuderDatapoint
15
+ from ..shared.studer_types import StuderDiscoveredDevice, StuderParamException
16
+
17
+
18
+ _LOGGER = logging.getLogger(__name__)
19
+
20
+
21
+ class StuderValueItem():
22
+ datapoint: StuderDatapoint # Both in request and response
23
+ code: str # Both in request and response
24
+ address_or_slave: int # Both in request and response (Xcom uses address, Next uses slave)
25
+ value: Any | None # Only in response from request_values()
26
+ error: str|None # Only in response from request_values()
27
+
28
+ def __init__(self, datapoint: StuderDatapoint, device: StuderDiscoveredDevice|int|str, value: Any=None, error: str=None):
29
+
30
+ self.datapoint = datapoint
31
+
32
+ # Fill the code, address or slave properties we know, rest will be determined from family in derived class
33
+ if isinstance(device, StuderDiscoveredDevice):
34
+ self.code = device.code
35
+ self.address_or_slave = device.address or device.slave
36
+ elif isinstance(device, int):
37
+ self.address_or_slave = device
38
+ self.code = None
39
+ elif isinstance(device, str):
40
+ self.code = device
41
+ self.address_or_slave = None
42
+ else:
43
+ raise StuderParamException(f"Parameter 'device' must be a StuderDiscoveredDevice, device address or a device code")
44
+
45
+ self.value = value
46
+ self.error = error
47
+
48
+ @property
49
+ def address(self):
50
+ return self.address_or_slave
51
+
52
+ @property
53
+ def slave(self):
54
+ return self.address_or_slave
55
+
56
+
57
+ class StuderValueSet():
58
+ items: Iterable[StuderValueItem] # Both in request and response
59
+
60
+ def __init__(self, items: Iterable[StuderValueItem] ):
61
+ self.items = items
62
+
63
+
@@ -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.0
3
+ Version: 3.6.2
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
@@ -11,6 +11,7 @@ from pystuderxcom import XcomValueSet, XcomValueItem
11
11
  from pystuderxcom import XcomVoltage, XcomAggregationType, ScomServiceId, ScomServiceFlag, ScomFrameFlag, ScomObjType, ScomObjId, ScomQspId, ScomAddress, ScomErrorCode
12
12
  from pystuderxcom import XcomDataMessageRsp
13
13
  from pystuderxcom import StuderDataType
14
+ from pystuderxcom import StuderValueItem, StuderValueSet
14
15
 
15
16
  from . import AsyncTestApi, TestApi
16
17
  from . import AsyncTaskHelper, TaskHelper
@@ -439,6 +440,35 @@ async def data_infos_virt_aggr(dataset):
439
440
  )
440
441
  yield req_data, rsp_multi, rsp_single
441
442
 
443
+ @pytest_asyncio.fixture
444
+ async def data_studer_dev(dataset):
445
+ info_3021 = dataset.get_by_nr(3021)
446
+ info_3022 = dataset.get_by_nr(3022)
447
+ param_1107 = dataset.get_by_nr(1107)
448
+
449
+ req_data = StuderValueSet([
450
+ StuderValueItem(datapoint=info_3021, device="XT1"),
451
+ StuderValueItem(datapoint=param_1107, device=101),
452
+ StuderValueItem(datapoint=info_3022, device=101),
453
+ ])
454
+ rsp_multi = XcomValueSet(
455
+ flags = 0x00,
456
+ datetime = 0,
457
+ items=[
458
+ XcomValueItem(datapoint=info_3021, aggregation_type=XcomAggregationType.MASTER, value=12.3),
459
+ XcomValueItem(datapoint=info_3022, aggregation_type=XcomAggregationType.DEVICE1, value=45.6),
460
+ ]
461
+ )
462
+ rsp_single = XcomValueSet(
463
+ flags = 0x00,
464
+ datetime = 0,
465
+ items=[
466
+ XcomValueItem(datapoint=param_1107, aggregation_type=XcomAggregationType.DEVICE1, value=1234.0),
467
+ ]
468
+ )
469
+ yield req_data, rsp_multi, rsp_single
470
+
471
+
442
472
 
443
473
  @pytest.mark.asyncio
444
474
  @pytest.mark.usefixtures("dataset", "data_infos_dev", "data_infos_aggr", "data_infos_params_dev", "data_infos_params_aggr", "data_infos_virt_dev", "data_infos_virt_aggr")
@@ -521,7 +551,7 @@ async def test_request_infos(name, values_fixture, run_receive, exp_src_addr, ex
521
551
 
522
552
 
523
553
  @pytest.mark.asyncio
524
- @pytest.mark.usefixtures("dataset", "data_infos_dev", "data_infos_aggr", "data_infos_params_dev", "data_infos_params_aggr", "data_infos_virt_dev", "data_infos_virt_aggr")
554
+ @pytest.mark.usefixtures("dataset", "data_infos_dev", "data_infos_aggr", "data_infos_params_dev", "data_infos_params_aggr", "data_infos_virt_dev", "data_infos_virt_aggr", "data_studer_dev")
525
555
  @pytest.mark.parametrize(
526
556
  "name, values_fixture, run_receive, rsp_flags, exp_value, exp_error, exp_except",
527
557
  [
@@ -533,6 +563,7 @@ async def test_request_infos(name, values_fixture, run_receive, exp_src_addr, ex
533
563
  ("request values params aggr", "data_infos_params_aggr", False, 0x02, False, False, XcomParamException),
534
564
  ("request values virt ok", "data_infos_virt_dev", True, 0x02, True, False, None),
535
565
  ("request values virt aggr", "data_infos_virt_aggr", False, 0x02, False, False, XcomParamException),
566
+ ("request values studer ok", "data_studer_dev", True, 0x02, True, False, None),
536
567
  ]
537
568
  )
538
569
  async def test_request_values(name, values_fixture, run_receive, rsp_flags, exp_value, exp_error, exp_except, request):
@@ -13,6 +13,7 @@ from pystuderxcom import XcomValueSet, XcomValueItem
13
13
  from pystuderxcom import XcomVoltage, XcomAggregationType, ScomServiceId, ScomServiceFlag, ScomFrameFlag, ScomObjType, ScomObjId, ScomQspId, ScomAddress, ScomErrorCode
14
14
  from pystuderxcom import XcomDataMessageRsp
15
15
  from pystuderxcom import StuderDataType
16
+ from pystuderxcom import StuderValueItem, StuderValueSet
16
17
 
17
18
  from . import AsyncTestApi, TestApi
18
19
  from . import AsyncTaskHelper, TaskHelper
@@ -441,6 +442,35 @@ def data_infos_virt_aggr(dataset):
441
442
  )
442
443
  yield req_data, rsp_multi, rsp_single
443
444
 
445
+ @pytest.fixture
446
+ def data_studer_dev(dataset):
447
+ info_3021 = dataset.get_by_nr(3021)
448
+ info_3022 = dataset.get_by_nr(3022)
449
+ param_1107 = dataset.get_by_nr(1107)
450
+
451
+ req_data = StuderValueSet([
452
+ StuderValueItem(datapoint=info_3021, device="XT1"),
453
+ StuderValueItem(datapoint=param_1107, device=101),
454
+ StuderValueItem(datapoint=info_3022, device=101),
455
+ ])
456
+ rsp_multi = XcomValueSet(
457
+ flags = 0x00,
458
+ datetime = 0,
459
+ items=[
460
+ XcomValueItem(datapoint=info_3021, aggregation_type=XcomAggregationType.MASTER, value=12.3),
461
+ XcomValueItem(datapoint=info_3022, aggregation_type=XcomAggregationType.DEVICE1, value=45.6),
462
+ ]
463
+ )
464
+ rsp_single = XcomValueSet(
465
+ flags = 0x00,
466
+ datetime = 0,
467
+ items=[
468
+ XcomValueItem(datapoint=param_1107, aggregation_type=XcomAggregationType.DEVICE1, value=1234.0),
469
+ ]
470
+ )
471
+ yield req_data, rsp_multi, rsp_single
472
+
473
+
444
474
 
445
475
  @pytest.mark.asyncio
446
476
  @pytest.mark.usefixtures("dataset", "data_infos_dev", "data_infos_aggr", "data_infos_params_dev", "data_infos_params_aggr", "data_infos_virt_dev", "data_infos_virt_aggr")
@@ -523,7 +553,7 @@ def test_request_infos(name, values_fixture, run_receive, exp_src_addr, exp_dst_
523
553
 
524
554
 
525
555
  @pytest.mark.asyncio
526
- @pytest.mark.usefixtures("dataset", "data_infos_dev", "data_infos_aggr", "data_infos_params_dev", "data_infos_params_aggr", "data_infos_virt_dev", "data_infos_virt_aggr")
556
+ @pytest.mark.usefixtures("dataset", "data_infos_dev", "data_infos_aggr", "data_infos_params_dev", "data_infos_params_aggr", "data_infos_virt_dev", "data_infos_virt_aggr", "data_studer_dev")
527
557
  @pytest.mark.parametrize(
528
558
  "name, values_fixture, run_receive, rsp_flags, exp_value, exp_error, exp_except",
529
559
  [
@@ -535,6 +565,7 @@ def test_request_infos(name, values_fixture, run_receive, exp_src_addr, exp_dst_
535
565
  ("request values params aggr", "data_infos_params_aggr", False, 0x02, False, False, XcomParamException),
536
566
  ("request values virt ok", "data_infos_virt_dev", True, 0x02, True, False, None),
537
567
  ("request values virt aggr", "data_infos_virt_aggr", False, 0x02, False, False, XcomParamException),
568
+ ("request values studer ok", "data_studer_dev", True, 0x02, True, False, None),
538
569
  ]
539
570
  )
540
571
  def test_request_values(name, values_fixture, run_receive, rsp_flags, exp_value, exp_error, exp_except, request):
@@ -1,40 +0,0 @@
1
- """
2
- Shared Data Types
3
-
4
- Note that this file is shared as is between pystuderxcom and pystudernext.
5
- Do not place code that is specific to only one of these libraries in here!
6
- """
7
-
8
- import logging
9
-
10
- from dataclasses import dataclass
11
- from enum import IntEnum, StrEnum
12
- from typing import Any, Iterable
13
-
14
- from .studer_dataset import StuderDatapoint
15
-
16
-
17
- _LOGGER = logging.getLogger(__name__)
18
-
19
-
20
- @dataclass
21
- class StuderValueItem():
22
- datapoint: StuderDatapoint # Both in request and response
23
- code: str|None # Both in request and response
24
- address_or_slave: int|None # Both in request and response
25
- value: Any # Only in response from request_values()
26
- error: str|None # Only in response from request_values()
27
-
28
- @property
29
- def address(self):
30
- return self.address_or_slave
31
-
32
- @property
33
- def slave(self):
34
- return self.address_or_slave
35
-
36
-
37
- class StuderValueSet(list[StuderValueItem]):
38
- items: Iterable[StuderValueItem] # Both in request and response
39
-
40
-
File without changes
File without changes
File without changes