Skip to content

Commit a6fc2d2

Browse files
committed
Enable trace reporting from the bot.
1 parent 0cd1df5 commit a6fc2d2

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

deebot_client/commands/xml/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from .error import GetError
1515
from .fan_speed import GetCleanSpeed, SetCleanSpeed
1616
from .life_span import GetLifeSpan
17-
from .map import GetMapM, GetMapSet, GetMapSt, PullM, PullMP
17+
from .map import GetMapM, GetMapSet, GetMapSt, GetTrM, PullM, PullMP
1818
from .play_sound import PlaySound
1919
from .pos import GetPos
2020
from .stats import GetCleanSum
@@ -39,6 +39,7 @@
3939
"GetMapSet",
4040
"GetMapSt",
4141
"GetPos",
42+
"GetTrM",
4243
"GetWaterBoxInfo",
4344
"GetWaterPermeability",
4445
"PlaySound",
@@ -65,6 +66,7 @@
6566
GetMapSet,
6667
GetMapSt,
6768
GetPos,
69+
GetTrM,
6870
GetWaterBoxInfo,
6971
GetWaterPermeability,
7072
PlaySound,

deebot_client/commands/xml/map.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,22 @@ def _handle_response(
260260
return CommandResult(result.state, result.args)
261261

262262
return result
263+
264+
265+
class GetTrM(XmlCommandWithMessageHandling):
266+
"""GetTrM command.
267+
268+
Enables trace reporting from the bot.
269+
"""
270+
271+
NAME = "GetTrM"
272+
273+
@classmethod
274+
def _handle_xml(cls, _event_bus: EventBus, xml: Element) -> HandlingResult:
275+
"""Handle xml message and notify the correct event subscribers.
276+
277+
:return: A message response
278+
"""
279+
if xml.attrib.get("ret") != "ok":
280+
return HandlingResult.analyse()
281+
return HandlingResult(HandlingState.SUCCESS)

deebot_client/hardware/deebot/2pv572.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
)
3434
from deebot_client.commands.xml.charge_state import GetChargeState
3535
from deebot_client.commands.xml.error import GetError
36-
from deebot_client.commands.xml.map import GetMapM, GetMapSt
36+
from deebot_client.commands.xml.map import GetMapM, GetMapSt, GetTrM
3737
from deebot_client.commands.xml.pos import GetPos
3838
from deebot_client.commands.xml.stats import GetCleanSum
3939
from deebot_client.commands.xml.water_info import GetWaterBoxInfo, SetWaterPermeability
@@ -109,7 +109,7 @@
109109
major=CapabilityEvent(MajorMapEvent, [GetMapM()]),
110110
position=CapabilityEvent(PositionsEvent, [GetPos()]),
111111
rooms=CapabilityEvent(RoomsEvent, [GetMapSt()]),
112-
trace=CapabilityEvent(MapTraceEvent, []),
112+
trace=CapabilityEvent(MapTraceEvent, [GetTrM()]),
113113
),
114114
network=CapabilityEvent(NetworkInfoEvent, [GetNetInfoLegacy()]),
115115
play_sound=CapabilityExecute(PlaySound),

0 commit comments

Comments
 (0)