bwt-api 0.4.2__tar.gz → 0.5.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.
- {bwt_api-0.4.2/src/bwt_api.egg-info → bwt_api-0.5.1}/PKG-INFO +3 -2
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api/api.py +4 -2
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api/data.py +1 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1/src/bwt_api.egg-info}/PKG-INFO +3 -2
- {bwt_api-0.4.2 → bwt_api-0.5.1}/tests/test_api.py +82 -8
- {bwt_api-0.4.2 → bwt_api-0.5.1}/.coveragerc +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/.github/workflows/python-package.yml +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/.github/workflows/python-publish.yml +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/.gitignore +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/AUTHORS.rst +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/CHANGELOG.rst +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/CONTRIBUTING.rst +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/LICENSE.txt +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/README.rst +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/pyproject.toml +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/setup.cfg +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/setup.py +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api/__init__.py +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api/error.py +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api/exception.py +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api/skeleton.py +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api.egg-info/SOURCES.txt +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api.egg-info/dependency_links.txt +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api.egg-info/entry_points.txt +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api.egg-info/not-zip-safe +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api.egg-info/requires.txt +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/src/bwt_api.egg-info/top_level.txt +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/tests/conftest.py +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/tests/pytest.ini +0 -0
- {bwt_api-0.4.2 → bwt_api-0.5.1}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: bwt_api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.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
|
|
@@ -23,6 +23,7 @@ Requires-Dist: setuptools; extra == "testing"
|
|
|
23
23
|
Requires-Dist: pytest; extra == "testing"
|
|
24
24
|
Requires-Dist: pytest-cov; extra == "testing"
|
|
25
25
|
Requires-Dist: aioresponses; extra == "testing"
|
|
26
|
+
Dynamic: license-file
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
bwt_api
|
|
@@ -57,16 +57,17 @@ class BwtApi:
|
|
|
57
57
|
raise ConnectException from e
|
|
58
58
|
|
|
59
59
|
def _convert_datetime(self, input: str) -> datetime:
|
|
60
|
-
# It looks like the device sends and even shows everything in
|
|
60
|
+
# It looks like the device sends and even shows everything in local time
|
|
61
61
|
return datetime.strptime(
|
|
62
62
|
input, "%Y-%m-%d %H:%M:%S"
|
|
63
|
-
).replace(tzinfo=ZoneInfo("UTC"))
|
|
63
|
+
)# .replace(tzinfo=ZoneInfo("UTC"))
|
|
64
64
|
|
|
65
65
|
async def get_current_data(self) -> CurrentResponse:
|
|
66
66
|
"""Get the current state of the BWT."""
|
|
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
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: bwt_api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.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
|
|
@@ -23,6 +23,7 @@ Requires-Dist: setuptools; extra == "testing"
|
|
|
23
23
|
Requires-Dist: pytest; extra == "testing"
|
|
24
24
|
Requires-Dist: pytest-cov; extra == "testing"
|
|
25
25
|
Requires-Dist: aioresponses; extra == "testing"
|
|
26
|
+
Dynamic: license-file
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
bwt_api
|
|
@@ -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="")
|
|
@@ -131,10 +168,10 @@ async def test_current_data():
|
|
|
131
168
|
in_hardness=Hardness(caco3=374, dH=21, fH=37, mmol=4),
|
|
132
169
|
out_hardness=Hardness(caco3=71, dH=4, fH=7, mmol=1),
|
|
133
170
|
holiday_mode=0,
|
|
134
|
-
regeneration_last_1=datetime(2023, 11, 16, 4, 42,15,0
|
|
135
|
-
regeneration_last_2=datetime(2023, 11, 15, 4, 41,48,0
|
|
136
|
-
service_customer=datetime(2023, 5, 18, 10, 51,7,0
|
|
137
|
-
service_technician=datetime(2021, 1, 25, 13, 14,6,0
|
|
171
|
+
regeneration_last_1=datetime(2023, 11, 16, 4, 42,15,0),
|
|
172
|
+
regeneration_last_2=datetime(2023, 11, 15, 4, 41,48,0),
|
|
173
|
+
service_customer=datetime(2023, 5, 18, 10, 51,7,0),
|
|
174
|
+
service_technician=datetime(2021, 1, 25, 13, 14,6,0),
|
|
138
175
|
out_of_service=0,
|
|
139
176
|
regeneration_count_1=754,
|
|
140
177
|
regeneration_count_2=751,
|
|
@@ -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
|
|
|
@@ -165,10 +203,10 @@ async def test_empty_errors():
|
|
|
165
203
|
in_hardness=Hardness(caco3=374, dH=21, fH=37, mmol=4),
|
|
166
204
|
out_hardness=Hardness(caco3=71, dH=4, fH=7, mmol=1),
|
|
167
205
|
holiday_mode=0,
|
|
168
|
-
regeneration_last_1=datetime(2023, 11, 16, 4, 42,15,0
|
|
169
|
-
regeneration_last_2=datetime(2023, 11, 15, 4, 41,48,0
|
|
170
|
-
service_customer=datetime(2023, 5, 18, 10, 51,7,0
|
|
171
|
-
service_technician=datetime(2021, 1, 25, 13, 14,6,0
|
|
206
|
+
regeneration_last_1=datetime(2023, 11, 16, 4, 42,15,0),
|
|
207
|
+
regeneration_last_2=datetime(2023, 11, 15, 4, 41,48,0),
|
|
208
|
+
service_customer=datetime(2023, 5, 18, 10, 51,7,0),
|
|
209
|
+
service_technician=datetime(2021, 1, 25, 13, 14,6,0),
|
|
172
210
|
out_of_service=0,
|
|
173
211
|
regeneration_count_1=754,
|
|
174
212
|
regeneration_count_2=751,
|
|
@@ -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),
|
|
242
|
+
regeneration_last_2=datetime(1970, 1, 1, 0, 59, 59, 0),
|
|
243
|
+
service_customer=datetime(2024, 11, 25, 9, 13, 48, 0),
|
|
244
|
+
service_technician=datetime(2023, 8, 7, 11, 13, 51, 0),
|
|
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
|
|
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
|