Skip to content

Commit

Permalink
option to ignore matter devices
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Sep 21, 2023
1 parent 36c7fb7 commit e1bf886
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ This project tries to adhere to [Semantic Versioning](http://semver.org/). In pr
- `MINOR` version when a new device type is added, or when a new feature is added that is backwards-compatible
- `PATCH` version when backwards-compatible bug fixes are implemented

## BETA

### Added

- Option to ignore Matter devices

## 9.2.6 (2023-09-18)

⚠️ Note this will be the last version of the plugin to support Node 16.
Expand Down
8 changes: 8 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@
"functionBody": "return (model.username && model.password);"
}
},
"ignoreMatter": {
"type": "boolean",
"title": "Ignore Matter Devices",
"condition": {
"functionBody": "return (model.username && model.password);"
}
},
"disableDeviceLogging": {
"type": "boolean",
"title": "Disable Device Logging",
Expand Down Expand Up @@ -1611,6 +1618,7 @@
"password",
"userkey",
"ignoreHKNative",
"ignoreMatter",
"connection",
{
"type": "fieldset",
Expand Down
15 changes: 14 additions & 1 deletion lib/connection/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class {
constructor(platform) {
this.ignoredDevices = platform.ignoredDevices;
this.ignoreHKNative = platform.config.ignoreHKNative;
this.ignoreMatter = platform.config.ignoreMatter;
this.localUUIDs = platform.localUUIDs;
this.log = platform.log;
this.password = platform.config.password;
Expand Down Expand Up @@ -149,8 +150,9 @@ export default class {
return;
}

// Don't initialise the device if the 'ignore homekit native option' is enabled and hardware matches
const model = device.deviceType.toUpperCase();

// Don't initialise the device if the 'ignore homekit native option' is enabled and hardware matches
if (
this.ignoreHKNative
&& device.hdwareVersion
Expand All @@ -161,6 +163,17 @@ export default class {
return;
}

// Don't initialise the device if the 'ignore matter option' is enabled and hardware matches
if (
this.ignoreMatter
&& device.hdwareVersion
&& Array.isArray(platformConsts.matterHardware[model])
&& platformConsts.matterHardware[model].includes(device.hdwareVersion.charAt(0))
) {
this.log('[%s] %s.', device.devName, platformLang.noInitMatterIgnore);
return;
}

// Add the device to the return array for the plugin to initialise as a cloud device
toReturn.push(device);
});
Expand Down
1 change: 1 addition & 0 deletions lib/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export default class {
}
case 'disableDeviceLogging':
case 'ignoreHKNative':
case 'ignoreMatter':
if (typeof val === 'string') {
logQuotes(key);
}
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default {
password: '',
userkey: '',
ignoreHKNative: false,
ignoreMatter: false,
connection: 'hybrid',
domain: 'iot.meross.com',
disableDeviceLogging: false,
Expand Down Expand Up @@ -328,6 +329,10 @@ export default {
SP425EW: ['4'], // MSS425E
},

matterHardware: {
MSS315: ['9'], // https://github.com/bwp91/homebridge-meross/issues/537
},

noLocalControl: ['MSH300', 'MSH300HK'],

httpRetryCodes: ['ENOTFOUND', 'ETIMEDOUT', 'EAI_AGAIN', 'ECONNABORTED'],
Expand Down
1 change: 1 addition & 0 deletions lib/utils/lang-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default {
noHybridMode: 'cloud control is forced',
noInitHKIgnore: 'not initialising cloud device as matched as HomeKit native model',
noInitIgnore: 'not initialising cloud device as ignored or configured locally',
noInitMatterIgnore: 'not initialising cloud device as matched as Matter model',
noIP: 'no IP address provided for device',
noResponse: 'no response received from Meross server',
notAuth: 'not authenticated',
Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"engines": {
"homebridge": "^1.6.0 || ^2.0.0-beta.0",
"node": "^16.20.2 || ^18.17.1 || ^20.5.1"
"node": "^16.20.2 || ^18.18.0 || ^20.7.0"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit e1bf886

Please sign in to comment.