File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -173,8 +173,10 @@ class RoborockCategory(Enum):
173173 WET_DRY_VAC = "roborock.wetdryvac"
174174 VACUUM = "robot.vacuum.cleaner"
175175 WASHING_MACHINE = "roborock.wm"
176+ MOWER = "roborock.mower"
176177 UNKNOWN = "UNKNOWN"
177178
178- def __missing__ (self , key ):
179- _LOGGER .warning ("Missing key %s from category" , key )
179+ @classmethod
180+ def _missing_ (cls , value ):
181+ _LOGGER .warning ("Missing code %s from category" , value )
180182 return RoborockCategory .UNKNOWN
Original file line number Diff line number Diff line change 44
55import pytest
66
7+ from roborock import HomeDataProduct , RoborockCategory
78from roborock .data .b01_q10 .b01_q10_code_mappings import B01_Q10_DP
89
910
@@ -49,3 +50,18 @@ def test_invalid_from_value() -> None:
4950 """Test invalid from_value method."""
5051 with pytest .raises (ValueError , match = "invalid_value is not a valid value for B01_Q10_DP" ):
5152 B01_Q10_DP .from_value ("invalid_value" )
53+
54+
55+ def test_homedata_product_unknown_category ():
56+ """Test that HomeDataProduct can handle unknown categories."""
57+ data = {
58+ "id" : "unknown_cat_id" ,
59+ "name" : "Unknown Device" ,
60+ "model" : "roborock.vacuum.a87" ,
61+ "category" : "roborock.random.category" ,
62+ "schema" : [],
63+ }
64+
65+ product = HomeDataProduct .from_dict (data )
66+ assert product .id == "unknown_cat_id"
67+ assert product .category == RoborockCategory .UNKNOWN
You can’t perform that action at this time.
0 commit comments