File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -11,16 +11,17 @@ class RoborockEnum(IntEnum):
1111 """Roborock Enum for codes with int values"""
1212
1313 @classmethod
14- def _missing_ (cls : Type [RoborockEnum ], key ) -> str :
14+ def _missing_ (cls : Type [RoborockEnum ], key ) -> RoborockEnum :
1515 if hasattr (cls , "missing" ):
1616 _LOGGER .warning (f"Missing { cls .__name__ } code: { key } - defaulting to 'missing'" )
1717 return cls .missing # type: ignore
18- _LOGGER .warning (f"Missing { cls .__name__ } code: { key } - defaulting to { cls .keys ()[0 ]} " )
19- return cls .keys ()[0 ]
18+ default_value = next ((item for item in cls ))
19+ _LOGGER .warning (f"Missing { cls .__name__ } code: { key } - defaulting to { default_value } " )
20+ return default_value
2021
2122 @classmethod
2223 def as_dict (cls : Type [RoborockEnum ]):
23- return {i .value : i .name for i in cls if i .name != "missing" }
24+ return {i .name : i .value for i in cls if i .name != "missing" }
2425
2526 @classmethod
2627 def as_enum_dict (cls : Type [RoborockEnum ]):
You can’t perform that action at this time.
0 commit comments