Skip to content

Commit

Permalink
tuple codes -> force detected dps to lowercase.
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Apr 1, 2024
1 parent 41fef89 commit cdc1257
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions custom_components/localtuya/core/ha_entities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ def gen_localtuya_entities(localtuya_data: dict, tuya_category: str) -> list[dic
if type(code) == Enum:
code = code.value

# If there's multi possible codes.
if isinstance(code, tuple):
for dp_code in code:
if any(dp_code in dps.split() for dps in detected_dps):
code = parse_enum(dp_code)
for _code in code:
if any(_code in dp.lower().split() for dp in detected_dps):
code = parse_enum(_code)
break
else:
code = None
Expand Down

0 comments on commit cdc1257

Please sign in to comment.