bwt-api 0.4.2__tar.gz → 0.5.0__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.4.2/src/bwt_api.egg-info → bwt_api-0.5.0}/PKG-INFO +2 -2
  2. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api/api.py +2 -0
  3. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api/data.py +1 -0
  4. {bwt_api-0.4.2 → bwt_api-0.5.0/src/bwt_api.egg-info}/PKG-INFO +2 -2
  5. {bwt_api-0.4.2 → bwt_api-0.5.0}/tests/test_api.py +74 -0
  6. {bwt_api-0.4.2 → bwt_api-0.5.0}/.coveragerc +0 -0
  7. {bwt_api-0.4.2 → bwt_api-0.5.0}/.github/workflows/python-package.yml +0 -0
  8. {bwt_api-0.4.2 → bwt_api-0.5.0}/.github/workflows/python-publish.yml +0 -0
  9. {bwt_api-0.4.2 → bwt_api-0.5.0}/.gitignore +0 -0
  10. {bwt_api-0.4.2 → bwt_api-0.5.0}/AUTHORS.rst +0 -0
  11. {bwt_api-0.4.2 → bwt_api-0.5.0}/CHANGELOG.rst +0 -0
  12. {bwt_api-0.4.2 → bwt_api-0.5.0}/CONTRIBUTING.rst +0 -0
  13. {bwt_api-0.4.2 → bwt_api-0.5.0}/LICENSE.txt +0 -0
  14. {bwt_api-0.4.2 → bwt_api-0.5.0}/README.rst +0 -0
  15. {bwt_api-0.4.2 → bwt_api-0.5.0}/pyproject.toml +0 -0
  16. {bwt_api-0.4.2 → bwt_api-0.5.0}/setup.cfg +0 -0
  17. {bwt_api-0.4.2 → bwt_api-0.5.0}/setup.py +0 -0
  18. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api/__init__.py +0 -0
  19. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api/error.py +0 -0
  20. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api/exception.py +0 -0
  21. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api/skeleton.py +0 -0
  22. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api.egg-info/SOURCES.txt +0 -0
  23. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api.egg-info/dependency_links.txt +0 -0
  24. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api.egg-info/entry_points.txt +0 -0
  25. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api.egg-info/not-zip-safe +0 -0
  26. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api.egg-info/requires.txt +0 -0
  27. {bwt_api-0.4.2 → bwt_api-0.5.0}/src/bwt_api.egg-info/top_level.txt +0 -0
  28. {bwt_api-0.4.2 → bwt_api-0.5.0}/tests/conftest.py +0 -0
  29. {bwt_api-0.4.2 → bwt_api-0.5.0}/tests/pytest.ini +0 -0
  30. {bwt_api-0.4.2 → bwt_api-0.5.0}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: bwt_api
3
- Version: 0.4.2
3
+ Version: 0.5.0
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
@@ -67,6 +67,7 @@ class BwtApi:
67
67
  _logger.debug(f"Fetching current data from {self._host}")
68
68
  raw = await self.__get_data("GetCurrentData")
69
69
  errors = [BwtError(int(error)) for error in raw["ActiveErrorIDs"].split(",") if error]
70
+ perla_one = raw["CapacityColumn2_ml_dH"] == -1
70
71
 
71
72
  in_hardness = Hardness(
72
73
  raw["HardnessIN_CaCO3"],
@@ -106,6 +107,7 @@ class BwtApi:
106
107
  raw["WaterTreatedCurrentDay_l"],
107
108
  raw["WaterTreatedCurrentMonth_l"],
108
109
  raw["WaterTreatedCurrentYear_l"],
110
+ 1 if perla_one else 2,
109
111
  )
110
112
 
111
113
  async def get_daily_data(self) -> DailyResponse:
@@ -48,6 +48,7 @@ class CurrentResponse:
48
48
  treated_day: int # treated water current day
49
49
  treated_month: int # treated water current month
50
50
  treated_year: int # treated water current year
51
+ columns: int # number of columns: 2 for BWT Duo and 1 for BWT Perla One
51
52
 
52
53
 
53
54
  @dataclass
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: bwt_api
3
- Version: 0.4.2
3
+ Version: 0.5.0
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
@@ -89,6 +89,43 @@ current_json_empty_errors = """
89
89
  }
90
90
  """
91
91
 
92
+ current_json_perla_one = """
93
+ {
94
+ "ActiveErrorIDs" : "",
95
+ "BlendedWaterSinceSetup_l" : 189985,
96
+ "CapacityColumn1_ml_dH" : 4487511,
97
+ "CapacityColumn2_ml_dH" : -1,
98
+ "CurrentFlowrate_l_h" : 0,
99
+ "DosingSinceSetup_ml" : 0,
100
+ "FirmwareVersion" : "2.0211",
101
+ "HardnessIN_CaCO3" : 409,
102
+ "HardnessIN_dH" : 23,
103
+ "HardnessIN_fH" : 41,
104
+ "HardnessIN_mmol_l" : 4,
105
+ "HardnessOUT_CaCO3" : 107,
106
+ "HardnessOUT_dH" : 6,
107
+ "HardnessOUT_fH" : 11,
108
+ "HardnessOUT_mmol_l" : 1,
109
+ "HolidayModeStartTime" : 0,
110
+ "LastRegenerationColumn1" : "2025-01-15 03:00:15",
111
+ "LastRegenerationColumn2" : "1970-01-01 00:59:59",
112
+ "LastServiceCustomer" : "2024-11-25 09:13:48",
113
+ "LastServiceTechnican" : "2023-08-07 11:13:51",
114
+ "OutOfService" : 0,
115
+ "RegenerationCountSinceSetup" : 692,
116
+ "RegenerationCounterColumn1" : 692,
117
+ "RegenerationCounterColumn2" : 0,
118
+ "RegenerativLevel" : 37,
119
+ "RegenerativRemainingDays" : 62,
120
+ "RegenerativSinceSetup_g" : 207305,
121
+ "ShowError" : 0,
122
+ "WaterSinceSetup_l" : 148544,
123
+ "WaterTreatedCurrentDay_l" : 179,
124
+ "WaterTreatedCurrentMonth_l" : 514,
125
+ "WaterTreatedCurrentYear_l" : 500
126
+ }
127
+ """
128
+
92
129
  async def test_wrong_code():
93
130
  with aioresponses() as mocked:
94
131
  mocked.get("http://host:8080/api/GetCurrentData", status=404, body="")
@@ -146,6 +183,7 @@ async def test_current_data():
146
183
  treated_day=181,
147
184
  treated_month=3137,
148
185
  treated_year=80700,
186
+ columns=2,
149
187
  )
150
188
 
151
189
 
@@ -180,6 +218,42 @@ async def test_empty_errors():
180
218
  treated_day=181,
181
219
  treated_month=3137,
182
220
  treated_year=80700,
221
+ columns=2,
222
+ )
223
+
224
+
225
+ async def test_perla_one():
226
+ with aioresponses() as mocked:
227
+ mocked.get("http://host:8080/api/GetCurrentData", status=200, body=current_json_perla_one)
228
+ async with BwtApi("host", "code") as api:
229
+ result = await api.get_current_data()
230
+ assert result == CurrentResponse(
231
+ errors=[],
232
+ blended_total=189985,
233
+ capacity_1=4487511,
234
+ capacity_2=-1,
235
+ current_flow=0,
236
+ dosing_total=0,
237
+ firmware_version="2.0211",
238
+ in_hardness=Hardness(caco3=409, dH=23, fH=41, mmol=4),
239
+ out_hardness=Hardness(caco3=107, dH=6, fH=11, mmol=1),
240
+ holiday_mode=0,
241
+ regeneration_last_1=datetime(2025, 1, 15, 3, 0, 15, 0, ZoneInfo("UTC")),
242
+ regeneration_last_2=datetime(1970, 1, 1, 0, 59, 59, 0, ZoneInfo("UTC")),
243
+ service_customer=datetime(2024, 11, 25, 9, 13, 48, 0, ZoneInfo("UTC")),
244
+ service_technician=datetime(2023, 8, 7, 11, 13, 51, 0, ZoneInfo("UTC")),
245
+ out_of_service=0,
246
+ regeneration_count_1=692,
247
+ regeneration_count_2=0,
248
+ regeneration_count=692,
249
+ regenerativ_level=37,
250
+ regenerativ_days=62,
251
+ regenerativ_total=207305,
252
+ state=BwtStatus.OK,
253
+ treated_day=179,
254
+ treated_month=514,
255
+ treated_year=500,
256
+ columns=1,
183
257
  )
184
258
 
185
259
  def test_treated_to_blended():
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