-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add auto empty message and commands (#603)
- Loading branch information
Showing
15 changed files
with
537 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Auto empty commands.""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
from deebot_client.events.auto_empty import Frequency | ||
from deebot_client.messages.json.auto_empty import OnAutoEmpty | ||
from deebot_client.util import get_enum | ||
|
||
from .common import ExecuteCommand, JsonGetCommand | ||
|
||
|
||
class GetAutoEmpty(OnAutoEmpty, JsonGetCommand): | ||
"""Get auto empty command.""" | ||
|
||
NAME = "getAutoEmpty" | ||
|
||
|
||
class SetAutoEmpty(ExecuteCommand): | ||
"""Set auto empty command.""" | ||
|
||
NAME = "setAutoEmpty" | ||
|
||
def __init__( | ||
self, enable: bool | None = None, frequency: Frequency | str | None = None | ||
) -> None: | ||
if frequency is not None and not isinstance(frequency, Frequency): | ||
frequency = get_enum(Frequency, frequency) | ||
|
||
params: dict[str, Any] = {} | ||
if enable is not None: | ||
params["enable"] = int(enable) | ||
if frequency: | ||
params["frequency"] = frequency.value | ||
super().__init__(params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Auto empty event module.""" | ||
|
||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from enum import StrEnum, unique | ||
|
||
from .base import Event as _Event | ||
|
||
__all__ = ["AutoEmptyEvent", "Frequency"] | ||
|
||
|
||
@unique | ||
class Frequency(StrEnum): | ||
"""Enum class for all possible frequencies.""" | ||
|
||
MIN_10 = "10" | ||
MIN_15 = "15" | ||
MIN_25 = "25" | ||
AUTO = "auto" | ||
SMART = "smart" | ||
|
||
|
||
@dataclass(frozen=True) | ||
class AutoEmptyEvent(_Event): | ||
"""Auto empty event representation.""" | ||
|
||
enabled: bool | ||
frequency: Frequency | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.