Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion deebot_client/commands/json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .charge import Charge
from .charge_state import GetChargeState
from .child_lock import GetChildLock, SetChildLock
from .clean import Clean, CleanArea, CleanV2, GetCleanInfo, GetCleanInfoV2
from .clean import Clean, CleanArea, CleanAreaFreeClean, CleanV2, GetCleanInfo, GetCleanInfoV2
from .clean_count import GetCleanCount, SetCleanCount
from .clean_logs import GetCleanLogs
from .clean_preference import GetCleanPreference, SetCleanPreference
Expand Down Expand Up @@ -62,6 +62,7 @@
"Charge",
"Clean",
"CleanArea",
"CleanAreaFreeClean",
"CleanV2",
"ClearMap",
"GetAdvancedMode",
Expand Down Expand Up @@ -174,6 +175,7 @@
Clean,
CleanV2,
CleanArea,
CleanAreaFreeClean,
GetCleanInfo,
GetCleanInfoV2,

Expand Down
23 changes: 23 additions & 0 deletions deebot_client/commands/json/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,29 @@ def _get_args(self, action: CleanAction) -> dict[str, Any]:
return args


class CleanAreaFreeClean(CleanV2):
"""Clean area command using freeClean type.

Used by newer robots (e.g. DEEBOT X11 OmniCyclone) that use the freeClean
clean type instead of spotArea. The value format is "<cleanings>,<room_ids>".
"""

def __init__(
self, mode: CleanMode, area: list[int | float], cleanings: int = 1
) -> None:
self._additional_content = {
"type": CleanMode.FREE_CLEAN.value,
"value": f"{cleanings},{','.join(str(int(i)) for i in area)}",
}
super().__init__(CleanAction.START)

def _get_args(self, action: CleanAction) -> dict[str, Any]:
args = super()._get_args(action)
if action == CleanAction.START:
args["content"].update(self._additional_content)
return args


class GetCleanInfo(JsonCommandWithMessageHandling, MessageBodyDataDict):
"""Get clean info command."""

Expand Down
7 changes: 5 additions & 2 deletions deebot_client/commands/json/map/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ def _handle_rooms_subsets(
subsets: list[list[str]],
map_id: str,
) -> HandlingResult:
# there are two versions of this message, depending on the number of values
if subsets and len(subsets[0]) == 10:
# There are currently two known room subset formats:
# - 10 fields: standard V2 format
# - 11 fields: newer models (e.g. X11) with an extra trailing field
if subsets and len(subsets[0]) in (10, 11):
# subset values
# 1 -> id
# 2 -> name
Expand All @@ -285,6 +287,7 @@ def _handle_rooms_subsets(
# 8 -> room clean configs as '<count>-<speed>-<water>'
# 9 -> unknown
# 10 -> floor type
# 11 -> unknown extra trailing field (seen on newer models, e.g. X11)

# coordinates are sent in the MapInfo_V2 message
event_bus.notify(
Expand Down
6 changes: 6 additions & 0 deletions deebot_client/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,15 @@ class LifeSpan(StrEnumWithXml):
DUST_BAG = "dustBag", "DustBag"
CLEANING_FLUID = "autoWater_cleaningFluid", "AutoWater_cleaningFluid"
CLEANING_SOLUTION = "cleaningSolution", "CleaningSolution"
HEAVY_DUTY_CLEANING_SOLUTION = (
"heavyDutyCleaningSolution",
"HeavyDutyCleaningSolution",
)
SEWAGE_BOX = "sewageBox", "SewageBox"
STRAINER = "strainer", "Strainer"
HAND_FILTER = "handFilter", "HandFilter"
DUST_BUCKET = "dustBucket", "DustBucket"
DUST_CONTAINER_FILTER = "dustContainerFilter", "DustContainerFilter"
DUST_CASE_HEAP = "dustCaseHeap", "DustCaseHeap"
STATION_FILTER = "spHeap", "SpHeap"
WATER_SINK = "waterSink", "WaterSink"
Expand Down
289 changes: 289 additions & 0 deletions deebot_client/hardware/o073ti.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
"""Deebot DEEBOT X11 PRO OMNI Capabilities."""

from __future__ import annotations

from deebot_client.capabilities import (
Capabilities,
CapabilityClean,
CapabilityCleanAction,
CapabilityCustomCommand,
CapabilityEvent,
CapabilityExecute,
CapabilityExecuteTypes,
CapabilityLifeSpan,
CapabilityMap,
CapabilityNumber,
CapabilitySet,
CapabilitySetEnable,
CapabilitySettings,
CapabilitySetTypes,
CapabilityStation,
CapabilityStats,
CapabilityWater,
DeviceType,
)
from deebot_client.commands import StationAction
from deebot_client.commands.json import station_action
from deebot_client.commands.json.advanced_mode import GetAdvancedMode, SetAdvancedMode
from deebot_client.commands.json.auto_empty import GetAutoEmpty, SetAutoEmpty
from deebot_client.commands.json.battery import GetBattery
from deebot_client.commands.json.carpet import (
GetCarpetAutoFanBoost,
SetCarpetAutoFanBoost,
)
from deebot_client.commands.json.charge import Charge
from deebot_client.commands.json.charge_state import GetChargeState
from deebot_client.commands.json.child_lock import GetChildLock, SetChildLock
from deebot_client.commands.json.clean import CleanAreaFreeClean, CleanV2
from deebot_client.commands.json.clean_count import GetCleanCount, SetCleanCount
from deebot_client.commands.json.clean_logs import GetCleanLogs
from deebot_client.commands.json.clean_preference import (
GetCleanPreference,
SetCleanPreference,
)
from deebot_client.commands.json.continuous_cleaning import (
GetContinuousCleaning,
SetContinuousCleaning,
)
from deebot_client.commands.json.custom import CustomCommand
from deebot_client.commands.json.efficiency import GetEfficiencyMode, SetEfficiencyMode
from deebot_client.commands.json.error import GetError
from deebot_client.commands.json.fan_speed import GetFanSpeed, SetFanSpeed
from deebot_client.commands.json.life_span import GetLifeSpan, ResetLifeSpan
from deebot_client.commands.json.map import (
GetCachedMapInfo,
GetMajorMap,
GetMapInfoV2,
GetMapSetV2,
GetMapTrace,
GetMinorMap,
SetMajorMap,
)
from deebot_client.commands.json.multimap_state import (
GetMultimapState,
SetMultimapState,
)
from deebot_client.commands.json.network import GetNetInfo
from deebot_client.commands.json.ota import GetOta, SetOta
from deebot_client.commands.json.play_sound import PlaySound
from deebot_client.commands.json.pos import GetPos
from deebot_client.commands.json.relocation import SetRelocationState
from deebot_client.commands.json.stats import GetStats, GetTotalStats
from deebot_client.commands.json.sweep_mode import GetSweepMode, SetSweepMode
from deebot_client.commands.json.true_detect import GetTrueDetect, SetTrueDetect
from deebot_client.commands.json.voice_assistant_state import (
GetVoiceAssistantState,
SetVoiceAssistantState,
)
from deebot_client.commands.json.volume import GetVolume, SetVolume
from deebot_client.commands.json.water_info import GetWaterInfo, SetWaterInfo
from deebot_client.commands.json.work_mode import GetWorkMode, SetWorkMode
from deebot_client.commands.json.work_state import GetWorkState
from deebot_client.const import DataType
from deebot_client.events import (
AdvancedModeEvent,
AvailabilityEvent,
BatteryEvent,
CachedMapInfoEvent,
CarpetAutoFanBoostEvent,
ChildLockEvent,
CleanCountEvent,
CleanLogEvent,
CleanPreferenceEvent,
ContinuousCleaningEvent,
CustomCommandEvent,
EfficiencyModeEvent,
ErrorEvent,
FanSpeedEvent,
FanSpeedLevel,
LifeSpan,
LifeSpanEvent,
MajorMapEvent,
MapChangedEvent,
MapTraceEvent,
MultimapStateEvent,
NetworkInfoEvent,
OtaEvent,
PositionsEvent,
ReportStatsEvent,
RoomsEvent,
StateEvent,
StationEvent,
StatsEvent,
SweepModeEvent,
TotalStatsEvent,
TrueDetectEvent,
VoiceAssistantStateEvent,
VolumeEvent,
WorkMode,
WorkModeEvent,
auto_empty,
water_info,
)
from deebot_client.events.auto_empty import AutoEmptyEvent
from deebot_client.events.efficiency_mode import EfficiencyMode
from deebot_client.models import StaticDeviceInfo


def get_device_info() -> StaticDeviceInfo:
"""Get device info for this model."""
return StaticDeviceInfo(
DataType.JSON,
Capabilities(
device_type=DeviceType.VACUUM,
availability=CapabilityEvent(
AvailabilityEvent, [GetBattery(is_available_check=True)]
),
battery=CapabilityEvent(BatteryEvent, [GetBattery()]),
charge=CapabilityExecute(Charge),
clean=CapabilityClean(
action=CapabilityCleanAction(command=CleanV2, area=CleanAreaFreeClean),
continuous=CapabilitySetEnable(
ContinuousCleaningEvent,
[GetContinuousCleaning()],
SetContinuousCleaning,
),
count=CapabilitySet(CleanCountEvent, [GetCleanCount()], SetCleanCount),
log=CapabilityEvent(CleanLogEvent, [GetCleanLogs()]),
preference=CapabilitySetEnable(
CleanPreferenceEvent, [GetCleanPreference()], SetCleanPreference
),
work_mode=CapabilitySetTypes(
event=WorkModeEvent,
get=[GetWorkMode()],
set=SetWorkMode,
types=(
WorkMode.MOP,
WorkMode.MOP_AFTER_VACUUM,
WorkMode.VACUUM,
WorkMode.VACUUM_AND_MOP,
),
),
),
custom=CapabilityCustomCommand(
event=CustomCommandEvent, get=[], set=CustomCommand
),
error=CapabilityEvent(ErrorEvent, [GetError()]),
fan_speed=CapabilitySetTypes(
event=FanSpeedEvent,
get=[GetFanSpeed()],
set=SetFanSpeed,
types=(
FanSpeedLevel.QUIET,
FanSpeedLevel.NORMAL,
FanSpeedLevel.MAX,
FanSpeedLevel.MAX_PLUS,
),
),
life_span=CapabilityLifeSpan(
types=(
LifeSpan.BRUSH,
LifeSpan.FILTER,
LifeSpan.HAND_FILTER,
LifeSpan.SIDE_BRUSH,
LifeSpan.UNIT_CARE,
LifeSpan.CLEANING_SOLUTION,
LifeSpan.SEWAGE_BOX,
),
event=LifeSpanEvent,
get=[
GetLifeSpan(
[
LifeSpan.BRUSH,
LifeSpan.FILTER,
LifeSpan.HAND_FILTER,
LifeSpan.SIDE_BRUSH,
LifeSpan.CLEANING_SOLUTION,
LifeSpan.SEWAGE_BOX,
]
)
],
reset=ResetLifeSpan,
),
map=CapabilityMap(
cached_info=CapabilityEvent(CachedMapInfoEvent, [GetCachedMapInfo()]),
changed=CapabilityEvent(MapChangedEvent, []),
info=CapabilityExecute(GetMapInfoV2),
major=CapabilitySet(MajorMapEvent, [GetMajorMap()], SetMajorMap),
minor=CapabilityExecute(GetMinorMap),
multi_state=CapabilitySetEnable(
MultimapStateEvent, [GetMultimapState()], SetMultimapState
),
position=CapabilityEvent(PositionsEvent, [GetPos()]),
relocation=CapabilityExecute(SetRelocationState),
rooms=CapabilityEvent(RoomsEvent, [GetCachedMapInfo()]),
set=CapabilityExecute(GetMapSetV2),
trace=CapabilityEvent(MapTraceEvent, [GetMapTrace()]),
),
network=CapabilityEvent(NetworkInfoEvent, [GetNetInfo()]),
play_sound=CapabilityExecute(PlaySound),
settings=CapabilitySettings(
advanced_mode=CapabilitySetEnable(
AdvancedModeEvent, [GetAdvancedMode()], SetAdvancedMode
),
carpet_auto_fan_boost=CapabilitySetEnable(
CarpetAutoFanBoostEvent,
[GetCarpetAutoFanBoost()],
SetCarpetAutoFanBoost,
),
child_lock=CapabilitySetEnable(
ChildLockEvent, [GetChildLock()], SetChildLock
),
efficiency_mode=CapabilitySetTypes(
event=EfficiencyModeEvent,
get=[GetEfficiencyMode()],
set=SetEfficiencyMode,
types=(
EfficiencyMode.ENERGY_EFFICIENT_MODE,
EfficiencyMode.STANDARD_MODE,
),
),
ota=CapabilitySetEnable(OtaEvent, [GetOta()], SetOta),
sweep_mode=CapabilitySetEnable(
SweepModeEvent, [GetSweepMode()], SetSweepMode
),
true_detect=CapabilitySetEnable(
TrueDetectEvent, [GetTrueDetect()], SetTrueDetect
),
voice_assistant=CapabilitySetEnable(
VoiceAssistantStateEvent,
[GetVoiceAssistantState()],
SetVoiceAssistantState,
),
volume=CapabilitySet(VolumeEvent, [GetVolume()], SetVolume),
),
state=CapabilityEvent(StateEvent, [GetChargeState(), GetWorkState()]),
station=CapabilityStation(
action=CapabilityExecuteTypes(
station_action.StationAction, types=(StationAction.EMPTY_DUSTBIN,)
),
auto_empty=CapabilitySetTypes(
event=AutoEmptyEvent,
get=[GetAutoEmpty()],
set=SetAutoEmpty,
types=(
auto_empty.Frequency.AUTO,
auto_empty.Frequency.SMART,
),
),
state=CapabilityEvent(StationEvent, [GetWorkState()]),
),
stats=CapabilityStats(
clean=CapabilityEvent(StatsEvent, [GetStats()]),
report=CapabilityEvent(ReportStatsEvent, []),
total=CapabilityEvent(TotalStatsEvent, [GetTotalStats()]),
),
water=CapabilityWater(
amount=CapabilityNumber(
event=water_info.WaterCustomAmountEvent,
get=[GetWaterInfo()],
set=lambda custom_amount: SetWaterInfo(custom_amount=custom_amount),
min=0,
max=50,
),
mop_attached=CapabilityEvent(
water_info.MopAttachedEvent, [GetWaterInfo()]
),
),
),
)
Loading
Loading