File: vacuuminterface.py

package info (click to toggle)
python-miio 0.5.12-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,888 kB
  • sloc: python: 23,425; makefile: 9
file content (46 lines) | stat: -rw-r--r-- 1,248 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""`VacuumInterface` is an interface (abstract class) with shared API for all vacuum
devices."""
from abc import abstractmethod
from typing import Dict

# Dictionary of predefined fan speeds
FanspeedPresets = Dict[str, int]


class VacuumInterface:
    """Vacuum API interface."""

    @abstractmethod
    def home(self):
        """Return vacuum robot to home station/dock."""

    @abstractmethod
    def start(self):
        """Start cleaning."""

    @abstractmethod
    def stop(self):
        """Stop cleaning."""

    def pause(self):
        """Pause cleaning.

        :raises RuntimeError: if the method is not supported by the device
        """
        raise RuntimeError("`pause` not supported")

    @abstractmethod
    def fan_speed_presets(self) -> FanspeedPresets:
        """Return available fan speed presets.

        The returned object is a dictionary where the key is user-readable name and the
        value is input for :func:`set_fan_speed_preset()`.
        """

    @abstractmethod
    def set_fan_speed_preset(self, speed_preset: int) -> None:
        """Set fan speed preset speed.

        :param speed_preset: a value from :func:`fan_speed_presets()`
        :raises ValueError: for invalid preset value
        """