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):
11
11
"""Roborock Enum for codes with int values"""
12
12
13
13
@classmethod
14
- def _missing_ (cls : Type [RoborockEnum ], key ) -> str :
14
+ def _missing_ (cls : Type [RoborockEnum ], key ) -> RoborockEnum :
15
15
if hasattr (cls , "missing" ):
16
16
_LOGGER .warning (f"Missing { cls .__name__ } code: { key } - defaulting to 'missing'" )
17
17
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
20
21
21
22
@classmethod
22
23
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" }
24
25
25
26
@classmethod
26
27
def as_enum_dict (cls : Type [RoborockEnum ]):
You can’t perform that action at this time.
0 commit comments