Skip to content

Commit

Permalink
Sonoff SNZB-02 gets connected as SONOFF Temp/Humi and is a Motion
Browse files Browse the repository at this point in the history
  • Loading branch information
pipiche38 committed Oct 27, 2023
1 parent 2365062 commit 48c1005
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
22 changes: 18 additions & 4 deletions Modules/pluginModels.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ def check_found_plugin_model( self, model, manufacturer_name=None, manufacturer_
if "Model" in x and model not in x["Model"]:
continue
if (
"Manufacturer" in x and x["Manufacturer"] and manufacturer_name not in x["Manufacturer"]
or "ManufId" in x and x["ManufId"] and manufacturer_code not in x["ManufId"]
( "Manufacturer" in x and x["Manufacturer"] and manufacturer_name not in x["Manufacturer"] )
or ( "ManufId" in x and x["ManufId"] and manufacturer_code not in x["ManufId"])
or ( "DeviceID" in x and x["DeviceID"] and device_id not in x["DeviceID"] )
):
continue
if "DeviceID" in x and x["DeviceID"] and device_id not in x["DeviceID"]:
continue

self.log.logging( "Pairing", "Log", "check_found_plugin_model - Found %s" % x)

Expand Down Expand Up @@ -240,5 +239,20 @@ def check_found_plugin_model( self, model, manufacturer_name=None, manufacturer_
"ManufId": [],
"PluginModelName": "TS0601-_TZE200_dzuqwsyg",},

# SONOFF 66666 'Temperature and humidity sensor',:
{
"Model": ["66666",],
"Manufacturer": "eWeLink",
"DeviceID": "0302",
"PluginModelName": "66666-temphumi.json"
},

# SONOFF 66666 'Motion'
{
"Model": ["66666",],
"Manufacturer": "eWeLink",
"DeviceID": "0402",
"PluginModelName": "66666-motion.json"
}

]
14 changes: 8 additions & 6 deletions Modules/zclClusterHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,24 +220,26 @@ def _upd_data_strut_based_on_model(self, MsgSrcAddr, modelName, inital_ep):

def _build_model_name( self, nwkid, modelName):

manufacturer_name = self.ListOfDevices[nwkid]["Manufacturer Name"] if "Manufacturer Name" in self.ListOfDevices[nwkid] else ""
manuf_code = self.ListOfDevices[nwkid]["Manufacturer"] if "Manufacturer" in self.ListOfDevices[nwkid] else ""
manufacturer_name = self.ListOfDevices[nwkid].get("Manufacturer Name", "")
manuf_code = self.ListOfDevices[nwkid].get("Manufacturer", "")
zdevice_id = self.ListOfDevices[nwkid].get("ZDeviceID", None)

if modelName in ( '66666', ):
# https://github.com/Koenkk/zigbee2mqtt/issues/4338
return check_found_plugin_model( self, modelName, manufacturer_name=manufacturer_name, manufacturer_code=manuf_code, device_id=zdevice_id)

# Try to check if the Model name is in the DeviceConf list ( optimised devices)
if modelName + '-' + manufacturer_name in self.DeviceConf:
return modelName + '-' + manufacturer_name

if modelName + manufacturer_name in self.DeviceConf:
return modelName + manufacturer_name

# If not found, let see if the model name can be extracted from the (ModelName, ManufacturerName) tuple set in the Conf file as Identifier
plugin_identifier = plugin_self_identifier( self, modelName, manufacturer_name)
if plugin_identifier:
return plugin_identifier

zdevice_id = self.ListOfDevices[nwkid]["ZDeviceID"] if "ZDeviceID" in self.ListOfDevices[nwkid] and self.ListOfDevices[nwkid]["ZDeviceID"] else None

return check_found_plugin_model( self, modelName, manufacturer_name=manufacturer_name, manufacturer_code=manuf_code, device_id=zdevice_id)


Expand Down

0 comments on commit 48c1005

Please sign in to comment.