pymiele 0.3.6__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.6"
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
@@ -143,21 +143,41 @@ class MieleDevice:
143
143
  """Return the program ID of the device."""
144
144
  return self.raw_data["state"]["ProgramID"]["value_raw"]
145
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
+
146
151
  @property
147
152
  def state_status(self) -> int:
148
153
  """Return the status of the device."""
149
154
  return self.raw_data["state"]["status"]["value_raw"]
150
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
+
151
161
  @property
152
162
  def state_program_type(self) -> int:
153
163
  """Return the program type of the device."""
154
164
  return self.raw_data["state"]["programType"]["value_raw"]
155
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
+
156
171
  @property
157
172
  def state_program_phase(self) -> int:
158
173
  """Return the program phase of the device."""
159
174
  return self.raw_data["state"]["programPhase"]["value_raw"]
160
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
+
161
181
  @property
162
182
  def state_remaining_time(self) -> list[int]:
163
183
  """Return the remaining time of the device."""
@@ -181,7 +201,7 @@ class MieleDevice:
181
201
  """Return the core target temperature of the device."""
182
202
  return [
183
203
  MieleTemperature(temp)
184
- for temp in self.raw_data["state"]["coretargetTemperature"]
204
+ for temp in self.raw_data["state"]["coreTargetTemperature"]
185
205
  ]
186
206
 
187
207
  @property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymiele
3
- Version: 0.3.6
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=tKBgQVpExWSIpP2VxJKJyxEBmZ6BQGohNZcL-6_ZRDc,237
3
- pymiele/model.py,sha256=5MYK8SOG4oBNsXXGB6InOnqDLA-easCJbBXhaMaVK_8,15611
4
- pymiele/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- pymiele/pymiele.py,sha256=M5P_rW61XZV06aelw5i9-qzJ9exabMYgLcehzuKd7-Y,8723
6
- pymiele-0.3.6.dist-info/licenses/LICENSE,sha256=scGm4_U2pd-rsGa6Edf6zsXFebrMT4RoyQz7-904_Wg,1072
7
- pymiele-0.3.6.dist-info/METADATA,sha256=geGMRgPZMwvufJY_4eQbgXhr_NRhS2CLhYqFYOhWjUw,747
8
- pymiele-0.3.6.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
9
- pymiele-0.3.6.dist-info/top_level.txt,sha256=BwkHrSO2w_Bfxh6s8Ikcao5enEuQOpQhJ3SwUXBqY10,8
10
- pymiele-0.3.6.dist-info/RECORD,,