pymiele 0.3.5__py3-none-any.whl → 0.4.0__py3-none-any.whl

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.
pymiele/__init__.py CHANGED
@@ -1,5 +1,6 @@
1
1
  """Library for Miele integration with Home Assistant."""
2
2
 
3
+ from .code_enum import * # noqa: F403
3
4
  from .const import * # noqa: F403
4
5
  from .const import VERSION as __version__ # noqa: F401
5
6
  from .model import * # noqa: F403
pymiele/code_enum.py ADDED
@@ -0,0 +1,52 @@
1
+ """Classes for code enums."""
2
+
3
+ from enum import IntEnum
4
+ import logging
5
+ from typing import Any
6
+
7
+ _LOGGER = logging.getLogger(__name__)
8
+ completed_warnings: set[str] = set()
9
+
10
+
11
+ class MieleEnum(IntEnum):
12
+ """Miele Enum for codes with int values."""
13
+
14
+ @property
15
+ def name(self) -> str:
16
+ """Force to lower case."""
17
+ return super().name.lower()
18
+
19
+ @classmethod
20
+ def _missing_(cls, value: object) -> Any | None:
21
+ if hasattr(cls, "unknown"):
22
+ warning = f"Missing {cls.__name__} code: {value} - defaulting to 'unknown'"
23
+ if warning not in completed_warnings:
24
+ completed_warnings.add(warning)
25
+ _LOGGER.warning(warning)
26
+ return cls.unknown
27
+ return None
28
+
29
+ @classmethod
30
+ def as_dict(cls) -> dict[str, int]:
31
+ """Return a dict of enum names and values."""
32
+ return {i.name: i.value for i in cls if i.name != "missing"}
33
+
34
+ @classmethod
35
+ def as_enum_dict(cls) -> dict[int, Any]:
36
+ """Return a dict of enum values and enum names."""
37
+ return {i.value: i for i in cls if i.name != "missing"}
38
+
39
+ @classmethod
40
+ def values(cls) -> list[int]:
41
+ """Return a list of enum values."""
42
+ return list(cls.as_dict().values())
43
+
44
+ @classmethod
45
+ def keys(cls) -> list[str]:
46
+ """Return a list of enum names."""
47
+ return list(cls.as_dict().keys())
48
+
49
+ @classmethod
50
+ def items(cls) -> Any:
51
+ """Return a list of enum items."""
52
+ return cls.as_dict().items()
pymiele/const.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Constants for pymiele."""
2
2
 
3
- VERSION = "0.3.5"
3
+ VERSION = "0.4.0"
4
4
 
5
5
  MIELE_API = "https://api.mcs3.miele.com/v1"
6
6
  OAUTH2_AUTHORIZE = "https://api.mcs3.miele.com/thirdparty/login"
pymiele/model.py CHANGED
@@ -68,6 +68,29 @@ class MieleActionTargetTemperature:
68
68
  return self.raw_data["max"]
69
69
 
70
70
 
71
+ class MielePlateStep:
72
+ """Model of plate step."""
73
+
74
+ def __init__(self, raw_data: dict) -> None:
75
+ """Initialize MielePlateStep."""
76
+ self.raw_data = raw_data
77
+
78
+ @property
79
+ def raw(self) -> dict:
80
+ """Return raw data."""
81
+ return self.raw_data
82
+
83
+ @property
84
+ def value_raw(self) -> int | None:
85
+ """Return raw value data."""
86
+ return self.raw_data["value_raw"]
87
+
88
+ @property
89
+ def value_localized(self) -> int | None:
90
+ """Return localized value."""
91
+ return self.raw_data["value_localized"]
92
+
93
+
71
94
  class MieleDevice:
72
95
  """Data for a single device from API."""
73
96
 
@@ -120,21 +143,41 @@ class MieleDevice:
120
143
  """Return the program ID of the device."""
121
144
  return self.raw_data["state"]["ProgramID"]["value_raw"]
122
145
 
146
+ @property
147
+ def state_program_id_localized(self) -> str:
148
+ """Return the program ID of the device."""
149
+ return self.raw_data["state"]["ProgramID"]["value_localized"]
150
+
123
151
  @property
124
152
  def state_status(self) -> int:
125
153
  """Return the status of the device."""
126
154
  return self.raw_data["state"]["status"]["value_raw"]
127
155
 
156
+ @property
157
+ def state_status_localized(self) -> str:
158
+ """Return the status of the device."""
159
+ return self.raw_data["state"]["status"]["value_localized"]
160
+
128
161
  @property
129
162
  def state_program_type(self) -> int:
130
163
  """Return the program type of the device."""
131
164
  return self.raw_data["state"]["programType"]["value_raw"]
132
165
 
166
+ @property
167
+ def state_program_type_localized(self) -> str:
168
+ """Return the program type of the device."""
169
+ return self.raw_data["state"]["programType"]["value_localized"]
170
+
133
171
  @property
134
172
  def state_program_phase(self) -> int:
135
173
  """Return the program phase of the device."""
136
174
  return self.raw_data["state"]["programPhase"]["value_raw"]
137
175
 
176
+ @property
177
+ def state_program_phase_localized(self) -> str:
178
+ """Return the program phase of the device."""
179
+ return self.raw_data["state"]["programPhase"]["value_localized"]
180
+
138
181
  @property
139
182
  def state_remaining_time(self) -> list[int]:
140
183
  """Return the remaining time of the device."""
@@ -154,11 +197,11 @@ class MieleDevice:
154
197
  ]
155
198
 
156
199
  @property
157
- def state_core_target_temperature(self) -> list[dict]:
200
+ def state_core_target_temperature(self) -> list[MieleTemperature]:
158
201
  """Return the core target temperature of the device."""
159
202
  return [
160
203
  MieleTemperature(temp)
161
- for temp in self.raw_data["state"]["coretargetTemperature"]
204
+ for temp in self.raw_data["state"]["coreTargetTemperature"]
162
205
  ]
163
206
 
164
207
  @property
@@ -257,9 +300,9 @@ class MieleDevice:
257
300
  self.raw_data["state"]["ventilationStep"]["value_raw"] = new_value
258
301
 
259
302
  @property
260
- def state_plate_step(self) -> list[dict]:
303
+ def state_plate_step(self) -> list[MielePlateStep]:
261
304
  """Return the plate step of the device."""
262
- return self.raw_data["state"]["plateStep"]
305
+ return [MielePlateStep(plate) for plate in self.raw_data["state"]["plateStep"]]
263
306
 
264
307
  @property
265
308
  def state_eco_feedback(self) -> dict | None:
@@ -362,7 +405,7 @@ class MieleAction:
362
405
  return list(self.raw_data["runOnTime"])
363
406
 
364
407
  @property
365
- def target_temperature(self) -> list[dict]:
408
+ def target_temperature(self) -> list[MieleActionTargetTemperature]:
366
409
  """Return list of target temperature actions."""
367
410
  return [
368
411
  MieleActionTargetTemperature(temp)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymiele
3
- Version: 0.3.5
3
+ Version: 0.4.0
4
4
  Summary: Python library for Miele integration with Home Assistant
5
5
  Author-email: Ake Strandberg <ake@strandberg.eu>
6
6
  License: MIT
@@ -0,0 +1,11 @@
1
+ pymiele/__init__.py,sha256=yaR_pvVA5HfAxQ9oHCk8CsoHfEkskdZLmxbY1QgrMBE,260
2
+ pymiele/code_enum.py,sha256=AAtxgSyNtX96SlfdrFZs1DVwqTDR0jG2KfmOFoAkjI4,1511
3
+ pymiele/const.py,sha256=9Lx35sUTeS1Vg7ISdkD9Yknfd8H7TAfNUIs8vCXPgFM,237
4
+ pymiele/model.py,sha256=xJ8-J2fRlNHCO6g2_8mzpv0IKroHB3-VllzfGyjs-s4,16355
5
+ pymiele/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ pymiele/pymiele.py,sha256=M5P_rW61XZV06aelw5i9-qzJ9exabMYgLcehzuKd7-Y,8723
7
+ pymiele-0.4.0.dist-info/licenses/LICENSE,sha256=scGm4_U2pd-rsGa6Edf6zsXFebrMT4RoyQz7-904_Wg,1072
8
+ pymiele-0.4.0.dist-info/METADATA,sha256=1E8syZTDYz-xkxh8HYppilAD2mjqYA1QWINZoCwYnIY,747
9
+ pymiele-0.4.0.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
10
+ pymiele-0.4.0.dist-info/top_level.txt,sha256=BwkHrSO2w_Bfxh6s8Ikcao5enEuQOpQhJ3SwUXBqY10,8
11
+ pymiele-0.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.1)
2
+ Generator: setuptools (80.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- pymiele/__init__.py,sha256=w_JvyaBHVGM7eo-FFwIWFbQUeAowoA_fbnAfCWJFGek,221
2
- pymiele/const.py,sha256=k5GfQFlwWb_PMu3F4DDAJTvJYJ3JS4snMpNWgs8TNJE,237
3
- pymiele/model.py,sha256=kqI9h3e3uqD1swxMtKCfFjkw2T2x5FoZagLEwwRkbhs,14969
4
- pymiele/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- pymiele/pymiele.py,sha256=M5P_rW61XZV06aelw5i9-qzJ9exabMYgLcehzuKd7-Y,8723
6
- pymiele-0.3.5.dist-info/licenses/LICENSE,sha256=scGm4_U2pd-rsGa6Edf6zsXFebrMT4RoyQz7-904_Wg,1072
7
- pymiele-0.3.5.dist-info/METADATA,sha256=ssFKRrQHP3ds2dhlyAPqWTmzLVW5vScv_TL7m9OyYVw,747
8
- pymiele-0.3.5.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
9
- pymiele-0.3.5.dist-info/top_level.txt,sha256=BwkHrSO2w_Bfxh6s8Ikcao5enEuQOpQhJ3SwUXBqY10,8
10
- pymiele-0.3.5.dist-info/RECORD,,