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 4d6aef0 commit c891f3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Modules/actuators.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,14 @@ def actuator_setcolor(self, nwkid, EPout, value, Color):

force_color_command = get_deviceconf_parameter_value(self, self.ListOfDevices[nwkid]["Model"], "FORCE_COLOR_COMMAND", return_default=None)
ColorCapabilitiesList = device_color_capabilities( self, nwkid, EPout)

self.log.logging("Command", "Debug", "actuator_setcolor force_color_command %s" % force_color_command, nwkid)

if Hue_List["m"] == 2:
# ColorModeTemp = 2 // White with color temperature. Valid fields: t
handle_color_mode_2(self, nwkid, EPout, Hue_List)

elif Hue_List["m"] == 3 and force_color_command == "TuyaMovetoHueandSaturation":
handle_color_mode_tuya( self, nwkid, EPout, Hue_List)
handle_color_mode_tuya( self, nwkid, EPout, Hue_List, value)

elif Hue_List["m"] == 3:
# ColorModeRGB = 3 // Color. Valid fields: r, g, b.
Expand Down Expand Up @@ -362,7 +363,7 @@ def handle_color_mode_tuya( self, nwkid, EPout, Hue_List, value):
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( self, nwkid, EPout, hue, saturation, transitionHue)
tuya_Move_To_Hue_Saturation( self, nwkid, EPout, hue, saturation, transitionHue )

def actuator_identify(self, nwkid, ep, value=None):

Expand Down
6 changes: 2 additions & 4 deletions Modules/tuya.py
Original file line number Diff line number Diff line change
Expand Up @@ -1535,19 +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):
def tuya_Move_To_Hue_Saturation( self, NwkId, EPout, hue, saturation, transition):
# Command 0x06
self.log.logging("Tuya", "Debug", "tuya_Move_To_Hue_Saturation", NwkId)

hue = "%02x" % hue
saturation = "%02x" % saturation

transition = "%04x" % struct.unpack("H", struct.pack(">H", transition, ))[0]

sqn = get_and_inc_ZCL_SQN(self, NwkId)
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)
raw_APS_request(self, NwkId, EPout, "0300", "0104", payload, zigpyzqn=sqn, zigate_ep=ZIGATE_EP, ackIsDisabled=False)


def tuya_Move_To_Hue_Saturation_Brightness( self, NwkId, epout, hue, saturation, brightness):
Expand Down

0 comments on commit c891f3f

Please sign in to comment.