3737 ROBOROCK_G20S_Ultra ,
3838)
3939from roborock .exceptions import RoborockException
40+ from roborock .roborock_message import RoborockDataProtocol
4041
4142from ..containers import NamedRoomMapping , RoborockBase , RoborockBaseTimer , _attr_repr
4243from .v1_clean_modes import WashTowelModes
@@ -102,9 +103,8 @@ class StatusField(FieldNameBase):
102103 This is used with `roborock.devices.traits.v1.status.DeviceFeaturesTrait`
103104 to understand if a feature is supported by the device using `is_field_supported`.
104105
105- The enum values are names of fields in the `Status` class. Each field is
106- annotated with `requires_schema_code` metadata to map the field to a schema
107- code in the product schema, which may have a different name than the field/attribute name.
106+ The enum values are names of fields in the `Status` class. Each field is annotated
107+ with a metadata value to determine if the field is supported by the device.
108108 """
109109
110110 STATE = "state"
@@ -116,21 +116,17 @@ class StatusField(FieldNameBase):
116116 ERROR_CODE = "error_code"
117117
118118
119- def _requires_schema_code (requires_schema_code : str , default = None ) -> Any :
120- return field (metadata = {"requires_schema_code" : requires_schema_code }, default = default )
121-
122-
123119@dataclass
124120class Status (RoborockBase ):
125121 """This status will be deprecated in favor of StatusV2."""
126122
127123 msg_ver : int | None = None
128124 msg_seq : int | None = None
129- state : RoborockStateCode | None = _requires_schema_code ( "state" )
130- battery : int | None = _requires_schema_code ( "battery" )
125+ state : RoborockStateCode | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . STATE } )
126+ battery : int | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . BATTERY } )
131127 clean_time : int | None = None
132128 clean_area : int | None = None
133- error_code : RoborockErrorCode | None = _requires_schema_code ( "error_code" )
129+ error_code : RoborockErrorCode | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . ERROR_CODE } )
134130 map_present : int | None = None
135131 in_cleaning : RoborockInCleaning | None = None
136132 in_returning : int | None = None
@@ -140,12 +136,14 @@ class Status(RoborockBase):
140136 back_type : int | None = None
141137 wash_phase : int | None = None
142138 wash_ready : int | None = None
143- fan_power : RoborockFanPowerCode | None = _requires_schema_code ( "fan_power" )
139+ fan_power : RoborockFanPowerCode | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . FAN_POWER } )
144140 dnd_enabled : int | None = None
145141 map_status : int | None = None
146142 is_locating : int | None = None
147143 lock_status : int | None = None
148- water_box_mode : RoborockMopIntensityCode | None = _requires_schema_code ("water_box_mode" )
144+ water_box_mode : RoborockMopIntensityCode | None = field (
145+ default = None , metadata = {"dps" : RoborockDataProtocol .WATER_BOX_MODE }
146+ )
149147 water_box_carriage_status : int | None = None
150148 mop_forbidden_enable : int | None = None
151149 camera_status : int | None = None
@@ -163,13 +161,13 @@ class Status(RoborockBase):
163161 collision_avoid_status : int | None = None
164162 switch_map_mode : int | None = None
165163 dock_error_status : RoborockDockErrorCode | None = None
166- charge_status : int | None = _requires_schema_code ( "charge_status" )
164+ charge_status : int | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . CHARGE_STATUS } )
167165 unsave_map_reason : int | None = None
168166 unsave_map_flag : int | None = None
169167 wash_status : int | None = None
170168 distance_off : int | None = None
171169 in_warmup : int | None = None
172- dry_status : int | None = _requires_schema_code ( "drying_status" )
170+ dry_status : int | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . DRYING_STATUS } )
173171 rdt : int | None = None
174172 clean_percent : int | None = None
175173 rss : int | None = None
@@ -294,11 +292,11 @@ class StatusV2(RoborockBase):
294292
295293 msg_ver : int | None = None
296294 msg_seq : int | None = None
297- state : RoborockStateCode | None = _requires_schema_code ( "state" )
298- battery : int | None = _requires_schema_code ( "battery" )
295+ state : RoborockStateCode | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . STATE } )
296+ battery : int | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . BATTERY } )
299297 clean_time : int | None = None
300298 clean_area : int | None = None
301- error_code : RoborockErrorCode | None = _requires_schema_code ( "error_code" )
299+ error_code : RoborockErrorCode | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . ERROR_CODE } )
302300 map_present : int | None = None
303301 in_cleaning : RoborockInCleaning | None = None
304302 in_returning : int | None = None
@@ -308,12 +306,12 @@ class StatusV2(RoborockBase):
308306 back_type : int | None = None
309307 wash_phase : int | None = None
310308 wash_ready : int | None = None
311- fan_power : int | None = _requires_schema_code ( "fan_power" )
309+ fan_power : int | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . FAN_POWER } )
312310 dnd_enabled : int | None = None
313311 map_status : int | None = None
314312 is_locating : int | None = None
315313 lock_status : int | None = None
316- water_box_mode : int | None = _requires_schema_code ( "water_box_mode" )
314+ water_box_mode : int | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . WATER_BOX_MODE } )
317315 water_box_carriage_status : int | None = None
318316 mop_forbidden_enable : int | None = None
319317 camera_status : int | None = None
@@ -330,14 +328,14 @@ class StatusV2(RoborockBase):
330328 debug_mode : int | None = None
331329 collision_avoid_status : int | None = None
332330 switch_map_mode : int | None = None
333- dock_error_status : RoborockDockErrorCode | None = _requires_schema_code ( "dock_error_status" )
334- charge_status : int | None = _requires_schema_code ( "charge_status" )
331+ dock_error_status : RoborockDockErrorCode | None = None
332+ charge_status : int | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . CHARGE_STATUS } )
335333 unsave_map_reason : int | None = None
336334 unsave_map_flag : int | None = None
337335 wash_status : int | None = None
338336 distance_off : int | None = None
339337 in_warmup : int | None = None
340- dry_status : int | None = _requires_schema_code ( "drying_status" )
338+ dry_status : int | None = field ( default = None , metadata = { "dps" : RoborockDataProtocol . DRYING_STATUS } )
341339 rdt : int | None = None
342340 clean_percent : int | None = None
343341 rss : int | None = None
@@ -631,9 +629,8 @@ class ConsumableField(FieldNameBase):
631629 This is used with `roborock.devices.traits.v1.status.DeviceFeaturesTrait`
632630 to understand if a feature is supported by the device using `is_field_supported`.
633631
634- The enum values are names of fields in the `Consumable` class. Each field is
635- annotated with `requires_schema_code` metadata to map the field to a schema
636- code in the product schema, which may have a different name than the field/attribute name.
632+ The enum values are names of fields in the `Consumable` class. Each field is annotated
633+ with a metadata value to determine if the field is supported by the device.
637634 """
638635
639636 MAIN_BRUSH_WORK_TIME = "main_brush_work_time"
@@ -643,9 +640,9 @@ class ConsumableField(FieldNameBase):
643640
644641@dataclass
645642class Consumable (RoborockBase ):
646- main_brush_work_time : int | None = field (metadata = {"requires_schema_code " : "main_brush_life" }, default = None )
647- side_brush_work_time : int | None = field (metadata = {"requires_schema_code " : "side_brush_life" }, default = None )
648- filter_work_time : int | None = field (metadata = {"requires_schema_code " : "filter_life" }, default = None )
643+ main_brush_work_time : int | None = field (default = None , metadata = {"dps " : RoborockDataProtocol . MAIN_BRUSH_WORK_TIME } )
644+ side_brush_work_time : int | None = field (default = None , metadata = {"dps " : RoborockDataProtocol . SIDE_BRUSH_WORK_TIME } )
645+ filter_work_time : int | None = field (default = None , metadata = {"dps " : RoborockDataProtocol . FILTER_WORK_TIME } )
649646 filter_element_work_time : int | None = None
650647 sensor_dirty_time : int | None = None
651648 strainer_work_times : int | None = None
0 commit comments