def tuya_sirene_registration(self, nwkid): self.log.logging("Tuya", "Debug", "tuya_sirene_registration - Nwkid: %s" % nwkid) EPout = "01" payload = "11" + get_and_inc_SQN(self, nwkid) + "10" + "002a" raw_APS_request( self, nwkid, EPout, "ef00", "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), ) # (1) 3 x Write Attribute Cluster 0x0000 - Attribute 0xffde - DT 0x20 - Value: 0x13 EPout = "01" write_attribute(self, nwkid, ZIGATE_EP, EPout, "0000", "0000", "00", "ffde", "20", "13", ackIsDisabled=False) # (2) Cmd 0xf0 send on Cluster 0x0000 - no data payload = "11" + get_and_inc_SQN(self, nwkid) + "f0" raw_APS_request( self, nwkid, EPout, "0000", "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), ) # (3) Cmd 0x03 on Cluster 0xef00 (Cluster Specific) payload = "11" + get_and_inc_SQN(self, nwkid) + "03" raw_APS_request( self, nwkid, EPout, "ef00", "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), ) # Set the Siren to °C tuya_siren_temp_unit(self, nwkid, unit="C")
def tuya_cmd(self, nwkid, EPout, cluster_frame, sqn, cmd, action, data, action2=None, data2=None): if nwkid not in self.ListOfDevices: return transid = "%02x" % get_next_tuya_transactionId(self, nwkid) len_data = (len(data)) // 2 payload = cluster_frame + sqn + cmd + "00" + transid + action + "00" + "%02x" % len_data + data if action2 and data2: len_data2 = (len(data2)) // 2 payload += action2 + "00" + "%02x" % len_data2 + data2 raw_APS_request( self, nwkid, EPout, "ef00", "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), ) self.log.logging( "Tuya", "Debug", "tuya_cmd - %s/%s cmd: %s payload: %s" % (nwkid, EPout, cmd, payload))
def setXiaomiVibrationSensitivity(self, key, sensitivity="medium"): VIBRATION_SENSIBILITY = {"high": 0x01, "medium": 0x0B, "low": 0x15} if sensitivity not in VIBRATION_SENSIBILITY: sensitivity = "medium" manuf_id = "115f" manuf_spec = "01" cluster_id = "%04x" % 0x0000 attribute = "%04x" % 0xFF0D data_type = "20" # Int8 data = "%02x" % VIBRATION_SENSIBILITY[sensitivity] write_attribute( self, key, ZIGATE_EP, "01", cluster_id, manuf_id, manuf_spec, attribute, data_type, data, ackIsDisabled=is_ack_tobe_disabled(self, key), )
def send_configure_reporting_attributes_set(self, key, Ep, cluster, direction, manufacturer_spec, manufacturer, attrLen, attrList, attributeList): # Prepare the payload #datas = ZIGATE_EP + Ep + cluster + direction + manufacturer_spec + manufacturer #datas += "%02x" % (attrLen) + attrList #self.logging("Debug", "--> send_configure_reporting_attributes_set - 0120 - %s" % (datas)) self.logging( "Debug", "--> send_configure_reporting_attributes_set Reporting %s/%s on cluster %s Len: %s Attribute List: %s" % (key, Ep, cluster, attrLen, attrList), nwkid=key, ) i_sqn = zcl_configure_reporting_request( self, key, ZIGATE_EP, Ep, cluster, direction, manufacturer_spec, manufacturer, "%02x" % (attrLen), attrList, is_ack_tobe_disabled(self, key)) #if is_ack_tobe_disabled(self, key): # #i_sqn = send_zigatecmd_zcl_noack(self, key, "0120", datas) #else: # #i_sqn = send_zigatecmd_zcl_ack(self, key, "0120", datas) for x in attributeList: set_isqn_datastruct(self, "ConfigureReporting", key, Ep, cluster, x, i_sqn)
def OrviboRegistration(self, nwkid): cluster = "0000" attribute = "0099" datatype = "20" value = "01" EPout = "01" for tmpEp in self.ListOfDevices[nwkid]["Ep"]: if "0000" in self.ListOfDevices[nwkid]["Ep"][tmpEp]: EPout = tmpEp # Set Commissioning as Done manuf_id = "0000" manuf_spec = "00" cluster_id = "0000" Hattribute = "0099" data_type = "20" # Bool data = "01" Domoticz.Log("Orvibo registration for %s" % nwkid) write_attribute( self, nwkid, ZIGATE_EP, EPout, cluster_id, manuf_id, manuf_spec, Hattribute, data_type, data, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), )
def legrand_fc40(self, nwkid, Mode): # With the permission of @Thorgal789 who did the all reverse enginnering of this cluster CABLE_OUTLET_MODE = { "Confort": 0x00, "Confort -1": 0x01, "Confort -2": 0x02, "Eco": 0x03, "Frost Protection": 0x04, "Off": 0x05, } if Mode not in CABLE_OUTLET_MODE: Domoticz.Error(" Bad Mode : %s for %s" % (Mode, nwkid)) return Hattribute = "0000" data_type = "30" # 8bit Enum Hdata = CABLE_OUTLET_MODE[Mode] # manuf_id = "1021" # Legrand Code # manuf_spec = "01" # Manuf specific flag cluster_id = "%04x" % 0xFC40 EPout = "01" for tmpEp in self.ListOfDevices[nwkid]["Ep"]: if "fc40" in self.ListOfDevices[nwkid]["Ep"][tmpEp]: EPout = tmpEp self.log.logging( "Legrand", "Debug", "legrand %s Set Fil pilote mode - for %s with value %s / cluster: %s, attribute: %s type: %s" % (Mode, nwkid, Hdata, cluster_id, Hattribute, data_type), nwkid=nwkid, ) sqn = get_and_inc_SQN(self, nwkid) fcf = "15" # manufspec = "01" manufcode = "1021" cmd = "00" data = "%02x" % CABLE_OUTLET_MODE[Mode] payload = fcf + manufcode[2:4] + manufcode[0:2] + sqn + cmd + data raw_APS_request( self, nwkid, EPout, "fc40", "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), )
def change_fan_mode(self, NwkId, Ep, fan_mode): if fan_mode not in FAN_MODE: return if "Model" in self.ListOfDevices[NwkId] and self.ListOfDevices[NwkId]["Model"] in ("AC211", "AC221", "CAC221"): casaia_check_irPairing(self, NwkId) # Fan Mode Sequence data = "%02x" % 0x02 write_attribute( self, NwkId, ZIGATE_EP, Ep, "0202", "0000", "00", "0001", "30", data, ackIsDisabled=is_ack_tobe_disabled(self, NwkId), ) data = "%02x" % FAN_MODE[fan_mode] write_attribute( self, NwkId, ZIGATE_EP, Ep, "0202", "0000", "00", "0000", "30", data, ackIsDisabled=is_ack_tobe_disabled(self, NwkId), )
def tuya_cmd_0x0000_0xf0(self, NwkId): # Seen at pairing of a WGH-JLCZ02 / TS011F and TS0201 and TS0601 (MOES BRT-100) payload = "11" + get_and_inc_SQN(self, NwkId) + "fe" raw_APS_request( self, NwkId, '01', "0000", "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, NwkId), ) self.log.logging( "Tuya", "Debug", "tuya_cmd_0x0000_0xf0 - Nwkid: %s reset device Cmd: fe" % NwkId)
def read_report_configure_request(self, nwkid, epout, cluster_id, attribute_list, manuf_specific="00", manuf_code="0000"): nb_attribute = "%02x" % len(attribute_list) str_attribute_list = "".join("%04x" % x for x in attribute_list) direction = "00" #datas = nwkid + ZIGATE_EP + epout + cluster_id + direction + nb_attribute + manuf_specific + manuf_code + str_attribute_list zcl_read_report_config_request(self, nwkid, ZIGATE_EP, epout, cluster_id, direction, manuf_specific, manuf_code, nb_attribute, str_attribute_list, is_ack_tobe_disabled(self, nwkid))
def setPowerOn_OnOff(self, key, OnOffMode=0xFF): # OSRAM/LEDVANCE # 0xfc0f --> Command 0x01 # 0xfc01 --> Command 0x01 # Tested on Ikea Bulb without any results ! POWERON_MODE = (0x00, 0x01, 0xFE) # Off # On # Previous state if "Manufacturer" in self.ListOfDevices[key]: manuf_spec = "01" manuf_id = self.ListOfDevices[key]["Manufacturer"] else: manuf_spec = "00" manuf_id = "0000" EPin = "01" EPout = "01" for tmpEp in self.ListOfDevices[key]["Ep"]: if "0006" in self.ListOfDevices[key]["Ep"][tmpEp]: EPout = tmpEp cluster_id = "0006" attribute = "4003" data_type = "30" # data = "ff" data = "%02x" % OnOffMode if OnOffMode in POWERON_MODE else "%02x" % 255 self.log.logging( "Output", "Debug", "set_PowerOn_OnOff for %s/%s - OnOff: %s" % (key, EPout, OnOffMode), key) write_attribute( self, key, "01", EPout, cluster_id, manuf_id, manuf_spec, attribute, data_type, data, ackIsDisabled=is_ack_tobe_disabled(self, key), ) ReadAttributeRequest_0006_400x(self, key)
def cable_connected_mode(self, nwkid, Mode): data_type = "09" # 16-bit Data Hattribute = "0000" Hdata = "0000" if Mode == "10": # Sortie de Cable: 0x0100 # Radiateur sans FIP: 0x0100 # Appareil de cuisine: 0x0100 Hdata = "0100" # Disable FIP elif Mode == "20": # FIP # Radiateur avec FIP: 0x0200 + Bind fc40 + configReporting ( fc40 / 0000 / TimeOut 600 ) Hdata = "0200" # Enable FIP manuf_id = "0000" manuf_spec = "00" cluster_id = "%04x" % 0xFC01 EPout = "01" for tmpEp in self.ListOfDevices[nwkid]["Ep"]: if "fc01" in self.ListOfDevices[nwkid]["Ep"][tmpEp]: EPout = tmpEp write_attribute( self, nwkid, "01", EPout, cluster_id, manuf_id, manuf_spec, Hattribute, data_type, Hdata[2:4] + Hdata[0:2], ackIsDisabled=is_ack_tobe_disabled(self, nwkid), ) ReadAttributeRequest_0006_0000(self, nwkid) ReadAttributeRequest_0b04_050b(self, nwkid) ReadAttributeRequest_fc40(self, nwkid)
def casaia_swing_OnOff(self, NwkId, OnOff): if OnOff not in ("00", "01"): return EPout = get_ffad_endpoint(self, NwkId) write_attribute( self, NwkId, ZIGATE_EP, EPout, "0201", CASAIA_MANUF_CODE, "01", "fd00", "10", OnOff, ackIsDisabled=is_ack_tobe_disabled(self, NwkId), ) self.log.logging( "CasaIA", "Debug", "swing_OnOff ++++ %s/%s OnOff: %s" % (NwkId, EPout, OnOff), NwkId)
def get_group_identifiers_request(self, nwkid): cluster_frame = "19" sqn = get_and_inc_SQN(self, nwkid) command = "41" start_index = "00" cluster = "1000" ListOfEp = getListOfEpForCluster(self, nwkid, cluster) if len(ListOfEp) != 1: return payload = cluster_frame + sqn + command + start_index ep = ListOfEp[0] raw_APS_request( self, nwkid, ep, cluster, "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), highpriority=True, )
def enableOppleSwitch(self, nwkid): if nwkid not in self.ListOfDevices: return if "Model" not in self.ListOfDevices[nwkid]: return if (self.ListOfDevices[nwkid]["Model"] in ("lumi.remote.b686opcn01-bulb", "lumi.remote.b486opcn01-bulb", "lumi.remote.b286opcn01-bulb") and "Lumi" not in self.ListOfDevices[nwkid]): self.ListOfDevices[nwkid]["Lumi"] = {"AqaraOppleBulbMode": True} return manuf_id = "115f" manuf_spec = "01" cluster_id = "fcc0" Hattribute = "0009" data_type = "20" Hdata = "01" self.log.logging( "Lumi", "Debug", "Write Attributes LUMI Opple Magic Word Nwkid: %s" % nwkid, nwkid) write_attribute( self, nwkid, ZIGATE_EP, "01", cluster_id, manuf_id, manuf_spec, Hattribute, data_type, Hdata, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), )
def tuya_send_default_response(self, Nwkid, srcEp, sqn, cmd, orig_fcf): if Nwkid not in self.ListOfDevices: return orig_fcf = int(orig_fcf, 16) frame_type = "%02x" % (0b00000011 & orig_fcf) manuf_spec = "%02x" % ((0b00000100 & orig_fcf) >> 2) direction = "%02x" % (not ((0b00001000 & orig_fcf) >> 3)) disabled_default = "%02x" % ((0b00010000 & orig_fcf) >> 4) if disabled_default == "01": return fcf = build_fcf("00", manuf_spec, direction, disabled_default) payload = fcf + sqn + "0b" if manuf_spec == "01": payload += TUYA_MANUF_CODE[2:4] + TUYA_MANUF_CODE[0:2] payload += cmd + "00" raw_APS_request( self, Nwkid, srcEp, "ef00", "0104", payload, zigate_ep=ZIGATE_EP, highpriority=True, ackIsDisabled=is_ack_tobe_disabled(self, Nwkid), ) self.log.logging( "Tuya", "Debug", "tuya_send_default_response - %s/%s fcf: 0x%s ManufSpec: 0x%s Direction: 0x%s DisableDefault: 0x%s" % (Nwkid, srcEp, fcf, manuf_spec, direction, disabled_default), )
def thermostat_Setpoint_Danfoss(self, NwkId, setpoint): # Command Manufactuer Specific # Setpoint command sends: setpointType (enum8) + HeatingSetpoint (16bit) # if setpointType = 1 the actuator will make a large movement to minimize reaction time to UI. # If setpointType = 0 the behavior will be the same as setting the attribute "Occupied Heating Setpoint" to the same value. # if setpointType = 2 displayed setpoint is not effected but regulated setpoint will change. can be used for Forecast functionality self.log.logging( "Danfoss", "Debug", "thermostat_Setpoint_Danfoss - for %s with value %s " % (NwkId, setpoint), nwkid=NwkId, ) if "Param" not in self.ListOfDevices[NwkId]: return if "DanfossSetPointType" not in self.ListOfDevices[NwkId]["Param"]: return if not int(self.ListOfDevices[NwkId]["Param"]["DanfossSetPointType"]): return if int(self.ListOfDevices[NwkId]["Param"]["DanfossSetPointType"]) not in ( 1, 2): return self.log.logging( "Danfoss", "Debug", "thermostat_Setpoint_Danfoss - for %s with value %s and SetPointType: %s" % (NwkId, setpoint, int(self.ListOfDevices[NwkId]["Param"]["DanfossSetPointType"])), nwkid=NwkId, ) danfoss_setpoint_command = "40" danfoss_setpoint_type = "%02x" % int( self.ListOfDevices[NwkId]["Param"]["DanfossSetPointType"]) danfoss_setpoint_value = "%04x" % int( (setpoint * 2) / 2) # Round to 0.5 degrees EPout = getListOfEpForCluster(self, NwkId, "0201") # cluster_id = "%04x" % 0x0201 manuf_id = "1246" sqn = get_and_inc_SQN(self, NwkId) cluster_frame = build_fcf("1", "1", "0", "0") payload = cluster_frame + manuf_id[2:4] + manuf_id[ 0: 2] + sqn + danfoss_setpoint_command + danfoss_setpoint_type + danfoss_setpoint_value[ 2:4] + danfoss_setpoint_value[0:2] self.log.logging( "Danfoss", "Debug", "thermostat_Setpoint_Danfoss - for %s with cluster_frame: %s payload: %s " % (NwkId, cluster_frame, payload), nwkid=NwkId, ) for ep in EPout: raw_APS_request( self, NwkId, ep, cluster_id, "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, NwkId), )
def legrand_fc01(self, nwkid, command, OnOff): # EnableLedInDark -> enable to detect the device in dark # EnableDimmer -> enable/disable dimmer # EnableLedIfOn -> enable Led with device On self.log.logging("Legrand", "Debug", "legrand_fc01 Nwkid: %s Cmd: %s OnOff: %s " % (nwkid, command, OnOff), nwkid) LEGRAND_REFRESH_TIME = (3 * 3600) + 15 LEGRAND_COMMAND_NAME = ("LegrandFilPilote", "EnableLedInDark", "EnableDimmer", "EnableLedIfOn", "EnableLedShutter") if nwkid not in self.ListOfDevices: return if command not in LEGRAND_COMMAND_NAME: Domoticz.Error("Unknown Legrand command %s" % command) return if "Model" not in self.ListOfDevices[nwkid]: return if self.ListOfDevices[nwkid]["Model"] in ( {} , "" ): return if self.ListOfDevices[nwkid]["Model"] not in LEGRAND_CLUSTER_FC01: self.log.logging( "Legrand", "Error", "%s is not an Legrand known model: %s" % (nwkid, self.ListOfDevices[nwkid]["Model"]), nwkid, ) return if "Legrand" not in self.ListOfDevices[nwkid]: self.ListOfDevices[nwkid]["Legrand"] = {} for cmd in LEGRAND_COMMAND_NAME: if cmd not in self.ListOfDevices[nwkid]["Legrand"]: self.ListOfDevices[nwkid]["Legrand"][cmd] = 0xFF if command == "EnableLedInDark" and command in LEGRAND_CLUSTER_FC01[self.ListOfDevices[nwkid]["Model"]]: if ( self.FirmwareVersion and self.FirmwareVersion.lower() <= "031c" and time() < self.ListOfDevices[nwkid]["Legrand"]["EnableLedInDark"] + LEGRAND_REFRESH_TIME ): return if self.FirmwareVersion and self.FirmwareVersion.lower() <= "031c": self.ListOfDevices[nwkid]["Legrand"]["EnableLedInDark"] = int(time()) data_type = "10" # Bool Hdata = "%02x" % OnOff self.log.logging( "Legrand", "Debug", "--------> %s Nwkid: %s data_type: %s Hdata: %s " % (command, nwkid, data_type, Hdata), nwkid, ) elif command == "EnableLedShutter" and command in LEGRAND_CLUSTER_FC01[self.ListOfDevices[nwkid]["Model"]]: if ( self.FirmwareVersion and self.FirmwareVersion.lower() <= "031c" and time() < self.ListOfDevices[nwkid]["Legrand"]["EnableLedShutter"] + LEGRAND_REFRESH_TIME ): return if self.FirmwareVersion and self.FirmwareVersion.lower() <= "031c": self.ListOfDevices[nwkid]["Legrand"]["EnableLedShutter"] = int(time()) data_type = "10" # Bool Hdata = "%02x" % OnOff self.log.logging( "Legrand", "Debug", "--------> %s Nwkid: %s data_type: %s Hdata: %s " % (command, nwkid, data_type, Hdata), nwkid, ) elif command == "EnableDimmer" and command in LEGRAND_CLUSTER_FC01[self.ListOfDevices[nwkid]["Model"]]: if ( self.FirmwareVersion and self.FirmwareVersion.lower() <= "031c" and time() < self.ListOfDevices[nwkid]["Legrand"]["EnableDimmer"] + LEGRAND_REFRESH_TIME ): return if self.FirmwareVersion and self.FirmwareVersion.lower() <= "031c": self.ListOfDevices[nwkid]["Legrand"]["EnableDimmer"] = int(time()) data_type = "09" # 16-bit Data if OnOff == 1: Hdata = "0101" # Enable Dimmer elif OnOff == 0: Hdata = "0100" # Disable Dimmer else: Hdata = "0000" self.log.logging( "Legrand", "Debug", "--------> %s Nwkid: %s data_type: %s Hdata: %s " % (command, nwkid, data_type, Hdata), nwkid, ) elif command == "EnableLedIfOn" and command in LEGRAND_CLUSTER_FC01[self.ListOfDevices[nwkid]["Model"]]: if ( self.FirmwareVersion and self.FirmwareVersion.lower() <= "031c" and time() < self.ListOfDevices[nwkid]["Legrand"]["EnableLedIfOn"] + LEGRAND_REFRESH_TIME ): return if self.FirmwareVersion and self.FirmwareVersion.lower() <= "031c": self.ListOfDevices[nwkid]["Legrand"]["EnableLedIfOn"] = int(time()) data_type = "10" # Bool Hdata = "%02x" % OnOff self.log.logging( "Legrand", "Debug", "--------> %s Nwkid: %s data_type: %s Hdata: %s " % (command, nwkid, data_type, Hdata), nwkid, ) else: return Hattribute = LEGRAND_CLUSTER_FC01[self.ListOfDevices[nwkid]["Model"]][command] manuf_id = "0000" manuf_spec = "00" cluster_id = "%04x" % 0xFC01 EPout = "01" for tmpEp in self.ListOfDevices[nwkid]["Ep"]: if "fc01" in self.ListOfDevices[nwkid]["Ep"][tmpEp]: EPout = tmpEp self.log.logging( "Legrand", "Debug", "legrand %s OnOff - for %s with value %s / cluster: %s, attribute: %s type: %s" % (command, nwkid, Hdata, cluster_id, Hattribute, data_type), nwkid=nwkid, ) write_attribute( self, nwkid, "01", EPout, cluster_id, manuf_id, manuf_spec, Hattribute, data_type, Hdata, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), ) ReadAttributeRequest_fc01(self, nwkid)
def sendFC01Command(self, sqn, nwkid, ep, ClusterID, cmd, data): self.log.logging("Legrand", "Debug", "sendFC01Command Cmd: %s Data: %s" % (cmd, data)) if cmd == "00": # Read Attribute received attribute = data[2:4] + data[0:2] if ClusterID == "0000" and attribute == "f000": # Respond to Time Of Operation cmd = "01" status = "00" cluster_frame = "1c" dataType = "23" # Uint32 PluginTimeOfOperation = "%08X" % (self.HeartbeatCount * HEARTBEAT) # Time since the plugin started payload = ( cluster_frame + sqn + cmd + attribute + status + dataType + PluginTimeOfOperation[6:8] + PluginTimeOfOperation[4:6] + PluginTimeOfOperation[0:2] + PluginTimeOfOperation[2:4] ) raw_APS_request( self, nwkid, ep, ClusterID, "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), highpriority=True, ) self.log.logging( "Legrand", "Log", "loggingLegrand - Nwkid: %s/%s Cluster: %s, Command: %s Payload: %s" % (nwkid, ep, ClusterID, cmd, data), ) return if cmd == "08": # Assign GroupId to a single remote manufspec = "2110" # Legrand Manuf Specific : 0x1021 cluster_frame = "1d" # Cliuster Specifi, Manuf Specifi payload = cluster_frame + manufspec + sqn + cmd + data raw_APS_request( self, nwkid, ep, ClusterID, "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), highpriority=True, ) self.log.logging( "Legrand", "Log", "loggingLegrand - Nwkid: %s/%s Cluster: %s, Command: %s Payload: %s" % (nwkid, ep, ClusterID, cmd, data), ) return if cmd == "0c": # Assign GroupId to a double remote manufspec = "2110" # Legrand Manuf Specific : 0x1021 cluster_frame = "1d" # Cliuster Specifi, Manuf Specifi payload = cluster_frame + manufspec + sqn + cmd + data raw_APS_request( self, nwkid, ep, ClusterID, "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), highpriority=True, ) self.log.logging( "Legrand", "Log", "loggingLegrand - Nwkid: %s/%s Cluster: %s, Command: %s Payload: %s" % (nwkid, ep, ClusterID, cmd, data), ) return
def tuya_registration(self, nwkid, device_reset=False, parkside=False): if "Model" not in self.ListOfDevices[nwkid]: return _ModelName = self.ListOfDevices[nwkid]["Model"] self.log.logging( "Tuya", "Debug", "tuya_registration - Nwkid: %s Model: %s" % (nwkid, _ModelName)) # (1) 3 x Write Attribute Cluster 0x0000 - Attribute 0xffde - DT 0x20 - Value: 0x13 ( 19 Decimal) # It looks like for Lidl Watering switch the Value is 0x0d ( 13 in decimal ) EPout = "01" self.log.logging( "Tuya", "Debug", "tuya_registration - Nwkid: %s ----- 0x13 in 0x0000/0xffde" % nwkid) if parkside: write_attribute(self, nwkid, ZIGATE_EP, EPout, "0000", "0000", "00", "ffde", "20", "0d", ackIsDisabled=True) else: write_attribute(self, nwkid, ZIGATE_EP, EPout, "0000", "0000", "00", "ffde", "20", "13", ackIsDisabled=True) # (3) Cmd 0x03 on Cluster 0xef00 (Cluster Specific) / Zigbee Device Reset if device_reset: payload = "11" + get_and_inc_SQN(self, nwkid) + "03" raw_APS_request( self, nwkid, EPout, "ef00", "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), ) self.log.logging( "Tuya", "Debug", "tuya_registration - Nwkid: %s reset device Cmd: 03" % nwkid) # Gw->Zigbee gateway query MCU version self.log.logging( "Tuya", "Debug", "tuya_registration - Nwkid: %s Request MCU Version Cmd: 10" % nwkid) if _ModelName in ("TS0601-_TZE200_nklqjk62", ): payload = "11" + get_and_inc_SQN(self, nwkid) + "10" + "000e" else: payload = "11" + get_and_inc_SQN(self, nwkid) + "10" + "0002" raw_APS_request( self, nwkid, EPout, "ef00", "0104", payload, zigate_ep=ZIGATE_EP, ackIsDisabled=is_ack_tobe_disabled(self, nwkid), )