Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viomivacuum: Fix incorrect attribute accesses on status output #1677

Merged
merged 1 commit into from
Jan 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions miio/integrations/vacuum/viomi/viomivacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- Battery - battery_life
- Dock - set_charge
- Start/Pause - set_mode_withroom
- Modes (Vacuum/Vacuum&Mop/Mop) - set_mop/id_mop
- Modes (Vacuum/Vacuum&Mop/Mop) - set_mop/is_mop
- Fan Speed (Silent/Standard/Medium/Turbo) - set_suction/suction_grade
- Water Level (Low/Medium/High) - set_suction/water_grade

Expand All @@ -29,7 +29,7 @@
- Area editor - MISSING
- Reset map - MISSING
- Device leveling - MISSING
- Looking for the vacuum-mop - MISSING (find_me)
- Looking for the vacuum-mop
- Consumables statistics - get_properties
- Remote Control - MISSING

Expand Down Expand Up @@ -511,7 +511,7 @@ def repeat_cleaning(self) -> bool:

True if the cleaning is performed twice
"""
return self.data["repeat_state"]
return bool(self.data["repeat_state"])

@property
@sensor("Start time")
Expand Down Expand Up @@ -628,30 +628,22 @@ def __init__(
"Box type: {result.bin_type}\n"
"Fan speed: {result.fanspeed}\n"
"Water grade: {result.water_grade}\n"
"Mop mode: {result.mop_mode}\n"
"Mop attached: {result.mop_attached}\n"
"Vacuum along the edges: {result.edge_state}\n"
"Mop route pattern: {result.mop_route}\n"
"Mop route pattern: {result.route_pattern}\n"
"Secondary Cleanup: {result.repeat_cleaning}\n"
"Sound Volume: {result.sound_volume}\n"
"Clean time: {result.clean_time}\n"
"Clean area: {result.clean_area} m²\n"
"LED state: {result.led_state}\n"
"\n"
"Map\n"
"===\n\n"
"Current map ID: {result.current_map_id}\n"
"Remember map: {result.remember_map}\n"
"Has map: {result.has_map}\n"
"Has new map: {result.has_new_map}\n"
"Number of maps: {result.map_number}\n"
"\n"
"Unknown properties\n"
"=================\n\n"
"Light state: {result.light_state}\n"
# "Order time: {result.order_time}\n"
# "Start time: {result.start_time}\n"
# "water_percent: {result.water_percent}\n"
# "zone_data: {result.zone_data}\n",
"Number of maps: {result.map_number}\n",
)
)
def status(self) -> ViomiVacuumStatus:
Expand Down Expand Up @@ -915,10 +907,10 @@ def set_repeat_cleaning(self, state: bool):
"""Set or Unset repeat mode (Secondary cleanup)."""
return self.send("set_repeat", [int(state)])

@command(click.argument("mop_mode", type=EnumType(ViomiRoutePattern)))
def set_route_pattern(self, mop_mode: ViomiRoutePattern):
@command(click.argument("route_pattern", type=EnumType(ViomiRoutePattern)))
def set_route_pattern(self, route_pattern: ViomiRoutePattern):
"""Set the mop route pattern."""
self.send("set_moproute", [mop_mode.value])
self.send("set_moproute", [route_pattern.value])

@command()
def dnd_status(self):
Expand Down