|
1 | 1 | from dataclasses import dataclass, field |
2 | 2 |
|
3 | 3 | from ..containers import RoborockBase |
4 | | -from .b01_q7_code_mappings import B01Fault, SCWindMapping, WorkModeMapping, WorkStatusMapping |
| 4 | +from .b01_q7_code_mappings import ( |
| 5 | + B01Fault, |
| 6 | + SCWindMapping, |
| 7 | + WorkModeMapping, |
| 8 | + WorkStatusMapping, |
| 9 | +) |
5 | 10 |
|
6 | 11 |
|
7 | 12 | @dataclass |
@@ -128,3 +133,73 @@ class B01Props(RoborockBase): |
128 | 133 | serial_number: str | None = None |
129 | 134 | recommend: Recommend | None = None |
130 | 135 | add_sweep_status: int | None = None |
| 136 | + |
| 137 | + @property |
| 138 | + def main_brush_time_left(self) -> int | None: |
| 139 | + """ |
| 140 | + Returns estimated remaining life of the main brush in minutes. |
| 141 | + Total life is 300 hours (18000 minutes). |
| 142 | + """ |
| 143 | + if self.main_brush is None: |
| 144 | + return None |
| 145 | + return max(0, 18000 - self.main_brush) |
| 146 | + |
| 147 | + @property |
| 148 | + def side_brush_time_left(self) -> int | None: |
| 149 | + """ |
| 150 | + Returns estimated remaining life of the side brush in minutes. |
| 151 | + Total life is 200 hours (12000 minutes). |
| 152 | + """ |
| 153 | + if self.side_brush is None: |
| 154 | + return None |
| 155 | + return max(0, 12000 - self.side_brush) |
| 156 | + |
| 157 | + @property |
| 158 | + def filter_time_left(self) -> int | None: |
| 159 | + """ |
| 160 | + Returns estimated remaining life of the filter (hypa) in minutes. |
| 161 | + Total life is 150 hours (9000 minutes). |
| 162 | + """ |
| 163 | + if self.hypa is None: |
| 164 | + return None |
| 165 | + return max(0, 9000 - self.hypa) |
| 166 | + |
| 167 | + @property |
| 168 | + def mop_life_time_left(self) -> int | None: |
| 169 | + """ |
| 170 | + Returns estimated remaining life of the mop in minutes. |
| 171 | + Total life is 180 hours (10800 minutes). |
| 172 | + """ |
| 173 | + if self.mop_life is None: |
| 174 | + return None |
| 175 | + return max(0, 10800 - self.mop_life) |
| 176 | + |
| 177 | + @property |
| 178 | + def sensor_dirty_time_left(self) -> int | None: |
| 179 | + """ |
| 180 | + Returns estimated time until sensors need cleaning in minutes. |
| 181 | + Maintenance interval is typically 30 hours (1800 minutes). |
| 182 | + """ |
| 183 | + if self.main_sensor is None: |
| 184 | + return None |
| 185 | + return max(0, 1800 - self.main_sensor) |
| 186 | + |
| 187 | + @property |
| 188 | + def status_name(self) -> str | None: |
| 189 | + """Returns the name of the current status.""" |
| 190 | + return self.status.name if self.status is not None else None |
| 191 | + |
| 192 | + @property |
| 193 | + def fault_name(self) -> str | None: |
| 194 | + """Returns the name of the current fault.""" |
| 195 | + return self.fault.name if self.fault is not None else None |
| 196 | + |
| 197 | + @property |
| 198 | + def wind_name(self) -> str | None: |
| 199 | + """Returns the name of the current fan speed (wind).""" |
| 200 | + return self.wind.name if self.wind is not None else None |
| 201 | + |
| 202 | + @property |
| 203 | + def work_mode_name(self) -> str | None: |
| 204 | + """Returns the name of the current work mode.""" |
| 205 | + return self.work_mode.name if self.work_mode is not None else None |
0 commit comments