Module sharklocal.models

Data models for vacuum state and device information.

Classes

class DeviceInfo (firmware: Optional[str] = None,
mac_address: Optional[str] = None,
ip_address: Optional[str] = None,
ssid: Optional[str] = None,
rssi: Optional[int] = None,
raw: Dict[str, Any] = <factory>)
Expand source code
@dataclass
class DeviceInfo:
    """Device identity and connectivity information."""

    firmware: Optional[str] = None
    mac_address: Optional[str] = None
    ip_address: Optional[str] = None
    ssid: Optional[str] = None
    rssi: Optional[int] = None
    raw: Dict[str, Any] = field(default_factory=dict)

Device identity and connectivity information.

Instance variables

var firmware : str | None

The type of the None singleton.

var ip_address : str | None

The type of the None singleton.

var mac_address : str | None

The type of the None singleton.

var raw : Dict[str, Any]

The type of the None singleton.

var rssi : int | None

The type of the None singleton.

var ssid : str | None

The type of the None singleton.

class ProbeResult (rest_mapping: Optional[str] = None, mqtt_mapping: Optional[str] = None)
Expand source code
@dataclass
class ProbeResult:
    """Result of a :meth:`VacuumClient.probe` call."""

    rest_mapping: Optional[str] = None
    """``id`` of the REST mapping that responded successfully, or ``None``."""

    mqtt_mapping: Optional[str] = None
    """``id`` of the MQTT mapping that responded successfully, or ``None``."""

    @property
    def has_rest(self) -> bool:
        """``True`` if a working REST mapping was found."""
        return self.rest_mapping is not None

    @property
    def has_mqtt(self) -> bool:
        """``True`` if a working MQTT mapping was found."""
        return self.mqtt_mapping is not None

    @property
    def is_connected(self) -> bool:
        """``True`` if at least one transport responded successfully."""
        return self.has_rest or self.has_mqtt

Result of a :meth:VacuumClient.probe call.

Instance variables

prop has_mqtt : bool
Expand source code
@property
def has_mqtt(self) -> bool:
    """``True`` if a working MQTT mapping was found."""
    return self.mqtt_mapping is not None

True if a working MQTT mapping was found.

prop has_rest : bool
Expand source code
@property
def has_rest(self) -> bool:
    """``True`` if a working REST mapping was found."""
    return self.rest_mapping is not None

True if a working REST mapping was found.

prop is_connected : bool
Expand source code
@property
def is_connected(self) -> bool:
    """``True`` if at least one transport responded successfully."""
    return self.has_rest or self.has_mqtt

True if at least one transport responded successfully.

var mqtt_mapping : str | None

id of the MQTT mapping that responded successfully, or None.

var rest_mapping : str | None

id of the REST mapping that responded successfully, or None.

class VacuumEvent (id: int,
type: str,
type_id: int,
timestamp: Dict[str, int],
current_status: str,
source_type: str,
raw: Dict[str, Any] = <factory>)
Expand source code
@dataclass
class VacuumEvent:
    """A single event from the vacuum event log."""

    id: int
    type: str
    type_id: int
    timestamp: Dict[str, int]
    current_status: str
    source_type: str
    raw: Dict[str, Any] = field(default_factory=dict)

A single event from the vacuum event log.

Instance variables

var current_status : str

The type of the None singleton.

var id : int

The type of the None singleton.

var raw : Dict[str, Any]

The type of the None singleton.

var source_type : str

The type of the None singleton.

var timestamp : Dict[str, int]

The type of the None singleton.

var type : str

The type of the None singleton.

var type_id : int

The type of the None singleton.

class VacuumMode (*values)
Expand source code
class VacuumMode(str, Enum):
    """Normalized operating modes across all transports."""

    UNKNOWN = "unknown"
    CLEANING = "cleaning"
    RETURNING_TO_DOCK = "returning_to_dock"
    DOCKING = "docking"
    DOCKED = "docked"
    IDLE = "idle"  # Powered on but not cleaning and not on the charging dock
    EXPLORING = "exploring"  # Mapping/exploration run in progress

Normalized operating modes across all transports.

Ancestors

  • builtins.str
  • enum.Enum

Class variables

var CLEANING

The type of the None singleton.

var DOCKED

The type of the None singleton.

var DOCKING

The type of the None singleton.

var EXPLORING

The type of the None singleton.

var IDLE

The type of the None singleton.

var RETURNING_TO_DOCK

The type of the None singleton.

var UNKNOWN

The type of the None singleton.

class VacuumStatus (mode: VacuumMode,
battery_level: Optional[int] = None,
charging: Optional[bool] = None,
raw: Dict[str, Any] = <factory>)
Expand source code
@dataclass
class VacuumStatus:
    """Normalized vacuum status, independent of transport protocol."""

    mode: VacuumMode
    battery_level: Optional[int] = None
    charging: Optional[bool] = None
    raw: Dict[str, Any] = field(default_factory=dict)

    @property
    def is_cleaning(self) -> bool:
        return self.mode == VacuumMode.CLEANING

    @property
    def is_docked(self) -> bool:
        return self.mode in (VacuumMode.DOCKED, VacuumMode.DOCKING)

Normalized vacuum status, independent of transport protocol.

Instance variables

var battery_level : int | None

The type of the None singleton.

var charging : bool | None

The type of the None singleton.

prop is_cleaning : bool
Expand source code
@property
def is_cleaning(self) -> bool:
    return self.mode == VacuumMode.CLEANING
prop is_docked : bool
Expand source code
@property
def is_docked(self) -> bool:
    return self.mode in (VacuumMode.DOCKED, VacuumMode.DOCKING)
var modeVacuumMode

The type of the None singleton.

var raw : Dict[str, Any]

The type of the None singleton.