Skip to content

Commit

Permalink
convert_list otherwise return list
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Jan 3, 2024
1 parent 8a3bd15 commit b69b3bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/localtuya/core/tuya_devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def scale(value: int, scale: int, _type: type = int) -> float:
return _type(value) / (10**scale)


def convert_list(_list: list, prefer_type: dict | str = str) -> dict:
def convert_list(_list: list, prefer_type: dict | list | str = str):
"""Return list to dict values."""
if not _list:
return ""
Expand All @@ -221,6 +221,9 @@ def convert_list(_list: list, prefer_type: dict | str = str) -> dict:
to_dict = {k: k.replace("_", " ").capitalize() for k in _list}
return to_dict

# otherwise return prefer type list
return _list


def convert_to_kelvin(value):
"""Convert Tuya color temperature to kelvin"""
Expand Down

0 comments on commit b69b3bc

Please sign in to comment.