From b69b3bca7099958b367b9052e9869cbc0709211c Mon Sep 17 00:00:00 2001 From: Bander <46300268+xZetsubou@users.noreply.github.com> Date: Wed, 3 Jan 2024 08:17:07 +0300 Subject: [PATCH] convert_list otherwise return list --- custom_components/localtuya/core/tuya_devices/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/localtuya/core/tuya_devices/__init__.py b/custom_components/localtuya/core/tuya_devices/__init__.py index 942412524..b0101a3b7 100644 --- a/custom_components/localtuya/core/tuya_devices/__init__.py +++ b/custom_components/localtuya/core/tuya_devices/__init__.py @@ -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 "" @@ -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"""