Skip to content

Commit ad83041

Browse files
committed
fix: add missing finish reasons
1 parent a69286f commit ad83041

File tree

3 files changed

+49
-47
lines changed

3 files changed

+49
-47
lines changed

roborock/data/v1/v1_code_mappings.py

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,49 @@
1-
from ..code_mappings import RoborockEnum
2-
3-
4-
class RoborockFinishReason(RoborockEnum):
5-
manual_interrupt = 21 # Cleaning interrupted by user
6-
cleanup_interrupted = 24 # Cleanup interrupted
7-
manual_interrupt_2 = 21
8-
manual_interrupt_12 = 29
9-
breakpoint = 32 # Could not continue cleaning
10-
breakpoint_2 = 33
11-
cleanup_interrupted_2 = 34
12-
manual_interrupt_3 = 35
13-
manual_interrupt_4 = 36
14-
manual_interrupt_5 = 37
15-
manual_interrupt_6 = 43
16-
locate_fail = 45 # Positioning Failed
17-
cleanup_interrupted_3 = 64
18-
locate_fail_2 = 65
19-
manual_interrupt_7 = 48
20-
manual_interrupt_8 = 49
21-
manual_interrupt_9 = 50
22-
cleanup_interrupted_4 = 51
23-
finished_cleaning = 52 # Finished cleaning
24-
finished_cleaning_2 = 54
25-
finished_cleaning_3 = 55
26-
finished_cleaning_4 = 56
27-
finished_clenaing_5 = 57
28-
manual_interrupt_10 = 60
29-
area_unreachable = 61 # Area unreachable
30-
area_unreachable_2 = 62
31-
washing_error = 67 # Washing error
32-
back_to_wash_failure = 68 # Failed to return to the dock
33-
cleanup_interrupted_5 = 101
34-
breakpoint_4 = 102
35-
manual_interrupt_11 = 103
36-
cleanup_interrupted_6 = 104
37-
cleanup_interrupted_7 = 105
38-
cleanup_interrupted_8 = 106
39-
cleanup_interrupted_9 = 107
40-
cleanup_interrupted_10 = 109
41-
cleanup_interrupted_11 = 110
42-
patrol_success = 114 # Cruise completed
43-
patrol_fail = 115 # Cruise failed
44-
pet_patrol_success = 116 # Pet found
45-
pet_patrol_fail = 117 # Pet found failed
1+
from ..code_mappings import RoborockEnum, RoborockModeEnum
2+
3+
4+
class RoborockFinishReason(RoborockModeEnum):
5+
MANUAL_INTERRUPT = ("manual_interrupt", 21) # Cleaning interrupted by user
6+
CLEANUP_INTERRUPTED = ("cleanup_interrupted", 24) # Cleanup interrupted
7+
MANUAL_INTERRUPT_12 = ("manual_interrupt", 29)
8+
BREAKPOINT = ("breakpoint", 32) # Could not continue cleaning
9+
BREAKPOINT_2 = ("breakpoint", 33)
10+
CLEANUP_INTERRUPTED_2 = ("cleanup_interrupted", 34)
11+
MANUAL_INTERRUPT_3 = ("manual_interrupt", 35)
12+
MANUAL_INTERRUPT_4 = ("manual_interrupt", 36)
13+
MANUAL_INTERRUPT_5 = ("manual_interrupt", 37)
14+
MANUAL_INTERRUPT_6 = ("manual_interrupt", 43)
15+
LOCATE_FAIL = ("locate_fail", 45) # Positioning Failed
16+
CLEANUP_INTERRUPTED_3 = ("cleanup_interrupted", 64)
17+
LOCATE_FAIL_2 = ("locate_fail", 65)
18+
MANUAL_INTERRUPT_7 = ("manual_interrupt", 48)
19+
MANUAL_INTERRUPT_8 = ("manual_interrupt", 49)
20+
MANUAL_INTERRUPT_9 = ("manual_interrupt", 50)
21+
CLEANUP_INTERRUPTED_4 = ("cleanup_interrupted", 51)
22+
FINISHED_CLEANING = ("finished_cleaning", 52) # Finished cleaning
23+
FINISHED_CLEANING_2 = ("finished_cleaning", 54)
24+
FINISHED_CLEANING_3 = ("finished_cleaning", 55)
25+
FINISHED_CLEANING_4 = ("finished_cleaning", 56)
26+
FINISHED_CLEANING_5 = ("finished_cleaning", 57)
27+
MANUAL_INTERRUPT_10 = ("manual_interrupt", 60)
28+
AREA_UNREACHABLE = ("area_unreachable", 61) # Area unreachable
29+
AREA_UNREACHABLE_2 = ("area_unreachable", 62)
30+
WASHING_ERROR = ("washing_error", 67) # Washing error
31+
BACK_TO_WASH_FAILURE = ("back_to_wash_failure", 68) # Failed to return to the dock
32+
CHECK_SAVED_PET_FURNITURES = ("check_saved_pet_furnitures", 78)
33+
GET_SAVED_PET_FURNITURES = ("get_saved_pet_furnitures", 79)
34+
CLEANUP_INTERRUPTED_5 = ("cleanup_interrupted", 101)
35+
BREAKPOINT_4 = ("breakpoint", 102)
36+
MANUAL_INTERRUPT_11 = ("manual_interrupt", 103)
37+
CLEANUP_INTERRUPTED_6 = ("cleanup_interrupted", 104)
38+
CLEANUP_INTERRUPTED_7 = ("cleanup_interrupted", 105)
39+
CLEANUP_INTERRUPTED_8 = ("cleanup_interrupted", 106)
40+
CLEANUP_INTERRUPTED_9 = ("cleanup_interrupted", 107)
41+
CLEANUP_INTERRUPTED_10 = ("cleanup_interrupted", 109)
42+
CLEANUP_INTERRUPTED_11 = ("cleanup_interrupted", 110)
43+
PATROL_SUCCESS = ("patrol_success", 114) # Cruise completed
44+
PATROL_FAIL = ("patrol_fail", 115) # Cruise failed
45+
PET_PATROL_SUCCESS = ("pet_patrol_success", 116) # Pet found
46+
PET_PATROL_FAIL = ("pet_patrol_fail", 117) # Pet found failed
4647

4748

4849
class RoborockInCleaning(RoborockEnum):

tests/data/v1/test_v1_containers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def test_clean_record():
133133
assert cr.complete == 1
134134
assert cr.start_type == 2
135135
assert cr.clean_type == 3
136-
assert cr.finish_reason == 56
136+
assert cr.finish_reason.code == 56
137137
assert cr.dust_collection_status == 1
138138
assert cr.avoid_count == 19
139139
assert cr.wash_count == 2

tests/devices/traits/v1/test_clean_summary.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ async def test_get_clean_record_dict_response(
183183
assert clean_record.complete == 1
184184
assert clean_record.start_type == 2
185185
assert clean_record.clean_type == 3
186-
assert clean_record.finish_reason == 56
186+
assert clean_record.finish_reason is not None
187+
assert clean_record.finish_reason.code == 56
187188
assert clean_record.dust_collection_status == 1
188189
assert clean_record.avoid_count == 19
189190
assert clean_record.wash_count == 2

0 commit comments

Comments
 (0)