pymiele 0.3.0__tar.gz → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymiele
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Python library for Miele integration with Home Assistant
5
5
  Author-email: Ake Strandberg <ake@strandberg.eu>
6
6
  License: MIT
@@ -1,7 +1,9 @@
1
1
  """Constants for pymiele."""
2
2
 
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.2"
4
4
 
5
5
  MIELE_API = "https://api.mcs3.miele.com/v1"
6
6
  OAUTH2_AUTHORIZE = "https://api.mcs3.miele.com/thirdparty/login"
7
7
  OAUTH2_TOKEN = "https://api.mcs3.miele.com/thirdparty/token"
8
+
9
+ AIO_TIMEOUT = 15
@@ -0,0 +1,471 @@
1
+ """Data models for Miele API."""
2
+
3
+ from __future__ import annotations
4
+
5
+
6
+ class MieleDevices:
7
+ """Data for all devices from API."""
8
+
9
+ def __init__(self, raw_data: dict) -> None:
10
+ """Initialize MieleDevices."""
11
+ self.raw_data = raw_data
12
+
13
+ @property
14
+ def devices(self) -> list[str]:
15
+ """Return list of all devices."""
16
+
17
+ return list(self.raw_data.keys())
18
+
19
+
20
+ class MieleTemperature:
21
+ """A model of temperature data."""
22
+
23
+ def __init__(self, raw_data: dict) -> None:
24
+ """Initialize MieleTemperature."""
25
+ self.raw_data = raw_data
26
+
27
+ @property
28
+ def raw(self) -> dict:
29
+ """Return raw data."""
30
+ return self.raw_data
31
+
32
+ @property
33
+ def temperature(self) -> int | None:
34
+ """Return temperature object."""
35
+ return self.raw_data["value_raw"]
36
+
37
+
38
+ class MieleActionTargetTemperature:
39
+ """A model of target temperature data."""
40
+
41
+ def __init__(self, raw_data: dict) -> None:
42
+ """Initialize MieleActionTargetTemperature."""
43
+ self.raw_data = raw_data
44
+
45
+ @property
46
+ def raw(self) -> dict:
47
+ """Return raw data."""
48
+ return self.raw_data
49
+
50
+ @property
51
+ def zone(self) -> int | None:
52
+ """Return zone value."""
53
+ return self.raw_data["zone"]
54
+
55
+ @property
56
+ def min(self) -> int | None:
57
+ """Return min value."""
58
+ return self.raw_data["min"]
59
+
60
+ @property
61
+ def max(self) -> int | None:
62
+ """Return max value."""
63
+ return self.raw_data["max"]
64
+
65
+
66
+ class MieleDevice:
67
+ """Data for a single device from API."""
68
+
69
+ def __init__(self, raw_data: dict) -> None:
70
+ """Initialize MieleDevice."""
71
+ self.raw_data = raw_data
72
+
73
+ @property
74
+ def raw(self) -> dict:
75
+ """Return raw data."""
76
+ return self.raw_data
77
+
78
+ @property
79
+ def fab_number(self) -> str:
80
+ """Return the ID of the device."""
81
+ return str(self.raw_data["ident"]["deviceIdentLabel"]["fabNumber"])
82
+
83
+ @property
84
+ def device_type(self) -> int:
85
+ """Return the type of the device."""
86
+ return self.raw_data["ident"]["type"]["value_raw"]
87
+
88
+ @property
89
+ def device_type_localized(self) -> str:
90
+ """Return the type of the device."""
91
+ return self.raw_data["ident"]["type"]["value_localized"]
92
+
93
+ @property
94
+ def device_name(self) -> str:
95
+ """Return the name of the device."""
96
+ return self.raw_data["ident"]["deviceName"]
97
+
98
+ @property
99
+ def tech_type(self) -> str:
100
+ """Return the tech type of the device."""
101
+ return self.raw_data["ident"]["deviceIdentLabel"]["techType"]
102
+
103
+ @property
104
+ def xkm_tech_type(self) -> str:
105
+ """Return the xkm tech type of the device."""
106
+ return self.raw_data["ident"]["xkmIdentLabel"]["techType"]
107
+
108
+ @property
109
+ def xkm_release_version(self) -> str:
110
+ """Return the xkm release version of the device."""
111
+ return self.raw_data["ident"]["xkmIdentLabel"]["releaseVersion"]
112
+
113
+ @property
114
+ def state_program_id(self) -> int:
115
+ """Return the program ID of the device."""
116
+ return self.raw_data["state"]["ProgramID"]["value_raw"]
117
+
118
+ @property
119
+ def state_status(self) -> int:
120
+ """Return the status of the device."""
121
+ return self.raw_data["state"]["status"]["value_raw"]
122
+
123
+ @property
124
+ def state_program_type(self) -> int:
125
+ """Return the program type of the device."""
126
+ return self.raw_data["state"]["programType"]["value_raw"]
127
+
128
+ @property
129
+ def state_program_phase(self) -> int:
130
+ """Return the program phase of the device."""
131
+ return self.raw_data["state"]["programPhase"]["value_raw"]
132
+
133
+ @property
134
+ def state_remaining_time(self) -> list[int]:
135
+ """Return the remaining time of the device."""
136
+ return self.raw_data["state"]["remainingTime"]
137
+
138
+ @property
139
+ def state_start_time(self) -> list[int]:
140
+ """Return the start time of the device."""
141
+ return self.raw_data["state"]["startTime"]
142
+
143
+ @property
144
+ def state_target_temperature(self) -> list[MieleTemperature]:
145
+ """Return the target temperature of the device."""
146
+ return [
147
+ MieleTemperature(temp)
148
+ for temp in self.raw_data["state"]["targetTemperature"]
149
+ ]
150
+
151
+ @property
152
+ def state_core_target_temperature(self) -> list[dict]:
153
+ """Return the core target temperature of the device."""
154
+ return [
155
+ MieleTemperature(temp)
156
+ for temp in self.raw_data["state"]["coretargetTemperature"]
157
+ ]
158
+
159
+ @property
160
+ def state_temperatures(self) -> list[MieleTemperature]:
161
+ """Return list of all temperatures."""
162
+
163
+ return [
164
+ MieleTemperature(temp) for temp in self.raw_data["state"]["temperature"]
165
+ ]
166
+
167
+ @property
168
+ def state_core_temperature(self) -> list[MieleTemperature]:
169
+ """Return the core temperature of the device."""
170
+ return [
171
+ MieleTemperature(temp) for temp in self.raw_data["state"]["coreTemperature"]
172
+ ]
173
+
174
+ @property
175
+ def state_signal_info(self) -> bool:
176
+ """Return the signal info of the device."""
177
+ return self.raw_data["state"]["signalInfo"]
178
+
179
+ @property
180
+ def state_signal_failure(self) -> bool:
181
+ """Return the signal failure of the device."""
182
+ return self.raw_data["state"]["signalFailure"]
183
+
184
+ @property
185
+ def state_signal_door(self) -> bool:
186
+ """Return the signal door of the device."""
187
+ return self.raw_data["state"]["signalDoor"]
188
+
189
+ @property
190
+ def state_full_remote_control(self) -> bool:
191
+ """Return the remote control enable of the device."""
192
+ return self.raw_data["state"]["remoteEnable"]["fullRemoteControl"]
193
+
194
+ @property
195
+ def state_smart_grid(self) -> bool:
196
+ """Return the smart grid of the device."""
197
+ return self.raw_data["state"]["remoteEnable"]["smartGrid"]
198
+
199
+ @property
200
+ def state_mobile_start(self) -> bool:
201
+ """Return the mobile start of the device."""
202
+ return self.raw_data["state"]["remoteEnable"]["mobileStart"]
203
+
204
+ @property
205
+ def state_ambient_light(self) -> int:
206
+ """Return the ambient light of the device."""
207
+ return self.raw_data["state"]["ambientLight"]
208
+
209
+ @state_ambient_light.setter
210
+ def state_ambient_light(self, new_value: bool) -> None:
211
+ """Set the ambient light state."""
212
+ self.raw_data["state"]["ambientLight"] = new_value
213
+
214
+ @property
215
+ def state_light(self) -> int:
216
+ """Return the light of the device."""
217
+ return self.raw_data["state"]["light"]
218
+
219
+ @state_light.setter
220
+ def state_light(self, new_value: int) -> None:
221
+ """Set the light state."""
222
+ self.raw_data["state"]["light"] = new_value
223
+
224
+ @property
225
+ def state_elapsed_time(self) -> list[int]:
226
+ """Return the elapsed time of the device."""
227
+ return self.raw_data["state"]["elapsedTime"]
228
+
229
+ @property
230
+ def state_spinning_speed(self) -> int | None:
231
+ """Return the spinning speed of the device."""
232
+ return self.raw_data["state"]["spinningSpeed"]["value_raw"]
233
+
234
+ @property
235
+ def state_drying_step(self) -> int | None:
236
+ """Return the drying step of the device."""
237
+ return self.raw_data["state"]["dryingStep"]["value_raw"]
238
+
239
+ @state_drying_step.setter
240
+ def state_drying_step(self, new_value: int) -> None:
241
+ """Set the drying state."""
242
+ self.raw_data["state"]["dryingStep"]["value_raw"] = new_value
243
+
244
+ @property
245
+ def state_ventilation_step(self) -> int | None:
246
+ """Return the ventilation step of the device."""
247
+ return self.raw_data["state"]["ventilationStep"]["value_raw"]
248
+
249
+ @state_ventilation_step.setter
250
+ def state_ventilation_step(self, new_value: int) -> None:
251
+ """Set the ventilation state."""
252
+ self.raw_data["state"]["ventilationStep"]["value_raw"] = new_value
253
+
254
+ @property
255
+ def state_plate_step(self) -> list[dict]:
256
+ """Return the plate step of the device."""
257
+ return self.raw_data["state"]["plateStep"]
258
+
259
+ @property
260
+ def state_eco_feedback(self) -> dict | None:
261
+ """Return the eco feedback of the device."""
262
+ return self.raw_data["state"]["ecoFeedback"]
263
+
264
+ @property
265
+ def current_water_consumption(self) -> float | None:
266
+ """Return the current water consumption of the device."""
267
+ if self.state_eco_feedback is None:
268
+ return None
269
+ return self.raw_data["state"]["ecoFeedback"].get("currentWaterConsumption")[
270
+ "value"
271
+ ]
272
+
273
+ @property
274
+ def current_energy_consumption(self) -> float | None:
275
+ """Return the current energy consumption of the device."""
276
+ if self.state_eco_feedback is None:
277
+ return None
278
+ return self.raw_data["state"]["ecoFeedback"]["currentEnergyConsumption"][
279
+ "value"
280
+ ]
281
+
282
+ @property
283
+ def water_forecast(self) -> float | None:
284
+ """Return the water forecast of the device."""
285
+ if self.state_eco_feedback is None:
286
+ return None
287
+ return self.raw_data["state"]["ecoFeedback"].get("waterForecast")
288
+
289
+ @property
290
+ def energy_forecast(self) -> float | None:
291
+ """Return the energy forecast of the device."""
292
+ if self.state_eco_feedback is None:
293
+ return None
294
+ return self.raw_data["state"]["ecoFeedback"].get("energyForecast")
295
+
296
+ @property
297
+ def state_battery_level(self) -> int | None:
298
+ """Return the battery level of the device."""
299
+ return self.raw_data["state"]["batteryLevel"]
300
+
301
+
302
+ class MieleAction:
303
+ """Actions for Miele devices."""
304
+
305
+ def __init__(self, raw_data: dict) -> None:
306
+ """Initialize MieleAction."""
307
+ self.raw_data = raw_data
308
+
309
+ @property
310
+ def raw(self) -> dict:
311
+ """Return raw data."""
312
+ return self.raw_data
313
+
314
+ @property
315
+ def actions(self) -> list[str]:
316
+ """Return list of all actions."""
317
+ return list(self.raw_data.keys())
318
+
319
+ @property
320
+ def modes(self) -> list[int]:
321
+ """Return list of modes."""
322
+ return list(self.raw_data["modes"])
323
+
324
+ @property
325
+ def process_actions(self) -> list[int]:
326
+ """Return list of process actions."""
327
+ return list(self.raw_data["processAction"])
328
+
329
+ @property
330
+ def light(self) -> list[int]:
331
+ """Return list of light actions."""
332
+ return list(self.raw_data["light"])
333
+
334
+ @property
335
+ def ambient_light(self) -> list[int]:
336
+ """Return list of ambient light actions."""
337
+ return list(self.raw_data["ambientLight"])
338
+
339
+ @property
340
+ def start_time(self) -> list[int]:
341
+ """Return list of start time actions."""
342
+ return list(self.raw_data["start_time"])
343
+
344
+ @property
345
+ def ventilation_setp(self) -> list[int]:
346
+ """Return list of ventilation step actions."""
347
+ return list(self.raw_data["ventilationStep"])
348
+
349
+ @property
350
+ def program_id(self) -> list[int]:
351
+ """Return list of program id actions."""
352
+ return list(self.raw_data["programId"])
353
+
354
+ @property
355
+ def runOnTime(self) -> list[int]:
356
+ """Return list of run on time actions."""
357
+ return list(self.raw_data["runOnTime"])
358
+
359
+ @property
360
+ def target_temperature(self) -> list[dict]:
361
+ """Return list of target temperature actions."""
362
+ return [
363
+ MieleActionTargetTemperature(temp)
364
+ for temp in self.raw_data["state"]["targetTemperature"]
365
+ ]
366
+
367
+ @property
368
+ def power_on_enabled(self) -> bool:
369
+ """Return powerOn enabled."""
370
+ return self.raw_data["powerOn"]
371
+
372
+ @power_on_enabled.setter
373
+ def power_on_enabled(self, value: bool) -> None:
374
+ """Return powerOn enabled."""
375
+ self.raw_data["powerOn"] = value
376
+
377
+ @property
378
+ def power_off_enabled(self) -> bool:
379
+ """Return powerOff enabled."""
380
+ return self.raw_data["powerOff"]
381
+
382
+ @power_off_enabled.setter
383
+ def power_off_enabled(self, value: bool) -> None:
384
+ """Return powerOff enabled."""
385
+ self.raw_data["powerOff"] = value
386
+
387
+ @property
388
+ def device_name_enabled(self) -> bool:
389
+ """Return deviceName enabled."""
390
+ return self.raw_data["deviceName"]
391
+
392
+
393
+ class MieleProgramsAvailable:
394
+ """Model for available programs."""
395
+
396
+ def __init__(self, raw_data: dict) -> None:
397
+ """Initialize MieleProgramsAvailable."""
398
+ self.raw_data = raw_data
399
+
400
+ @property
401
+ def programs(self) -> list[MieleProgramAvailable]:
402
+ """Return list of all available programs."""
403
+ return [MieleProgramAvailable(program) for program in self.raw_data]
404
+
405
+
406
+ class MieleProgramAvailable:
407
+ """Model for available programs."""
408
+
409
+ def __init__(self, raw_data: dict) -> None:
410
+ """Initialize MieleProgramAvailable."""
411
+ self.raw_data = raw_data
412
+
413
+ @property
414
+ def raw(self) -> dict:
415
+ """Return raw data."""
416
+ return self.raw_data
417
+
418
+ @property
419
+ def program_id(self) -> int | None:
420
+ """Return the ID of the program."""
421
+ return self.raw_data["programId"]
422
+
423
+ @property
424
+ def program_name(self) -> str | None:
425
+ """Return the name of the program."""
426
+ return self.raw_data["program"]
427
+
428
+ @property
429
+ def parameters(self) -> dict | None:
430
+ """Return the parameters of the program."""
431
+ return self.raw_data["parameters"]
432
+
433
+ @property
434
+ def temperature(self) -> dict | None:
435
+ """Return the temperature parameter of the program."""
436
+ return self.raw_data["parameters"].get("temperature")
437
+
438
+ @property
439
+ def temperature_min(self) -> int | None:
440
+ """Return the min temperature parameter of the program."""
441
+ return self.raw_data["parameters"]["temperature"]["min"]
442
+
443
+ @property
444
+ def temperature_max(self) -> int | None:
445
+ """Return the max temperature parameter of the program."""
446
+ return self.raw_data["parameters"]["temperature"]["max"]
447
+
448
+ @property
449
+ def temperature_step(self) -> int | None:
450
+ """Return the step temperature parameter of the program."""
451
+ return self.raw_data["parameters"]["temperature"]["step"]
452
+
453
+ @property
454
+ def temperature_mandatory(self) -> bool | None:
455
+ """Return the mandatory temperature parameter of the program."""
456
+ return self.raw_data["parameters"]["temperature"]["mandatory"]
457
+
458
+ @property
459
+ def duration_min(self) -> list[int] | None:
460
+ """Return the mandatory min parameter of the program."""
461
+ return self.raw_data["parameters"]["duration"]["min"]
462
+
463
+ @property
464
+ def duration_max(self) -> list[int] | None:
465
+ """Return the duration max parameter of the program."""
466
+ return self.raw_data["parameters"]["duration"]["max"]
467
+
468
+ @property
469
+ def duration_mandatory(self) -> bool | None:
470
+ """Return the mandatory duration parameter of the program."""
471
+ return self.raw_data["parameters"]["duration"]["mandatory"]
@@ -12,7 +12,7 @@ from typing import Any
12
12
 
13
13
  from aiohttp import ClientResponse, ClientResponseError, ClientSession, ClientTimeout
14
14
 
15
- from .const import MIELE_API, VERSION
15
+ from .const import AIO_TIMEOUT, MIELE_API, VERSION
16
16
 
17
17
  CONTENT_TYPE = "application/json"
18
18
  USER_AGENT_BASE = f"Pymiele/{VERSION}"
@@ -59,7 +59,7 @@ class AbstractAuth(ABC):
59
59
 
60
60
  async def get_devices(self) -> dict:
61
61
  """Get all devices."""
62
- async with asyncio.timeout(10):
62
+ async with asyncio.timeout(AIO_TIMEOUT):
63
63
  res = await self.request(
64
64
  "GET", "/devices", headers={"Accept": "application/json"}
65
65
  )
@@ -68,7 +68,7 @@ class AbstractAuth(ABC):
68
68
 
69
69
  async def get_actions(self, serial: str) -> dict:
70
70
  """Get actions for a device."""
71
- async with asyncio.timeout(10):
71
+ async with asyncio.timeout(AIO_TIMEOUT):
72
72
  res = await self.request(
73
73
  "GET",
74
74
  f"/devices/{serial}/actions",
@@ -79,7 +79,7 @@ class AbstractAuth(ABC):
79
79
 
80
80
  async def get_programs(self, serial: str) -> dict:
81
81
  """Get programs for a device."""
82
- async with asyncio.timeout(10):
82
+ async with asyncio.timeout(AIO_TIMEOUT):
83
83
  res = await self.request(
84
84
  "GET",
85
85
  f"/devices/{serial}/programs",
@@ -90,7 +90,7 @@ class AbstractAuth(ABC):
90
90
 
91
91
  async def get_rooms(self, serial: str) -> dict:
92
92
  """Get rooms for a device."""
93
- async with asyncio.timeout(10):
93
+ async with asyncio.timeout(AIO_TIMEOUT):
94
94
  res = await self.request(
95
95
  "GET",
96
96
  f"/devices/{serial}/rooms",
@@ -104,7 +104,7 @@ class AbstractAuth(ABC):
104
104
  ) -> ClientResponse:
105
105
  """Set target temperature."""
106
106
  temp = round(temperature)
107
- async with asyncio.timeout(10):
107
+ async with asyncio.timeout(AIO_TIMEOUT):
108
108
  data = {"targetTemperature": [{"zone": zone, "value": temp}]}
109
109
  res = await self.request(
110
110
  "PUT",
@@ -125,7 +125,7 @@ class AbstractAuth(ABC):
125
125
  """Send action command."""
126
126
 
127
127
  _LOGGER.debug("send_action serial: %s, data: %s", serial, data)
128
- async with asyncio.timeout(10):
128
+ async with asyncio.timeout(AIO_TIMEOUT):
129
129
  res = await self.request(
130
130
  "PUT",
131
131
  f"/devices/{serial}/actions",
@@ -145,7 +145,7 @@ class AbstractAuth(ABC):
145
145
  """Send start program command."""
146
146
 
147
147
  _LOGGER.debug("set_program serial: %s, data: %s", serial, data)
148
- async with asyncio.timeout(10):
148
+ async with asyncio.timeout(AIO_TIMEOUT):
149
149
  res = await self.request(
150
150
  "PUT",
151
151
  f"/devices/{serial}/programs",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymiele
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Python library for Miele integration with Home Assistant
5
5
  Author-email: Ake Strandberg <ake@strandberg.eu>
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.3.0
2
+ current_version = 0.3.2
3
3
 
4
4
  [egg_info]
5
5
  tag_build =
@@ -1,698 +0,0 @@
1
- """Data models for Miele API."""
2
- # Todo: Move to pymiele when complete and stable
3
-
4
- from __future__ import annotations
5
-
6
-
7
- class MieleDevices:
8
- """Data for all devices from API."""
9
-
10
- def __init__(self, raw_data: dict) -> None:
11
- """Initialize MieleDevices."""
12
- self.raw_data = raw_data
13
-
14
- @property
15
- def devices(self) -> list[str]:
16
- """Return list of all devices."""
17
-
18
- return list(self.raw_data.keys())
19
-
20
-
21
- class MieleDevice:
22
- """Data for a single device from API."""
23
-
24
- def __init__(self, raw_data: dict) -> None:
25
- """Initialize MieleDevice."""
26
- self.raw_data = raw_data
27
-
28
- @property
29
- def raw(self) -> dict:
30
- """Return raw data."""
31
- return self.raw_data
32
-
33
- @property
34
- def fab_number(self) -> str:
35
- """Return the ID of the device."""
36
- return str(self.raw_data["ident"]["deviceIdentLabel"]["fabNumber"])
37
-
38
- @property
39
- def device_type(self) -> int:
40
- """Return the type of the device."""
41
- return self.raw_data["ident"]["type"]["value_raw"]
42
-
43
- @property
44
- def device_type_localized(self) -> int:
45
- """Return the type of the device."""
46
- return self.raw_data["ident"]["type"]["value_localized"]
47
-
48
- @property
49
- def device_name(self) -> str:
50
- """Return the name of the device."""
51
- return self.raw_data["ident"]["deviceName"]
52
-
53
- @property
54
- def tech_type(self) -> str:
55
- """Return the tech type of the device."""
56
- return self.raw_data["ident"]["deviceIdentLabel"]["techType"]
57
-
58
- @property
59
- def xkm_tech_type(self) -> str:
60
- """Return the xkm tech type of the device."""
61
- return self.raw_data["ident"]["xkmIdentLabel"]["techType"]
62
-
63
- @property
64
- def xkm_release_version(self) -> str:
65
- """Return the xkm release version of the device."""
66
- return self.raw_data["ident"]["xkmIdentLabel"]["releaseVersion"]
67
-
68
- @property
69
- def state_program_id(self) -> int:
70
- """Return the program ID of the device."""
71
- return self.raw_data["state"]["ProgramID"]["value_raw"]
72
-
73
- @property
74
- def state_status(self) -> int:
75
- """Return the status of the device."""
76
- return self.raw_data["state"]["status"]["value_raw"]
77
-
78
- @property
79
- def state_program_type(self) -> int:
80
- """Return the program type of the device."""
81
- return self.raw_data["state"]["programType"]["value_raw"]
82
-
83
- @property
84
- def state_program_phase(self) -> int:
85
- """Return the program phase of the device."""
86
- return self.raw_data["state"]["programPhase"]["value_raw"]
87
-
88
- @property
89
- def state_remaining_time(self) -> list[int]:
90
- """Return the remaining time of the device."""
91
- return self.raw_data["state"]["remainingTime"]
92
-
93
- @property
94
- def state_start_time(self) -> list[int]:
95
- """Return the start time of the device."""
96
- return self.raw_data["state"]["startTime"]
97
-
98
- @property
99
- def state_target_temperature(self) -> list[dict]:
100
- """Return the target temperature of the device."""
101
- return self.raw_data["state"]["targetTemperature"]
102
-
103
- @property
104
- def state_core_target_temperature(self) -> list[dict]:
105
- """Return the core target temperature of the device."""
106
- return self.raw_data["state"]["coreTargetTemperature"]
107
-
108
- @property
109
- def state_temperature(self) -> list[int]:
110
- """Return the temperature of the device."""
111
- return [temp["value_raw"] for temp in self.raw_data["state"]["temperature"]]
112
-
113
- @property
114
- def state_temperature_1(self) -> int:
115
- """Return the temperature in zone 1 of the device."""
116
- return self.raw_data["state"]["temperature"][0]["value_raw"]
117
-
118
- @property
119
- def state_temperature_2(self) -> int:
120
- """Return the temperature in zone 2 of the device."""
121
- return self.raw_data["state"]["temperature"][1]["value_raw"]
122
-
123
- @property
124
- def state_temperature_3(self) -> int:
125
- """Return the temperature in zone 3 of the device."""
126
- return self.raw_data["state"]["temperature"][2]["value_raw"]
127
-
128
- @property
129
- def state_core_temperature(self) -> list[dict]:
130
- """Return the core temperature of the device."""
131
- return self.raw_data["state"]["coreTemperature"]
132
-
133
- @property
134
- def state_core_temperature_1(self) -> list[dict]:
135
- """Return the core temperature in zone 1 of the device."""
136
- return self.raw_data["state"]["coreTemperature"][0]["value_raw"]
137
-
138
- @property
139
- def state_core_temperature_2(self) -> list[dict]:
140
- """Return the core temperature in zone 2 of the device."""
141
- return self.raw_data["state"]["coreTemperature"][1]["value_raw"]
142
-
143
- @property
144
- def state_signal_info(self) -> bool:
145
- """Return the signal info of the device."""
146
- return self.raw_data["state"]["signalInfo"]
147
-
148
- @property
149
- def state_signal_failure(self) -> bool:
150
- """Return the signal failure of the device."""
151
- return self.raw_data["state"]["signalFailure"]
152
-
153
- @property
154
- def state_signal_door(self) -> bool:
155
- """Return the signal door of the device."""
156
- return self.raw_data["state"]["signalDoor"]
157
-
158
- @property
159
- def state_full_remote_control(self) -> bool:
160
- """Return the remote control enable of the device."""
161
- return self.raw_data["state"]["remoteEnable"]["fullRemoteControl"]
162
-
163
- @property
164
- def state_smart_grid(self) -> bool:
165
- """Return the smart grid of the device."""
166
- return self.raw_data["state"]["remoteEnable"]["smartGrid"]
167
-
168
- @property
169
- def state_mobile_start(self) -> bool:
170
- """Return the mobile start of the device."""
171
- return self.raw_data["state"]["remoteEnable"]["mobileStart"]
172
-
173
- @property
174
- def state_ambient_light(self) -> bool:
175
- """Return the ambient light of the device."""
176
- return self.raw_data["state"]["ambientLight"]
177
-
178
- @property
179
- def state_light(self) -> bool:
180
- """Return the light of the device."""
181
- return self.raw_data["state"]["light"]
182
-
183
- @property
184
- def state_elapsed_time(self) -> list[int]:
185
- """Return the elapsed time of the device."""
186
- return self.raw_data["state"]["elapsedTime"]
187
-
188
- @property
189
- def state_spinning_speed(self) -> int | None:
190
- """Return the spinning speed of the device."""
191
- return self.raw_data["state"]["spinningSpeed"]
192
-
193
- @property
194
- def state_drying_step(self) -> int | None:
195
- """Return the drying step of the device."""
196
- return self.raw_data["state"]["dryingStep"]
197
-
198
- @property
199
- def state_ventilation_step(self) -> int | None:
200
- """Return the ventilation step of the device."""
201
- return self.raw_data["state"]["ventilationStep"]
202
-
203
- @property
204
- def state_plate_step(self) -> list[dict]:
205
- """Return the plate step of the device."""
206
- return self.raw_data["state"]["plateStep"]
207
-
208
- @property
209
- def state_eco_feedback(self) -> dict | None:
210
- """Return the eco feedback of the device."""
211
- return self.raw_data["state"]["ecoFeedback"]
212
-
213
- @property
214
- def state_battery_level(self) -> int | None:
215
- """Return the battery level of the device."""
216
- return self.raw_data["state"]["batteryLevel"]
217
-
218
-
219
- class MieleAction:
220
- """Actions for Miele devices."""
221
-
222
- def __init__(self, raw_data: dict) -> None:
223
- """Initialize MieleAction."""
224
- self.raw_data = raw_data
225
-
226
- # Todo : Add process actions
227
- @property
228
- def raw(self) -> dict:
229
- """Return raw data."""
230
- return self.raw_data
231
-
232
- @property
233
- def actions(self) -> list[str]:
234
- """Return list of all actions."""
235
- return list(self.raw_data.keys())
236
-
237
- @property
238
- def modes(self) -> list[int]:
239
- """Return list of modes."""
240
- return list(self.raw_data["modes"])
241
-
242
- @property
243
- def process_actions(self) -> list[int]:
244
- """Return list of process actions."""
245
- return list(self.raw_data["processAction"])
246
-
247
- @property
248
- def light(self) -> list[int]:
249
- """Return list of light actions."""
250
- return list(self.raw_data["light"])
251
-
252
- @property
253
- def ambient_light(self) -> list[int]:
254
- """Return list of ambient light actions."""
255
- return list(self.raw_data["ambientLight"])
256
-
257
- @property
258
- def start_time(self) -> list[int]:
259
- """Return list of start time actions."""
260
- return list(self.raw_data["start_time"])
261
-
262
- @property
263
- def ventilation_setp(self) -> list[int]:
264
- """Return list of ventilation step actions."""
265
- return list(self.raw_data["ventilationStep"])
266
-
267
- @property
268
- def program_id(self) -> list[int]:
269
- """Return list of program id actions."""
270
- return list(self.raw_data["programId"])
271
-
272
- @property
273
- def runOnTime(self) -> list[int]:
274
- """Return list of run on time actions."""
275
- return list(self.raw_data["runOnTime"])
276
-
277
- @property
278
- def target_temperature(self) -> list[dict]:
279
- """Return list of target temperature actions."""
280
- return list(self.raw_data["targetTemperature"])
281
-
282
- @property
283
- def power_on_enabled(self) -> bool:
284
- """Return powerOn enabled."""
285
- return self.raw_data["powerOn"]
286
-
287
- @property
288
- def power_off_enabled(self) -> bool:
289
- """Return powerOff enabled."""
290
- return self.raw_data["powerOff"]
291
-
292
- @property
293
- def device_name_enabled(self) -> bool:
294
- """Return deviceName enabled."""
295
- return self.raw_data["deviceName"]
296
-
297
-
298
- # Todo: Remove reference data
299
- # TEST_DATA = """
300
- # { "711934968": {
301
- # "ident": {
302
- # "type": {
303
- # "key_localized": "Device type",
304
- # "value_raw": 20,
305
- # "value_localized": "Freezer"
306
- # },
307
- # "deviceName": "",
308
- # "protocolVersion": 201,
309
- # "deviceIdentLabel": {
310
- # "fabNumber": "711934968",
311
- # "fabIndex": "21",
312
- # "techType": "FNS 28463 E ed/",
313
- # "matNumber": "10805070",
314
- # "swids": [
315
- # "4497"
316
- # ]
317
- # },
318
- # "xkmIdentLabel": {
319
- # "techType": "EK042",
320
- # "releaseVersion": "31.17"
321
- # }
322
- # },
323
- # "state": {
324
- # "ProgramID": {
325
- # "value_raw": 0,
326
- # "value_localized": "",
327
- # "key_localized": "Program name"
328
- # },
329
- # "status": {
330
- # "value_raw": 5,
331
- # "value_localized": "In use",
332
- # "key_localized": "status"
333
- # },
334
- # "programType": {
335
- # "value_raw": 0,
336
- # "value_localized": "",
337
- # "key_localized": "Program type"
338
- # },
339
- # "programPhase": {
340
- # "value_raw": 0,
341
- # "value_localized": "",
342
- # "key_localized": "Program phase"
343
- # },
344
- # "remainingTime": [
345
- # 0,
346
- # 0
347
- # ],
348
- # "startTime": [
349
- # 0,
350
- # 0
351
- # ],
352
- # "targetTemperature": [
353
- # {
354
- # "value_raw": -1800,
355
- # "value_localized": -18,
356
- # "unit": "Celsius"
357
- # },
358
- # {
359
- # "value_raw": -32768,
360
- # "value_localized": null,
361
- # "unit": "Celsius"
362
- # },
363
- # {
364
- # "value_raw": -32768,
365
- # "value_localized": null,
366
- # "unit": "Celsius"
367
- # }
368
- # ],
369
- # "coreTargetTemperature": [],
370
- # "temperature": [
371
- # {
372
- # "value_raw": -1800,
373
- # "value_localized": -18,
374
- # "unit": "Celsius"
375
- # },
376
- # {
377
- # "value_raw": -32768,
378
- # "value_localized": null,
379
- # "unit": "Celsius"
380
- # },
381
- # {
382
- # "value_raw": -32768,
383
- # "value_localized": null,
384
- # "unit": "Celsius"
385
- # }
386
- # ],
387
- # "coreTemperature": [],
388
- # "signalInfo": false,
389
- # "signalFailure": false,
390
- # "signalDoor": false,
391
- # "remoteEnable": {
392
- # "fullRemoteControl": true,
393
- # "smartGrid": false,
394
- # "mobileStart": false
395
- # },
396
- # "ambientLight": null,
397
- # "light": null,
398
- # "elapsedTime": [],
399
- # "spinningSpeed": {
400
- # "unit": "rpm",
401
- # "value_raw": null,
402
- # "value_localized": null,
403
- # "key_localized": "Spin speed"
404
- # },
405
- # "dryingStep": {
406
- # "value_raw": null,
407
- # "value_localized": "",
408
- # "key_localized": "Drying level"
409
- # },
410
- # "ventilationStep": {
411
- # "value_raw": null,
412
- # "value_localized": "",
413
- # "key_localized": "Fan level"
414
- # },
415
- # "plateStep": [],
416
- # "ecoFeedback": null,
417
- # "batteryLevel": null
418
- # }
419
- # },
420
- # "711944869": {
421
- # "ident": {
422
- # "type": {
423
- # "key_localized": "Device type",
424
- # "value_raw": 19,
425
- # "value_localized": "Refrigerator"
426
- # },
427
- # "deviceName": "",
428
- # "protocolVersion": 201,
429
- # "deviceIdentLabel": {
430
- # "fabNumber": "711944869",
431
- # "fabIndex": "17",
432
- # "techType": "KS 28423 D ed/c",
433
- # "matNumber": "10804770",
434
- # "swids": [
435
- # "4497"
436
- # ]
437
- # },
438
- # "xkmIdentLabel": {
439
- # "techType": "EK042",
440
- # "releaseVersion": "31.17"
441
- # }
442
- # },
443
- # "state": {
444
- # "ProgramID": {
445
- # "value_raw": 0,
446
- # "value_localized": "",
447
- # "key_localized": "Program name"
448
- # },
449
- # "status": {
450
- # "value_raw": 5,
451
- # "value_localized": "In use",
452
- # "key_localized": "status"
453
- # },
454
- # "programType": {
455
- # "value_raw": 0,
456
- # "value_localized": "",
457
- # "key_localized": "Program type"
458
- # },
459
- # "programPhase": {
460
- # "value_raw": 0,
461
- # "value_localized": "",
462
- # "key_localized": "Program phase"
463
- # },
464
- # "remainingTime": [
465
- # 0,
466
- # 0
467
- # ],
468
- # "startTime": [
469
- # 0,
470
- # 0
471
- # ],
472
- # "targetTemperature": [
473
- # {
474
- # "value_raw": 400,
475
- # "value_localized": 4,
476
- # "unit": "Celsius"
477
- # },
478
- # {
479
- # "value_raw": -32768,
480
- # "value_localized": null,
481
- # "unit": "Celsius"
482
- # },
483
- # {
484
- # "value_raw": -32768,
485
- # "value_localized": null,
486
- # "unit": "Celsius"
487
- # }
488
- # ],
489
- # "coreTargetTemperature": [],
490
- # "temperature": [
491
- # {
492
- # "value_raw": 400,
493
- # "value_localized": 4,
494
- # "unit": "Celsius"
495
- # },
496
- # {
497
- # "value_raw": -32768,
498
- # "value_localized": null,
499
- # "unit": "Celsius"
500
- # },
501
- # {
502
- # "value_raw": -32768,
503
- # "value_localized": null,
504
- # "unit": "Celsius"
505
- # }
506
- # ],
507
- # "coreTemperature": [],
508
- # "signalInfo": false,
509
- # "signalFailure": false,
510
- # "signalDoor": false,
511
- # "remoteEnable": {
512
- # "fullRemoteControl": true,
513
- # "smartGrid": false,
514
- # "mobileStart": false
515
- # },
516
- # "ambientLight": null,
517
- # "light": null,
518
- # "elapsedTime": [],
519
- # "spinningSpeed": {
520
- # "unit": "rpm",
521
- # "value_raw": null,
522
- # "value_localized": null,
523
- # "key_localized": "Spin speed"
524
- # },
525
- # "dryingStep": {
526
- # "value_raw": null,
527
- # "value_localized": "",
528
- # "key_localized": "Drying level"
529
- # },
530
- # "ventilationStep": {
531
- # "value_raw": null,
532
- # "value_localized": "",
533
- # "key_localized": "Fan level"
534
- # },
535
- # "plateStep": [],
536
- # "ecoFeedback": null,
537
- # "batteryLevel": null
538
- # }
539
- # },
540
- # "000186528088": {
541
- # "ident": {
542
- # "type": {
543
- # "key_localized": "Device type",
544
- # "value_raw": 1,
545
- # "value_localized": "Washing machine"
546
- # },
547
- # "deviceName": "",
548
- # "protocolVersion": 4,
549
- # "deviceIdentLabel": {
550
- # "fabNumber": "000186528088",
551
- # "fabIndex": "44",
552
- # "techType": "WCI870",
553
- # "matNumber": "11387290",
554
- # "swids": [
555
- # "5975",
556
- # "20456",
557
- # "25213",
558
- # "25191",
559
- # "25446",
560
- # "25205",
561
- # "25447",
562
- # "25319"
563
- # ]
564
- # },
565
- # "xkmIdentLabel": {
566
- # "techType": "EK057",
567
- # "releaseVersion": "08.32"
568
- # }
569
- # },
570
- # "state": {
571
- # "ProgramID": {
572
- # "value_raw": 0,
573
- # "value_localized": "",
574
- # "key_localized": "Program name"
575
- # },
576
- # "status": {
577
- # "value_raw": 1,
578
- # "value_localized": "Off",
579
- # "key_localized": "status"
580
- # },
581
- # "programType": {
582
- # "value_raw": 0,
583
- # "value_localized": "",
584
- # "key_localized": "Program type"
585
- # },
586
- # "programPhase": {
587
- # "value_raw": 0,
588
- # "value_localized": "",
589
- # "key_localized": "Program phase"
590
- # },
591
- # "remainingTime": [
592
- # 0,
593
- # 0
594
- # ],
595
- # "startTime": [
596
- # 0,
597
- # 0
598
- # ],
599
- # "targetTemperature": [
600
- # {
601
- # "value_raw": -32768,
602
- # "value_localized": null,
603
- # "unit": "Celsius"
604
- # },
605
- # {
606
- # "value_raw": -32768,
607
- # "value_localized": null,
608
- # "unit": "Celsius"
609
- # },
610
- # {
611
- # "value_raw": -32768,
612
- # "value_localized": null,
613
- # "unit": "Celsius"
614
- # }
615
- # ],
616
- # "coreTargetTemperature": [
617
- # {
618
- # "value_raw": -32768,
619
- # "value_localized": null,
620
- # "unit": "Celsius"
621
- # }
622
- # ],
623
- # "temperature": [
624
- # {
625
- # "value_raw": -32768,
626
- # "value_localized": null,
627
- # "unit": "Celsius"
628
- # },
629
- # {
630
- # "value_raw": -32768,
631
- # "value_localized": null,
632
- # "unit": "Celsius"
633
- # },
634
- # {
635
- # "value_raw": -32768,
636
- # "value_localized": null,
637
- # "unit": "Celsius"
638
- # }
639
- # ],
640
- # "coreTemperature": [
641
- # {
642
- # "value_raw": -32768,
643
- # "value_localized": null,
644
- # "unit": "Celsius"
645
- # }
646
- # ],
647
- # "signalInfo": false,
648
- # "signalFailure": false,
649
- # "signalDoor": true,
650
- # "remoteEnable": {
651
- # "fullRemoteControl": true,
652
- # "smartGrid": false,
653
- # "mobileStart": false
654
- # },
655
- # "ambientLight": null,
656
- # "light": null,
657
- # "elapsedTime": [
658
- # 0,
659
- # 0
660
- # ],
661
- # "spinningSpeed": {
662
- # "unit": "rpm",
663
- # "value_raw": null,
664
- # "value_localized": null,
665
- # "key_localized": "Spin speed"
666
- # },
667
- # "dryingStep": {
668
- # "value_raw": null,
669
- # "value_localized": "",
670
- # "key_localized": "Drying level"
671
- # },
672
- # "ventilationStep": {
673
- # "value_raw": null,
674
- # "value_localized": "",
675
- # "key_localized": "Fan level"
676
- # },
677
- # "plateStep": [],
678
- # "ecoFeedback": null,
679
- # "batteryLevel": null
680
- # }
681
- # }
682
- # }
683
- # """
684
-
685
- # raw = json.loads(TEST_DATA)
686
-
687
- # data = MieleDevices(raw)
688
- # print(data.devices)
689
- # print(data.raw_data[data.devices[0]])
690
-
691
- # machine = MieleDevice(data.raw_data[data.devices[0]])
692
- # print(machine.fab_number)
693
- # print(machine.device_type)
694
- # print(machine.device_name)
695
- # print(machine.tech_type)
696
- # print(machine.xkm_tech_type)
697
- # print(machine.xkm_release_version)
698
- # print(machine.state_program_id)
File without changes
File without changes
File without changes
File without changes
File without changes