Skip to content

Commit

Permalink
Show DPS found on cloud if it's buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou authored Nov 10, 2023
1 parent e5c9ad4 commit e493ee4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions custom_components/localtuya/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,11 @@ def dps_string_list(dps_data: dict[str, dict], cloud_dp_codes: dict[str, dict])
"""Return list of friendly DPS values."""
strs = []

# Merge DPS found on cloud with local dps strings.
# for dp, func in cloud_dp_codes.items():
# if dp not in dps_data:
# dps_data[dp] = f"{func.get('value')}, cloud pull"
# Merge DPs that found through cloud with local.
# These DPs probably doesn't have local states, so we assume there functions are buttons.
for dp, func in cloud_dp_codes.items():
if dp not in dps_data and str(func.get("value")).lower() in ["false", "true"]:
dps_data[dp] = f"{func.get('value')}, tip: button entity"

for dp, value in dps_data.items():
if (dp_data := cloud_dp_codes.get(dp)) and (code := dp_data.get("code")):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/localtuya/core/tuya_devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def generate_tuya_device(localtuya_data: dict, tuya_category: str) -> dict | lis

if not tuya_category or not detected_dps:
return
if dps_data := device_cloud_data.get("dps_data"):
detected_dps = merge_local_cloud_dps(detected_dps, dps_data)
# if dps_data := device_cloud_data.get("dps_data"):
# detected_dps = merge_local_cloud_dps(detected_dps, dps_data)

entities = {}

Expand Down

0 comments on commit e493ee4

Please sign in to comment.