Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonoff SNZB-02 gets connected as SONOFF Temp/Humi and is a Motion #1661

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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