bwt-api 0.4.0__tar.gz → 0.4.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 (30) hide show
  1. {bwt_api-0.4.0/src/bwt_api.egg-info → bwt_api-0.4.2}/PKG-INFO +1 -1
  2. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api/api.py +6 -0
  3. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api/data.py +1 -1
  4. {bwt_api-0.4.0 → bwt_api-0.4.2/src/bwt_api.egg-info}/PKG-INFO +1 -1
  5. {bwt_api-0.4.0 → bwt_api-0.4.2}/tests/test_api.py +10 -3
  6. {bwt_api-0.4.0 → bwt_api-0.4.2}/.coveragerc +0 -0
  7. {bwt_api-0.4.0 → bwt_api-0.4.2}/.github/workflows/python-package.yml +0 -0
  8. {bwt_api-0.4.0 → bwt_api-0.4.2}/.github/workflows/python-publish.yml +0 -0
  9. {bwt_api-0.4.0 → bwt_api-0.4.2}/.gitignore +0 -0
  10. {bwt_api-0.4.0 → bwt_api-0.4.2}/AUTHORS.rst +0 -0
  11. {bwt_api-0.4.0 → bwt_api-0.4.2}/CHANGELOG.rst +0 -0
  12. {bwt_api-0.4.0 → bwt_api-0.4.2}/CONTRIBUTING.rst +0 -0
  13. {bwt_api-0.4.0 → bwt_api-0.4.2}/LICENSE.txt +0 -0
  14. {bwt_api-0.4.0 → bwt_api-0.4.2}/README.rst +0 -0
  15. {bwt_api-0.4.0 → bwt_api-0.4.2}/pyproject.toml +0 -0
  16. {bwt_api-0.4.0 → bwt_api-0.4.2}/setup.cfg +0 -0
  17. {bwt_api-0.4.0 → bwt_api-0.4.2}/setup.py +0 -0
  18. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api/__init__.py +0 -0
  19. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api/error.py +0 -0
  20. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api/exception.py +0 -0
  21. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api/skeleton.py +0 -0
  22. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api.egg-info/SOURCES.txt +0 -0
  23. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api.egg-info/dependency_links.txt +0 -0
  24. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api.egg-info/entry_points.txt +0 -0
  25. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api.egg-info/not-zip-safe +0 -0
  26. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api.egg-info/requires.txt +0 -0
  27. {bwt_api-0.4.0 → bwt_api-0.4.2}/src/bwt_api.egg-info/top_level.txt +0 -0
  28. {bwt_api-0.4.0 → bwt_api-0.4.2}/tests/conftest.py +0 -0
  29. {bwt_api-0.4.0 → bwt_api-0.4.2}/tests/pytest.ini +0 -0
  30. {bwt_api-0.4.0 → bwt_api-0.4.2}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bwt_api
3
- Version: 0.4.0
3
+ Version: 0.4.2
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
@@ -132,3 +132,9 @@ class BwtApi:
132
132
  raw = await self.__get_data("GetYearlyData")
133
133
  keys = [f"Month{month:02}_l" for month in range(1, 13)]
134
134
  return YearlyResponse(list(map(lambda k: raw[k], keys)))
135
+
136
+ def treated_to_blended(treated: int, hardness_in: int, hardness_out: int) -> float:
137
+ if (hardness_in == 0 | hardness_in == hardness_out):
138
+ return treated
139
+
140
+ return treated / (1.0 - hardness_out / hardness_in)
@@ -44,7 +44,7 @@ class CurrentResponse:
44
44
  regenerativ_level: int # %
45
45
  regenerativ_days: int # days left
46
46
  regenerativ_total: int # g
47
- show_error: BwtStatus
47
+ state: BwtStatus
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bwt_api
3
- Version: 0.4.0
3
+ Version: 0.4.2
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
@@ -2,7 +2,7 @@ from datetime import datetime
2
2
  from zoneinfo import ZoneInfo
3
3
  import pytest
4
4
 
5
- from bwt_api.api import BwtApi
5
+ from bwt_api.api import BwtApi, treated_to_blended
6
6
  from bwt_api.error import BwtError
7
7
  from bwt_api.data import CurrentResponse, Hardness, BwtStatus
8
8
 
@@ -142,7 +142,7 @@ async def test_current_data():
142
142
  regenerativ_level=20,
143
143
  regenerativ_days=26,
144
144
  regenerativ_total=245846,
145
- show_error=BwtStatus.ERROR,
145
+ state=BwtStatus.ERROR,
146
146
  treated_day=181,
147
147
  treated_month=3137,
148
148
  treated_year=80700,
@@ -176,8 +176,15 @@ async def test_empty_errors():
176
176
  regenerativ_level=20,
177
177
  regenerativ_days=26,
178
178
  regenerativ_total=245846,
179
- show_error=BwtStatus.OK,
179
+ state=BwtStatus.OK,
180
180
  treated_day=181,
181
181
  treated_month=3137,
182
182
  treated_year=80700,
183
183
  )
184
+
185
+ def test_treated_to_blended():
186
+ assert treated_to_blended(0, 21, 4) == 0
187
+ assert treated_to_blended(100, 21, 21) == 100
188
+ assert treated_to_blended(10, 20, 4) == 12.5
189
+ assert treated_to_blended(306, 21, 4) == 378
190
+ assert treated_to_blended(191, 21, 4) == pytest.approx(235.9411)
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