Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pipiche38 committed Oct 22, 2023
1 parent 64c968c commit 59c8391
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Modules/actuators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
11 changes: 6 additions & 5 deletions Modules/tuya.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 59c8391

Please sign in to comment.