Skip to content

Commit

Permalink
prevent using the new tuyaTS0601 path, when the model do not provide …
Browse files Browse the repository at this point in the history
…any datapoint definition
  • Loading branch information
pipiche38 committed Oct 25, 2023
1 parent 7ef8761 commit d6f9f86
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions Modules/paramDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
tuya_trv_set_opened_window_temp,
tuya_trv_thermostat_sensor_mode,
tuya_trv_window_detection)
from Modules.tuyaTS0601 import TS0601_COMMANDS, ts0601_actuator
from Modules.tuyaTS0601 import (TS0601_COMMANDS, ts0601_actuator,
ts0601_extract_data_point_infos)


def Ballast_max_level(self, nwkid, max_level):
Expand Down Expand Up @@ -308,20 +309,14 @@ def ias_sensitivity(self, nwkid, sensitivity):
}

def sanity_check_of_param(self, NwkId):
if "Param" not in self.ListOfDevices[NwkId]:
return

for param in self.ListOfDevices[NwkId]["Param"]:
if param in TS0601_COMMANDS:
# We a Tuya TS0601 devices
value = self.ListOfDevices[NwkId]["Param"][param]
ts0601_actuator( self, NwkId, param, value)
continue

if param in DEVICE_PARAMETERS:
func = DEVICE_PARAMETERS[param]
value = self.ListOfDevices[NwkId]["Param"][param]
func(self, NwkId, value)
param_data = self.ListOfDevices.get(NwkId, {}).get("Param", {})
model_name = self.ListOfDevices.get(NwkId, {}).get("Model", "")

for param, value in param_data.items():
if ts0601_extract_data_point_infos(self, model_name) and param in TS0601_COMMANDS:
ts0601_actuator(self, NwkId, param, value)
elif param in DEVICE_PARAMETERS:
DEVICE_PARAMETERS[param](self, NwkId, value)


def get_device_config_param( self, NwkId, config_parameter):
Expand Down

0 comments on commit d6f9f86

Please sign in to comment.