Skip to content

Commit 1cb969e

Browse files
author
jalcaras
committed
refactor: remove unused import, style
1 parent 4774dc0 commit 1cb969e

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

custom_components/weback_vacuum/vacuum.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""Support for Weback Vacuum Robots."""
2+
23
import logging
34

4-
import homeassistant.helpers.config_validation as cv
5-
import voluptuous as vol
65
from homeassistant.components.vacuum import (
76
STATE_CLEANING,
87
STATE_DOCKED,
@@ -13,7 +12,6 @@
1312
StateVacuumEntity,
1413
VacuumEntityFeature,
1514
)
16-
from homeassistant.helpers import entity_platform
1715
from homeassistant.helpers.icon import icon_for_battery_level
1816

1917
from . import DOMAIN, VacDevice
@@ -118,8 +116,9 @@ def state(self):
118116
_LOGGER.debug("Vacuum: state(from mapping)=%s", state_mapping)
119117
return state_mapping
120118
except KeyError:
121-
_LOGGER.error(
122-
"Found an unsupported state, state_code: %s", self.device.current_mode
119+
_LOGGER.exception(
120+
"Found an unsupported state, state_code: %s",
121+
self.device.current_mode,
123122
)
124123
return None
125124

@@ -137,7 +136,8 @@ def battery_icon(self):
137136
self.is_charging,
138137
)
139138
return icon_for_battery_level(
140-
battery_level=self.battery_level, charging=self.is_charging
139+
battery_level=self.battery_level,
140+
charging=self.is_charging,
141141
)
142142

143143
@property
@@ -158,18 +158,23 @@ def fan_speed(self):
158158

159159
@property
160160
def fan_speed_list(self):
161-
"""Get the list of available fan speed or /water level steps of the vacuum cleaner."""
161+
"""
162+
Get the list of available fan speed or
163+
water level steps of the vacuum cleaner
164+
"""
162165
# Check if robot is in Vacuum/Mop mode
163166
if self.device.vacuum_or_mop == 1:
164167
# Vacuum mode
165168
_LOGGER.debug(
166-
"Vacuum: (vacuum mode) fan_speed_list=%s", self.device.fan_speed_list
169+
"Vacuum: (vacuum mode) fan_speed_list=%s",
170+
self.device.fan_speed_list,
167171
)
168172
return self.device.fan_speed_list
169173
if self.device.vacuum_or_mop == 2:
170174
# Mop mode
171175
_LOGGER.debug(
172-
"Vacuum: (mop mode) fan_speed_list=%s", self.device.mop_level_list
176+
"Vacuum: (mop mode) fan_speed_list=%s",
177+
self.device.mop_level_list,
173178
)
174179
return self.device.mop_level_list
175180
# No Mop / No Fan
@@ -202,10 +207,7 @@ def is_charging(self):
202207
def extra_state_attributes(self) -> dict:
203208
"""Return the device-specific state attributes of this vacuum."""
204209

205-
if self.device.vacuum_or_mop == 1:
206-
mode = "vacuum"
207-
else:
208-
mode = "mop"
210+
mode = "vacuum" if self.device.vacuum_or_mop == 1 else "mop"
209211

210212
extra_value = {
211213
"robot_mode": mode,
@@ -247,7 +249,8 @@ def on_error(self, error):
247249
self._error = error
248250
_LOGGER.debug("Vacuum: on_error=%s", self._error)
249251
self.hass.bus.fire(
250-
"weback_vacuum", {"entity_id": self.entity_id, "error": error}
252+
"weback_vacuum",
253+
{"entity_id": self.entity_id, "error": error},
251254
)
252255
self.schedule_update_ha_state(False)
253256

@@ -284,7 +287,6 @@ async def async_locate(self, **kwargs) -> None:
284287
"""Locate the vacuum cleaner."""
285288
_LOGGER.debug("Vacuum: locate")
286289
await self.device.locate()
287-
return
288290

289291
async def async_set_fan_speed(self, fan_speed, **kwargs):
290292
"""Set fan speed"""

0 commit comments

Comments
 (0)