bwt-api 0.2.0__tar.gz → 0.2.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.
Files changed (30) hide show
  1. {bwt_api-0.2.0 → bwt_api-0.2.1}/PKG-INFO +1 -1
  2. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api/api.py +3 -4
  3. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api.egg-info/PKG-INFO +1 -1
  4. {bwt_api-0.2.0 → bwt_api-0.2.1}/tests/test_api.py +70 -0
  5. {bwt_api-0.2.0 → bwt_api-0.2.1}/.coveragerc +0 -0
  6. {bwt_api-0.2.0 → bwt_api-0.2.1}/.github/workflows/python-package.yml +0 -0
  7. {bwt_api-0.2.0 → bwt_api-0.2.1}/.github/workflows/python-publish.yml +0 -0
  8. {bwt_api-0.2.0 → bwt_api-0.2.1}/.gitignore +0 -0
  9. {bwt_api-0.2.0 → bwt_api-0.2.1}/AUTHORS.rst +0 -0
  10. {bwt_api-0.2.0 → bwt_api-0.2.1}/CHANGELOG.rst +0 -0
  11. {bwt_api-0.2.0 → bwt_api-0.2.1}/CONTRIBUTING.rst +0 -0
  12. {bwt_api-0.2.0 → bwt_api-0.2.1}/LICENSE.txt +0 -0
  13. {bwt_api-0.2.0 → bwt_api-0.2.1}/README.rst +0 -0
  14. {bwt_api-0.2.0 → bwt_api-0.2.1}/pyproject.toml +0 -0
  15. {bwt_api-0.2.0 → bwt_api-0.2.1}/setup.cfg +0 -0
  16. {bwt_api-0.2.0 → bwt_api-0.2.1}/setup.py +0 -0
  17. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api/__init__.py +0 -0
  18. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api/data.py +0 -0
  19. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api/error.py +0 -0
  20. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api/exception.py +0 -0
  21. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api/skeleton.py +0 -0
  22. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api.egg-info/SOURCES.txt +0 -0
  23. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api.egg-info/dependency_links.txt +0 -0
  24. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api.egg-info/entry_points.txt +0 -0
  25. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api.egg-info/not-zip-safe +0 -0
  26. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api.egg-info/requires.txt +0 -0
  27. {bwt_api-0.2.0 → bwt_api-0.2.1}/src/bwt_api.egg-info/top_level.txt +0 -0
  28. {bwt_api-0.2.0 → bwt_api-0.2.1}/tests/conftest.py +0 -0
  29. {bwt_api-0.2.0 → bwt_api-0.2.1}/tests/pytest.ini +0 -0
  30. {bwt_api-0.2.0 → bwt_api-0.2.1}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bwt_api
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Python API to access the local BWT Perla API.
5
5
  Home-page: https://github.com/dkarv/bwt_api
6
6
  Author: dkarv
@@ -64,9 +64,8 @@ class BwtApi:
64
64
  """Get the current state of the BWT."""
65
65
  _logger.debug(f"Fetching current data from {self._host}")
66
66
  raw = await self.__get_data("GetCurrentData")
67
- errors = map(
68
- lambda error: BwtError(int(error)), raw["ActiveErrorIDs"].split(",")
69
- )
67
+ errors = [BwtError(int(error)) for error in raw["ActiveErrorIDs"].split(",") if error]
68
+
70
69
  in_hardness = Hardness(
71
70
  raw["HardnessIN_CaCO3"],
72
71
  raw["HardnessIN_dH"],
@@ -80,7 +79,7 @@ class BwtApi:
80
79
  raw["HardnessOUT_mmol_l"],
81
80
  )
82
81
  return CurrentResponse(
83
- list(errors),
82
+ errors,
84
83
  raw["BlendedWaterSinceSetup_l"],
85
84
  raw["CapacityColumn1_ml_dH"],
86
85
  raw["CapacityColumn2_ml_dH"],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bwt-api
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Python API to access the local BWT Perla API.
5
5
  Home-page: https://github.com/dkarv/bwt_api
6
6
  Author: dkarv
@@ -49,6 +49,42 @@ current_json = """
49
49
  }
50
50
  """
51
51
 
52
+ current_json_empty_errors = """
53
+ {
54
+ "ActiveErrorIDs" : "",
55
+ "BlendedWaterSinceSetup_l" : 318383,
56
+ "CapacityColumn1_ml_dH" : 5485275,
57
+ "CapacityColumn2_ml_dH" : 3833994,
58
+ "CurrentFlowrate_l_h" : 0,
59
+ "DosingSinceSetup_ml" : 0,
60
+ "FirmwareVersion" : "2.0207",
61
+ "HardnessIN_CaCO3" : 374,
62
+ "HardnessIN_dH" : 21,
63
+ "HardnessIN_fH" : 37,
64
+ "HardnessIN_mmol_l" : 4,
65
+ "HardnessOUT_CaCO3" : 71,
66
+ "HardnessOUT_dH" : 4,
67
+ "HardnessOUT_fH" : 7,
68
+ "HardnessOUT_mmol_l" : 1,
69
+ "HolidayModeStartTime" : 0,
70
+ "LastRegenerationColumn1" : "2023-11-16 04:42:15",
71
+ "LastRegenerationColumn2" : "2023-11-15 04:41:48",
72
+ "LastServiceCustomer" : "2023-05-18 10:51:07",
73
+ "LastServiceTechnican" : "2021-01-25 13:14:06",
74
+ "OutOfService" : 0,
75
+ "RegenerationCountSinceSetup" : 1505,
76
+ "RegenerationCounterColumn1" : 754,
77
+ "RegenerationCounterColumn2" : 751,
78
+ "RegenerativLevel" : 20,
79
+ "RegenerativRemainingDays" : 26,
80
+ "RegenerativSinceSetup_g" : 245846,
81
+ "ShowError" : 1,
82
+ "WaterSinceSetup_l" : 261633,
83
+ "WaterTreatedCurrentDay_l" : 181,
84
+ "WaterTreatedCurrentMonth_l" : 3137,
85
+ "WaterTreatedCurrentYear_l" : 80700
86
+ }
87
+ """
52
88
 
53
89
  async def test_wrong_code():
54
90
  with aioresponses() as mocked:
@@ -108,3 +144,37 @@ async def test_current_data():
108
144
  treated_month=3137,
109
145
  treated_year=80700,
110
146
  )
147
+
148
+
149
+ async def test_empty_errors():
150
+ with aioresponses() as mocked:
151
+ mocked.get("http://host:8080/api/GetCurrentData", status=200, body=current_json_empty_errors)
152
+ async with BwtApi("host", "code") as api:
153
+ result = await api.get_current_data()
154
+ assert result == CurrentResponse(
155
+ errors=[],
156
+ blended_total=318383,
157
+ capacity_1=5485275,
158
+ capacity_2=3833994,
159
+ current_flow=0,
160
+ dosing_total=0,
161
+ firmware_version="2.0207",
162
+ in_hardness=Hardness(caco3=374, dH=21, fH=37, mmol=4),
163
+ out_hardness=Hardness(caco3=71, dH=4, fH=7, mmol=1),
164
+ holiday_mode=0,
165
+ regeneration_last_1="2023-11-16 04:42:15",
166
+ regeneration_last_2="2023-11-15 04:41:48",
167
+ service_customer="2023-05-18 10:51:07",
168
+ service_technician="2021-01-25 13:14:06",
169
+ out_of_service=0,
170
+ regeneration_count_1=754,
171
+ regeneration_count_2=751,
172
+ regeneration_count=1505,
173
+ regenerativ_level=20,
174
+ regenerativ_days=26,
175
+ regenerativ_total=245846,
176
+ show_error=1,
177
+ treated_day=181,
178
+ treated_month=3137,
179
+ treated_year=80700,
180
+ )
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