From 59c8391fe5654bc88c55c16294bd04f1c4c4993a Mon Sep 17 00:00:00 2001 From: Patrick Pichon Date: Sun, 22 Oct 2023 15:45:16 +0200 Subject: [PATCH] fix --- Modules/actuators.py | 8 ++++---- Modules/tuya.py | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Modules/actuators.py b/Modules/actuators.py index 10dc00368..c11d5f70f 100644 --- a/Modules/actuators.py +++ b/Modules/actuators.py @@ -352,17 +352,17 @@ def handle_color_mode_tuya( self, nwkid, EPout, Hue_List, value): Hue_List, value), nwkid) transitionMoveLevel , transitionRGB , transitionMoveLevel , transitionHue , transitionTemp = get_all_transition_mode( self, nwkid) - _h, _s, brightness = rgb_to_hsl((int(Hue_List["r"]), int(Hue_List["g"]), int(Hue_List["b"]))) + _h, _s, _ = rgb_to_hsl((int(Hue_List["r"]), int(Hue_List["g"]), int(Hue_List["b"]))) saturation = _s * 100 # 0 > 100 saturation = int(saturation * 254 // 100) hue = _h * 360 # 0 > 360 hue = int(hue * 254 // 360) - self.log.logging("Command", "Log", "handle_color_mode_tuya Set Hue X: %s Saturation: %s Brightness: %s Value: %s" % ( - hue, saturation, brightness, value), nwkid) + self.log.logging("Command", "Log", "handle_color_mode_tuya Set Hue X: %s Saturation: %s Value: %s" % ( + hue, saturation, value), nwkid) if get_deviceconf_parameter_value(self, self.ListOfDevices[nwkid]["Model"], "TUYAColorControlRgbMode", return_default=None): tuya_color_control_rgbMode( self, nwkid, "01") - tuya_Move_To_Hue_Saturation_Brightness( self, nwkid, EPout, hue, saturation, transitionHue, brightness) + tuya_Move_To_Hue_Saturation( self, nwkid, EPout, hue, saturation, transitionHue) def actuator_identify(self, nwkid, ep, value=None): diff --git a/Modules/tuya.py b/Modules/tuya.py index 5217e7f89..7cd97b855 100644 --- a/Modules/tuya.py +++ b/Modules/tuya.py @@ -1535,16 +1535,17 @@ def tuya_color_control_rgbMode( self, NwkId, mode): payload = "11" + sqn + "f0" + mode raw_APS_request(self, NwkId, "01", "0300", "0104", payload, zigpyzqn=sqn, zigate_ep=ZIGATE_EP, ackIsDisabled=False) -def tuya_Move_To_Hue_Saturation( self, NwkId, hue, saturation, transition, brightness): +def tuya_Move_To_Hue_Saturation( self, NwkId, hue, saturation, transition): # Command 0x06 self.log.logging("Tuya", "Debug", "tuya_Move_To_Hue_Saturation", NwkId) - hue = "%04x" % struct.unpack("H", struct.pack(">H", hue, ))[0] - saturation = "%04x" % struct.unpack("H", struct.pack(">H", saturation))[0] + hue = "%02x" % hue + saturation = "%02x" % saturation + transition = "%04x" % struct.unpack("H", struct.pack(">H", transition, ))[0] - brightness = "%02x" % brightness + sqn = get_and_inc_ZCL_SQN(self, NwkId) - payload = "11" + sqn + "06" + hue + saturation + + transition + brightness + payload = "11" + sqn + "06" + hue + saturation + transition + "ff" raw_APS_request(self, NwkId, "01", "0300", "0104", payload, zigpyzqn=sqn, zigate_ep=ZIGATE_EP, ackIsDisabled=False)