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

WIP: Add capabilities definition for ls1ok3 #573

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
80 changes: 80 additions & 0 deletions deebot_client/hardware/deebot/ls1ok3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"""ls1ok3 Capabilities."""

from __future__ import annotations

from deebot_client.capabilities import (
Capabilities,
CapabilityClean,
CapabilityCleanAction,
CapabilityCustomCommand,
CapabilityEvent,
CapabilityExecute,
CapabilityLifeSpan,
CapabilitySet,
CapabilitySettings,
CapabilityStats,
DeviceType,
)

from deebot_client.commands.xml.charge_state import GetChargeState
from deebot_client.commands.xml.error import GetError

from deebot_client.commands.xml.stats import GetCleanSum

from deebot_client.const import DataType
from deebot_client.events import (
AvailabilityEvent,
CustomCommandEvent,
ErrorEvent,
LifeSpanEvent,
NetworkInfoEvent,
ReportStatsEvent,
StateEvent,
StatsEvent,
TotalStatsEvent,
VolumeEvent,
BatteryEvent,
)
from deebot_client.models import StaticDeviceInfo, CleanAction
from deebot_client.util import short_name

from . import DEVICES
from ...commands.json import SetVolume
from ...commands.json.custom import CustomCommand
from ...commands.xml.common import XmlCommand

DEVICES[short_name(__name__)] = StaticDeviceInfo(
DataType.XML,
Capabilities(
availability=CapabilityEvent(AvailabilityEvent, []),
battery=CapabilityEvent(BatteryEvent, []),
charge=CapabilityExecute(XmlCommand),
clean=CapabilityClean(
action=CapabilityCleanAction(command=CleanAction),
),
custom=CapabilityCustomCommand(event=CustomCommandEvent, get=[], set=CustomCommand),
device_type=DeviceType.VACUUM,
error=CapabilityEvent(ErrorEvent, [GetError()]),
life_span=CapabilityLifeSpan(
types=(),
event=LifeSpanEvent,
get=[],
reset=CustomCommand,
),
network=CapabilityEvent(NetworkInfoEvent, []),
play_sound=CapabilityExecute(XmlCommand),
settings=CapabilitySettings(
volume=CapabilitySet(
event=VolumeEvent,
get=[],
set=SetVolume,
),
),
state=CapabilityEvent(StateEvent, [GetChargeState()]),
stats=CapabilityStats(
clean=CapabilityEvent(StatsEvent, [GetCleanSum()]),
report=CapabilityEvent(ReportStatsEvent, []),
total=CapabilityEvent(TotalStatsEvent, [GetCleanSum()]),
),
),
)
Loading