Skip to content

Commit 728e53a

Browse files
Lash-LCopilot
andauthored
feat: improvements to B01 for HA integration (#686)
* fix: use value instead of name to get lower cased * chore: update roborock/data/code_mappings.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d01287a commit 728e53a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

roborock/data/b01_q7/b01_q7_containers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,19 +187,19 @@ def sensor_dirty_time_left(self) -> int | None:
187187
@property
188188
def status_name(self) -> str | None:
189189
"""Returns the name of the current status."""
190-
return self.status.name if self.status is not None else None
190+
return self.status.value if self.status is not None else None
191191

192192
@property
193193
def fault_name(self) -> str | None:
194194
"""Returns the name of the current fault."""
195-
return self.fault.name if self.fault is not None else None
195+
return self.fault.value if self.fault is not None else None
196196

197197
@property
198198
def wind_name(self) -> str | None:
199199
"""Returns the name of the current fan speed (wind)."""
200-
return self.wind.name if self.wind is not None else None
200+
return self.wind.value if self.wind is not None else None
201201

202202
@property
203203
def work_mode_name(self) -> str | None:
204204
"""Returns the name of the current work mode."""
205-
return self.work_mode.name if self.work_mode is not None else None
205+
return self.work_mode.value if self.work_mode is not None else None

roborock/data/code_mappings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def from_code(cls, code: int):
7272

7373
@classmethod
7474
def keys(cls) -> list[str]:
75-
"""Returns a list of all member names."""
76-
return [member.name for member in cls]
75+
"""Returns a list of all member values."""
76+
return [member.value for member in cls]
7777

7878

7979
ProductInfo = namedtuple("ProductInfo", ["nickname", "short_models"])

0 commit comments

Comments
 (0)