pystuderxcom 3.6.1__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.1/src/pystuderxcom.egg-info → pystuderxcom-3.6.2}/PKG-INFO +1 -1
  2. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/pyproject.toml +1 -1
  3. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_dataset.py +2 -2
  4. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_families.py +1 -1
  5. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_messageset.py +2 -2
  6. pystuderxcom-3.6.2/src/pystuderxcom/shared/studer_valueset.py +63 -0
  7. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2/src/pystuderxcom.egg-info}/PKG-INFO +1 -1
  8. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_api_base_async.py +32 -1
  9. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_api_base_sync.py +32 -1
  10. pystuderxcom-3.6.1/src/pystuderxcom/shared/studer_valueset.py +0 -53
  11. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/LICENSE +0 -0
  12. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/README.md +0 -0
  13. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/setup.cfg +0 -0
  14. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/__init__.py +0 -0
  15. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/api_base_async.py +0 -0
  16. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/api_base_sync.py +0 -0
  17. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/api_serial.py +0 -0
  18. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/api_tcp.py +0 -0
  19. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/api_udp.py +0 -0
  20. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/const.py +0 -0
  21. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/data.py +0 -0
  22. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/datapoints.py +0 -0
  23. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/datapoints_120v.json +0 -0
  24. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/datapoints_240v.json +0 -0
  25. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/datapoints_xcom.json +0 -0
  26. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/discover_async.py +0 -0
  27. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/discover_sync.py +0 -0
  28. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/families.py +0 -0
  29. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/messages.py +0 -0
  30. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/messages_en.json +0 -0
  31. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/protocol.py +0 -0
  32. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/helpers.py +0 -0
  33. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_interfaces_async.py +0 -0
  34. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_interfaces_sync.py +0 -0
  35. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/shared/studer_types.py +0 -0
  36. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom/values.py +0 -0
  37. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom.egg-info/SOURCES.txt +0 -0
  38. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom.egg-info/dependency_links.txt +0 -0
  39. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom.egg-info/requires.txt +0 -0
  40. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/src/pystuderxcom.egg-info/top_level.txt +0 -0
  41. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_api_serial_async.py +0 -0
  42. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_api_serial_sync.py +0 -0
  43. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_api_tcp_async.py +0 -0
  44. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_api_tcp_sync.py +0 -0
  45. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_api_udp_async.py +0 -0
  46. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_api_udp_sync.py +0 -0
  47. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_const.py +0 -0
  48. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_data.py +0 -0
  49. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_datapoints.py +0 -0
  50. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_discover_async.py +0 -0
  51. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_discover_sync.py +0 -0
  52. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_families.py +0 -0
  53. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_messages.py +0 -0
  54. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_package_async.py +0 -0
  55. {pystuderxcom-3.6.1 → pystuderxcom-3.6.2}/tests/test_package_sync.py +0 -0
  56. {pystuderxcom-3.6.1 → 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.1
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.1"
3
+ version = "3.6.2"
4
4
  authors = [
5
5
  { name="Anko Hanse", email="anko_hanse@hotmail.com" },
6
6
  ]
@@ -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
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pystuderxcom
3
- Version: 3.6.1
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,53 +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
- class StuderValueItem():
21
- datapoint: StuderDatapoint # Both in request and response
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()
25
- error: str|None # Only in response from request_values()
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
-
38
- @property
39
- def address(self):
40
- return self.address_or_slave
41
-
42
- @property
43
- def slave(self):
44
- return self.address_or_slave
45
-
46
-
47
- class StuderValueSet():
48
- items: Iterable[StuderValueItem] # Both in request and response
49
-
50
- def __init__(self, items: Iterable[StuderValueItem] ):
51
- self.items = items
52
-
53
-
File without changes
File without changes
File without changes