Skip to content

Commit

Permalink
Update xt_tuya_sharing_device_repository.py
Browse files Browse the repository at this point in the history
  • Loading branch information
azerty9971 committed Jan 27, 2025
1 parent 8437542 commit 31cc532
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,25 @@ def update_device_strategy_info(self, device: CustomerDevice):
self._update_device_strategy_info_mod(device)
#Sometimes the Type provided by Tuya is ill formed,
#replace it with the one from the local strategy
for loc_strat in device.local_strategy.values():
if "statusCode" not in loc_strat or "valueType" not in loc_strat:
continue
code = loc_strat["statusCode"]
value_type = loc_strat["valueType"]
# for loc_strat in device.local_strategy.values():
# if "statusCode" not in loc_strat or "valueType" not in loc_strat:
# continue
# code = loc_strat["statusCode"]
# value_type = loc_strat["valueType"]

if code in device.status_range:
device.status_range[code].type = value_type
if code in device.function:
device.function[code].type = value_type
# if code in device.status_range:
# device.status_range[code].type = value_type
# if code in device.function:
# device.function[code].type = value_type

if (
"valueDesc" in loc_strat and
code not in device.status_range and
code not in device.function
):
device.status_range[code] = DeviceStatusRange() #CHANGED
device.status_range[code].code = code
device.status_range[code].type = value_type
device.status_range[code].values = loc_strat["valueDesc"]
# if (
# "valueDesc" in loc_strat and
# code not in device.status_range and
# code not in device.function
# ):
# device.status_range[code] = DeviceStatusRange() #CHANGED
# device.status_range[code].code = code
# device.status_range[code].type = value_type
# device.status_range[code].values = loc_strat["valueDesc"]

self.multi_manager.virtual_state_handler.apply_init_virtual_states(device)

0 comments on commit 31cc532

Please sign in to comment.