|
| 1 | +"""DEEBOT GOAT A1600 RTK 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.auto_cut_direction import ( |
| 35 | + GetAutoCutDirection, |
| 36 | + SetAutoCutDirection, |
| 37 | +) |
| 38 | +from deebot_client.commands.json.battery import GetBattery |
| 39 | +from deebot_client.commands.json.charge import Charge |
| 40 | +from deebot_client.commands.json.charge_state import GetChargeState |
| 41 | +from deebot_client.commands.json.clean import CleanV2, GetCleanInfoV2 |
| 42 | +from deebot_client.commands.json.custom import CustomCommand |
| 43 | +from deebot_client.commands.json.error import GetError |
| 44 | +from deebot_client.commands.json.life_span import GetLifeSpan, ResetLifeSpan |
| 45 | +from deebot_client.commands.json.network import GetNetInfo |
| 46 | +from deebot_client.commands.json.play_sound import PlaySound |
| 47 | +from deebot_client.commands.json.rain_delay import GetRainDelay, SetRainDelay |
| 48 | +from deebot_client.commands.json.stats import GetStats, GetTotalStats |
| 49 | +from deebot_client.commands.json.true_detect import GetTrueDetect, SetTrueDetect |
| 50 | +from deebot_client.commands.json.volume import GetVolume, SetVolume |
| 51 | +from deebot_client.const import DataType |
| 52 | +from deebot_client.events import ( |
| 53 | + AdvancedModeEvent, |
| 54 | + AutoCutDirectionEvent, |
| 55 | + AvailabilityEvent, |
| 56 | + BatteryEvent, |
| 57 | + BorderSwitchEvent, |
| 58 | + ChildLockEvent, |
| 59 | + CrossMapBorderWarningEvent, |
| 60 | + CustomCommandEvent, |
| 61 | + CutDirectionEvent, |
| 62 | + ErrorEvent, |
| 63 | + LifeSpan, |
| 64 | + LifeSpanEvent, |
| 65 | + MoveUpWarningEvent, |
| 66 | + NetworkInfoEvent, |
| 67 | + RainDelayEvent, |
| 68 | + ReportStatsEvent, |
| 69 | + SafeProtectEvent, |
| 70 | + StateEvent, |
| 71 | + StatsEvent, |
| 72 | + TotalStatsEvent, |
| 73 | + TrueDetectEvent, |
| 74 | + VolumeEvent, |
| 75 | +) |
| 76 | +from deebot_client.models import StaticDeviceInfo |
| 77 | +from deebot_client.util import short_name |
| 78 | + |
| 79 | +from . import DEVICES |
| 80 | + |
| 81 | +DEVICES[short_name(__name__)] = StaticDeviceInfo( |
| 82 | + DataType.JSON, |
| 83 | + Capabilities( |
| 84 | + device_type=DeviceType.MOWER, |
| 85 | + availability=CapabilityEvent( |
| 86 | + AvailabilityEvent, [GetBattery(is_available_check=True)] |
| 87 | + ), |
| 88 | + battery=CapabilityEvent(BatteryEvent, [GetBattery()]), |
| 89 | + charge=CapabilityExecute(Charge), |
| 90 | + clean=CapabilityClean( |
| 91 | + action=CapabilityCleanAction(command=CleanV2), |
| 92 | + ), |
| 93 | + custom=CapabilityCustomCommand( |
| 94 | + event=CustomCommandEvent, get=[], set=CustomCommand |
| 95 | + ), |
| 96 | + error=CapabilityEvent(ErrorEvent, [GetError()]), |
| 97 | + life_span=CapabilityLifeSpan( |
| 98 | + types=(LifeSpan.BLADE), |
| 99 | + event=LifeSpanEvent, |
| 100 | + get=[GetLifeSpan([LifeSpan.BLADE])], |
| 101 | + reset=ResetLifeSpan, |
| 102 | + ), |
| 103 | + network=CapabilityEvent(NetworkInfoEvent, [GetNetInfo()]), |
| 104 | + play_sound=CapabilityExecute(PlaySound), |
| 105 | + settings=CapabilitySettings( |
| 106 | + advanced_mode=CapabilitySetEnable( |
| 107 | + AdvancedModeEvent, [GetAdvancedMode()], SetAdvancedMode |
| 108 | + ), |
| 109 | + auto_cut_direction=CapabilitySetEnable( |
| 110 | + AutoCutDirectionEvent, [GetAutoCutDirection()], SetAutoCutDirection |
| 111 | + ), |
| 112 | + border_switch=CapabilitySetEnable( |
| 113 | + BorderSwitchEvent, [GetBorderSwitch()], SetBorderSwitch |
| 114 | + ), |
| 115 | + cut_direction=CapabilitySet( |
| 116 | + CutDirectionEvent, [GetCutDirection()], SetCutDirection |
| 117 | + ), |
| 118 | + child_lock=CapabilitySetEnable( |
| 119 | + ChildLockEvent, [GetChildLock()], SetChildLock |
| 120 | + ), |
| 121 | + moveup_warning=CapabilitySetEnable( |
| 122 | + MoveUpWarningEvent, [GetMoveUpWarning()], SetMoveUpWarning |
| 123 | + ), |
| 124 | + cross_map_border_warning=CapabilitySetEnable( |
| 125 | + CrossMapBorderWarningEvent, |
| 126 | + [GetCrossMapBorderWarning()], |
| 127 | + SetCrossMapBorderWarning, |
| 128 | + ), |
| 129 | + rain_delay=CapabilitySet(RainDelayEvent, [GetRainDelay()], SetRainDelay), |
| 130 | + safe_protect=CapabilitySetEnable( |
| 131 | + SafeProtectEvent, [GetSafeProtect()], SetSafeProtect |
| 132 | + ), |
| 133 | + true_detect=CapabilitySetEnable( |
| 134 | + TrueDetectEvent, [GetTrueDetect()], SetTrueDetect |
| 135 | + ), |
| 136 | + volume=CapabilitySet(VolumeEvent, [GetVolume()], SetVolume), |
| 137 | + ), |
| 138 | + state=CapabilityEvent(StateEvent, [GetChargeState(), GetCleanInfoV2()]), |
| 139 | + stats=CapabilityStats( |
| 140 | + clean=CapabilityEvent(StatsEvent, [GetStats()]), |
| 141 | + report=CapabilityEvent(ReportStatsEvent, []), |
| 142 | + total=CapabilityEvent(TotalStatsEvent, [GetTotalStats()]), |
| 143 | + ), |
| 144 | + ), |
| 145 | +) |
0 commit comments