1 """Class for Roomba devices."""
7 from .entity
import SUPPORT_IROBOT, IRobotVacuum
9 _LOGGER = logging.getLogger(__name__)
11 ATTR_BIN_FULL =
"bin_full"
12 ATTR_BIN_PRESENT =
"bin_present"
14 FAN_SPEED_AUTOMATIC =
"Automatic"
16 FAN_SPEED_PERFORMANCE =
"Performance"
17 FAN_SPEEDS = [FAN_SPEED_AUTOMATIC, FAN_SPEED_ECO, FAN_SPEED_PERFORMANCE]
20 SUPPORT_ROOMBA_CARPET_BOOST = SUPPORT_IROBOT | VacuumEntityFeature.FAN_SPEED
24 """Basic Roomba robot (without carpet boost)."""
28 """Return the state attributes of the device."""
29 state_attrs = super().extra_state_attributes
34 if bin_raw_state.get(
"present")
is not None:
35 bin_state[ATTR_BIN_PRESENT] = bin_raw_state.get(
"present")
36 if bin_raw_state.get(
"full")
is not None:
37 bin_state[ATTR_BIN_FULL] = bin_raw_state.get(
"full")
38 state_attrs.update(bin_state)
44 """Roomba robot with carpet boost."""
46 _attr_fan_speed_list = FAN_SPEEDS
47 _attr_supported_features = SUPPORT_ROOMBA_CARPET_BOOST
51 """Return the fan speed of the vacuum cleaner."""
55 if carpet_boost
is not None and high_perf
is not None:
57 fan_speed = FAN_SPEED_AUTOMATIC
59 fan_speed = FAN_SPEED_PERFORMANCE
61 fan_speed = FAN_SPEED_ECO
66 if fan_speed.capitalize()
in FAN_SPEEDS:
67 fan_speed = fan_speed.capitalize()
68 _LOGGER.debug(
"Set fan speed to: %s", fan_speed)
71 if fan_speed == FAN_SPEED_AUTOMATIC:
74 elif fan_speed == FAN_SPEED_ECO:
77 elif fan_speed == FAN_SPEED_PERFORMANCE:
81 _LOGGER.error(
"No such fan speed available: %s", fan_speed)
84 await self.
hasshass.async_add_executor_job(
85 self.
vacuumvacuum.set_preference,
"carpetBoost",
str(carpet_boost)
87 await self.
hasshass.async_add_executor_job(
88 self.
vacuumvacuum.set_preference,
"vacHigh",
str(high_perf)
def async_set_fan_speed(self, fan_speed, **kwargs)
def extra_state_attributes(self)
web.Response get(self, web.Request request, str config_key)