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

Add more detail to the vacuum implementation #64

Merged
merged 1 commit into from
May 25, 2024
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
37 changes: 36 additions & 1 deletion custom_components/synthetic_home/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,26 @@ def __init__(
key: str,
*,
supported_features: VacuumEntityFeature | None = None,
state: str | None = None
state: str | None = None,
fan_speed: str | None = None,
fan_speed_list: list[str] | None = None,
battery_icon: str | None = None,
battery_level: int | None = None,
) -> None:
"""Initialize the SyntheticVacuum."""
super().__init__(device, key)
if supported_features is not None:
self._attr_supported_features = VacuumEntityFeature(0) | supported_features
if state:
self._attr_state = state
if fan_speed is not None:
self._attr_fan_speed = fan_speed
if fan_speed_list is not None:
self._attr_fan_speed_list = fan_speed_list
if battery_icon is not None:
self._attr_battery_icon = battery_icon
if battery_level is not None:
self._attr_battery_level = battery_level

async def async_stop(self, **kwargs: Any) -> None:
"""Stop the vacuum cleaner.
Expand All @@ -68,6 +80,11 @@ async def async_return_to_base(self, **kwargs: Any) -> None:
self._attr_state = STATE_RETURNING
self.async_write_ha_state()

async def async_clean_spot(self, **kwargs: Any) -> None:
"""Perform a spot clean-up."""
self._attr_state = STATE_CLEANING
self.async_write_ha_state()

async def async_start(self) -> None:
"""Start or resume the cleaning task.

Expand All @@ -83,3 +100,21 @@ async def async_pause(self) -> None:
"""
self._attr_state = STATE_PAUSED
self.async_write_ha_state()

async def async_set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
"""Set fan speed."""
self._attr_fan_speed = fan_speed
self.async_write_ha_state()

async def async_send_command(
self,
command: str,
params: dict[str, Any] | list[Any] | None = None,
**kwargs: Any,
) -> None:
"""Send a command to a vacuum cleaner."""
pass

async def async_locate(self, **kwargs: Any) -> None:
"""Locate the vacuum cleaner."""
pass