Skip to content

Commit 541ade3

Browse files
authored
Merge pull request #35 from dulek/x-styleb-time-fix
Fix time reporting on x-styleb
2 parents 0f073fd + 0dbef3a commit 541ade3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

custom_components/weback_vacuum/vacuum.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
VacDevice.ROBOT_ERROR: STATE_ERROR,
5050
}
5151

52+
# Some models report time in minutes, not seconds, we need to adjust
53+
# calculations for them.
54+
SUB_TYPES_REPORTING_MINUTES = [
55+
"x-styleb",
56+
]
57+
5258

5359
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
5460
"""Set up the Weback robot vacuums."""
@@ -233,7 +239,10 @@ def extra_state_attributes(self) -> dict:
233239
clean_time = self.device.robot_status["clean_time"]
234240
if clean_time is None:
235241
clean_time = 0
236-
extra_value["clean_time"] = (round(clean_time / 60, 0),)
242+
if self.device.sub_type in SUB_TYPES_REPORTING_MINUTES:
243+
extra_value["clean_time"] = (clean_time,)
244+
else:
245+
extra_value["clean_time"] = (round(clean_time / 60, 0),)
237246

238247
return extra_value
239248

0 commit comments

Comments
 (0)