1- 5 xu9h3 .py
1+ """DEEBOT GOAT O1200 LiDAR (2i0fns) Capabilities."""
2+
3+ from __future__ import annotations
4+
5+ from deebot_client .capabilities import (
6+ Capabilities ,
7+ CapabilityClean ,
8+ CapabilityCleanAction ,
9+ CapabilityCustomCommand ,
10+ CapabilityEvent ,
11+ CapabilityExecute ,
12+ CapabilityLifeSpan ,
13+ CapabilitySet ,
14+ CapabilitySetEnable ,
15+ CapabilitySettings ,
16+ CapabilityStats ,
17+ DeviceType ,
18+ )
19+ from deebot_client .commands .json import (
20+ GetBorderSwitch ,
21+ GetChildLock ,
22+ GetCrossMapBorderWarning ,
23+ GetCutDirection ,
24+ GetMoveUpWarning ,
25+ GetSafeProtect ,
26+ SetBorderSwitch ,
27+ SetChildLock ,
28+ SetCrossMapBorderWarning ,
29+ SetCutDirection ,
30+ SetMoveUpWarning ,
31+ SetSafeProtect ,
32+ )
33+ from deebot_client .commands .json .advanced_mode import GetAdvancedMode , SetAdvancedMode
34+ from deebot_client .commands .json .battery import GetBattery
35+ from deebot_client .commands .json .charge import Charge
36+ from deebot_client .commands .json .charge_state import GetChargeState
37+ from deebot_client .commands .json .clean import CleanV2 , GetCleanInfoV2
38+ from deebot_client .commands .json .custom import CustomCommand
39+ from deebot_client .commands .json .error import GetError
40+ from deebot_client .commands .json .life_span import GetLifeSpan , ResetLifeSpan
41+ from deebot_client .commands .json .network import GetNetInfo
42+ from deebot_client .commands .json .play_sound import PlaySound
43+ from deebot_client .commands .json .stats import GetStats , GetTotalStats
44+ from deebot_client .commands .json .true_detect import GetTrueDetect , SetTrueDetect
45+ from deebot_client .commands .json .volume import GetVolume , SetVolume
46+ from deebot_client .const import DataType
47+ from deebot_client .events import (
48+ AdvancedModeEvent ,
49+ AvailabilityEvent ,
50+ BatteryEvent ,
51+ BorderSwitchEvent ,
52+ ChildLockEvent ,
53+ CrossMapBorderWarningEvent ,
54+ CustomCommandEvent ,
55+ CutDirectionEvent ,
56+ ErrorEvent ,
57+ LifeSpan ,
58+ LifeSpanEvent ,
59+ MoveUpWarningEvent ,
60+ NetworkInfoEvent ,
61+ ReportStatsEvent ,
62+ SafeProtectEvent ,
63+ StateEvent ,
64+ StatsEvent ,
65+ TotalStatsEvent ,
66+ TrueDetectEvent ,
67+ VolumeEvent ,
68+ )
69+ from deebot_client .models import StaticDeviceInfo
70+
71+
72+ def get_device_info () -> StaticDeviceInfo :
73+ """Get device info for this model."""
74+ return StaticDeviceInfo (
75+ DataType .JSON ,
76+ Capabilities (
77+ device_type = DeviceType .MOWER ,
78+ availability = CapabilityEvent (
79+ AvailabilityEvent , [GetBattery (is_available_check = True )]
80+ ),
81+ battery = CapabilityEvent (BatteryEvent , [GetBattery ()]),
82+ charge = CapabilityExecute (Charge ),
83+ clean = CapabilityClean (
84+ action = CapabilityCleanAction (command = CleanV2 ),
85+ ),
86+ custom = CapabilityCustomCommand (
87+ event = CustomCommandEvent , get = [], set = CustomCommand
88+ ),
89+ error = CapabilityEvent (ErrorEvent , [GetError ()]),
90+ life_span = CapabilityLifeSpan (
91+ types = (
92+ LifeSpan .BLADE ,
93+ LifeSpan .LENS_BRUSH ,
94+ LifeSpan .WEED_ROPE ,
95+ LifeSpan .TRIMMER_BRUSH ,
96+ ),
97+ event = LifeSpanEvent ,
98+ get = [
99+ GetLifeSpan (
100+ [
101+ LifeSpan .BLADE ,
102+ LifeSpan .LENS_BRUSH ,
103+ LifeSpan .WEED_ROPE ,
104+ LifeSpan .TRIMMER_BRUSH ,
105+ ]
106+ )
107+ ],
108+ reset = ResetLifeSpan ,
109+ ),
110+ network = CapabilityEvent (NetworkInfoEvent , [GetNetInfo ()]),
111+ play_sound = CapabilityExecute (PlaySound ),
112+ settings = CapabilitySettings (
113+ advanced_mode = CapabilitySetEnable (
114+ AdvancedModeEvent , [GetAdvancedMode ()], SetAdvancedMode
115+ ),
116+ border_switch = CapabilitySetEnable (
117+ BorderSwitchEvent , [GetBorderSwitch ()], SetBorderSwitch
118+ ),
119+ cut_direction = CapabilitySet (
120+ CutDirectionEvent , [GetCutDirection ()], SetCutDirection
121+ ),
122+ child_lock = CapabilitySetEnable (
123+ ChildLockEvent , [GetChildLock ()], SetChildLock
124+ ),
125+ moveup_warning = CapabilitySetEnable (
126+ MoveUpWarningEvent , [GetMoveUpWarning ()], SetMoveUpWarning
127+ ),
128+ cross_map_border_warning = CapabilitySetEnable (
129+ CrossMapBorderWarningEvent ,
130+ [GetCrossMapBorderWarning ()],
131+ SetCrossMapBorderWarning ,
132+ ),
133+ safe_protect = CapabilitySetEnable (
134+ SafeProtectEvent , [GetSafeProtect ()], SetSafeProtect
135+ ),
136+ true_detect = CapabilitySetEnable (
137+ TrueDetectEvent , [GetTrueDetect ()], SetTrueDetect
138+ ),
139+ volume = CapabilitySet (VolumeEvent , [GetVolume ()], SetVolume ),
140+ ),
141+ state = CapabilityEvent (StateEvent , [GetChargeState (), GetCleanInfoV2 ()]),
142+ stats = CapabilityStats (
143+ clean = CapabilityEvent (StatsEvent , [GetStats ()]),
144+ report = CapabilityEvent (ReportStatsEvent , []),
145+ total = CapabilityEvent (TotalStatsEvent , [GetTotalStats ()]),
146+ ),
147+ ),
148+ )
0 commit comments