From 7ba11ba7a54677bf13c7b45fab1b698068642462 Mon Sep 17 00:00:00 2001 From: Luligu Date: Mon, 18 Nov 2024 12:02:55 +0100 Subject: [PATCH 01/15] Add createMutableDevice --- CHANGELOG.md | 15 ++++++++ link-matterbridge-script.js | 1 - package-lock.json | 69 ++++++++++++++++--------------------- package.json | 5 +-- rock-s0/INSTALL.md | 15 ++++++-- src/platform.ts | 27 +++++++++------ 6 files changed, 76 insertions(+), 56 deletions(-) delete mode 100644 link-matterbridge-script.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bcedd3..69982af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file. If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge-shelly and sponsoring it. +## [1.0.10] - 2024-11-18 + +### Added + +- [edge]: Preliminary updates to support Matterbridge edge (matter.js new API). + +### Changed + +- [log]: Show username and password with **** in logs. +- [package]: Updated dependencies. + + + Buy me a coffee + + ## [1.0.9] - 2024-11-11 ### Added diff --git a/link-matterbridge-script.js b/link-matterbridge-script.js deleted file mode 100644 index 1c61e10..0000000 --- a/link-matterbridge-script.js +++ /dev/null @@ -1 +0,0 @@ -// Nothing to do in production, just a script to link the matterbridge package in development diff --git a/package-lock.json b/package-lock.json index a613436..4570d82 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "ws": "8.18.0" }, "devDependencies": { - "@eslint/js": "9.14.0", + "@eslint/js": "9.15.0", "@types/eslint__js": "8.42.3", "@types/jest": "29.5.14", "@types/multicast-dns": "7.2.4", @@ -626,9 +626,9 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz", - "integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.0.tgz", + "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", "dev": true, "license": "Apache-2.0", "peer": true, @@ -642,9 +642,9 @@ } }, "node_modules/@eslint/core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.7.0.tgz", - "integrity": "sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz", + "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", "dev": true, "license": "Apache-2.0", "peer": true, @@ -653,9 +653,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", - "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", "dev": true, "license": "MIT", "peer": true, @@ -678,9 +678,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.14.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.14.0.tgz", - "integrity": "sha512-pFoEtFWCPyDOl+C6Ift+wC7Ro89otjigCf5vcuWqWgqNSQbRrpjSvdeE6ofLz4dHmyxD5f7gIdGT4+p36L6Twg==", + "version": "9.15.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.15.0.tgz", + "integrity": "sha512-tMTqrY+EzbXmKJR5ToI8lxu7jaN5EdmrBFJpQk5JmSlyLsx6o4t27r883K5xsLuCYCpfKBCGswMSWXsM+jB7lg==", "dev": true, "license": "MIT", "engines": { @@ -699,9 +699,9 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.2.tgz", - "integrity": "sha512-CXtq5nR4Su+2I47WPOlWud98Y5Lv8Kyxp2ukhgFx/eW6Blm18VXJO5WuQylPugRo8nbluoi6GvvxBLqHcvqUUw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", + "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", "dev": true, "license": "Apache-2.0", "peer": true, @@ -2609,9 +2609,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.56", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.56.tgz", - "integrity": "sha512-7lXb9dAvimCFdvUMTyucD4mnIndt/xhRKFAlky0CyFogdnNmdPQNoHI23msF/2V4mpTxMzgMdjK4+YRlFlRQZw==", + "version": "1.5.62", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.62.tgz", + "integrity": "sha512-t8c+zLmJHa9dJy96yBZRXGQYoiCEnHYgFwn1asvSPZSUdVxnB62A4RASd7k41ytG3ErFBA0TpHlKg9D9SQBmLg==", "dev": true, "license": "ISC" }, @@ -2670,28 +2670,28 @@ } }, "node_modules/eslint": { - "version": "9.14.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.14.0.tgz", - "integrity": "sha512-c2FHsVBr87lnUtjP4Yhvk4yEhKrQavGafRA/Se1ouse8PfbfC/Qh9Mxa00yWsZRlqeUB9raXip0aiiUZkgnr9g==", + "version": "9.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.15.0.tgz", + "integrity": "sha512-7CrWySmIibCgT1Os28lUU6upBshZ+GxybLOrmRzi08kS8MBuO8QA7pXEgYgY5W8vK3e74xv0lpjo9DbaGU9Rkw==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.18.0", - "@eslint/core": "^0.7.0", - "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.14.0", - "@eslint/plugin-kit": "^0.2.0", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.9.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.15.0", + "@eslint/plugin-kit": "^0.2.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.0", + "@humanwhocodes/retry": "^0.4.1", "@types/estree": "^1.0.6", "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.5", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.2.0", @@ -2710,8 +2710,7 @@ "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" @@ -5640,14 +5639,6 @@ "node": ">=8" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "license": "MIT", - "peer": true - }, "node_modules/thunky": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", diff --git a/package.json b/package.json index 130fc2f..87b53c5 100644 --- a/package.json +++ b/package.json @@ -92,9 +92,6 @@ "matterbridge:list": "matterbridge -list", "dev:link": "npm link matterbridge", "dev:unlink": "npm unlink matterbridge", - "dev:install": "npm install --no-save matterbridge", - "dev:uninstall": "npm uninstall matterbridge", - "install": "node link-matterbridge-script.js", "install:dependencies": "npm install node-ansi-logger node-persist-manager coap multicast-dns node-fetch ws && npm install --save-dev rimraf @types/multicast-dns @types/ws", "install:typescript": "npm install --save-dev typescript @types/node && npm run install && npm run build", "install:eslint": "npm install --save-dev @eslint/js @types/eslint__js typescript typescript-eslint", @@ -111,7 +108,7 @@ "ws": "8.18.0" }, "devDependencies": { - "@eslint/js": "9.14.0", + "@eslint/js": "9.15.0", "@types/eslint__js": "8.42.3", "@types/jest": "29.5.14", "@types/multicast-dns": "7.2.4", diff --git a/rock-s0/INSTALL.md b/rock-s0/INSTALL.md index fce0045..1e30939 100644 --- a/rock-s0/INSTALL.md +++ b/rock-s0/INSTALL.md @@ -118,10 +118,16 @@ npm -v ``` sudo apt update -sudo apt install cockpit btop -y +sudo apt install cockpit btop samba nano -y sudo apt upgrade ``` +# Install cockpit-files +ssh matterbridge@matterbridge +sudo mkdir -p /usr/share/cockpit/cockpit-files +scp -r "C:\Users\lligu\GitHub\matterbridge-shelly\rock-s0\cockpit-files" matterbridge@matterbridge:/usr/share/cockpit +sudo apt install -t bookworm-backports cockpit + # Install matterbridge cockpit plugin manually Create the directory "\usr\share\cockpit\matterbridge" @@ -133,7 +139,12 @@ copy all the files from cockpit directory to "\usr\share\cockpit\matterbridge" ``` sudo curl https://raw.githubusercontent.com/Luligu/matterbridge-shelly/dev/rock-s0/cockpit-matterbridge.deb -o cockpit-matterbridge.deb -sudo dpkg -i cockpit-matterbridge.deb +``` + +# Clear the journal + +``` +sudo journalctl --vacuum-size=0 --vacuum-time=1s ``` # Prevent the journal logs to grow diff --git a/src/platform.ts b/src/platform.ts index 8a38bd4..f1dcc79 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -62,6 +62,8 @@ import { Switch, VendorId, ModeSelectCluster, + EndpointOptions, + MatterbridgeEndpoint, } from 'matterbridge'; // import { EveHistory, EveHistoryCluster, MatterHistory } from 'matterbridge/history'; @@ -106,6 +108,13 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { private postfix; private failsafeCount; + createMutableDevice(definition: DeviceTypeDefinition | AtLeastOne, options: EndpointOptions = {}, debug = false): MatterbridgeDevice { + let device: MatterbridgeDevice | MatterbridgeEndpoint; + if ('edge' in this.matterbridge && this.matterbridge.edge === true) device = new MatterbridgeEndpoint(definition, options, debug); + else device = new MatterbridgeDevice(definition, options, debug); + return device as unknown as MatterbridgeDevice; + } + constructor(matterbridge: Matterbridge, log: AnsiLogger, config: PlatformConfig) { super(matterbridge, log, config); @@ -126,8 +135,8 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { if (!isValidNumber(this.failsafeCount, 0)) this.failsafeCount = 0; log.debug(`Initializing platform: ${idn}${config.name}${rs}${db} v.${CYAN}${config.version}`); - log.debug(`- username: ${CYAN}${config.username}`); - log.debug(`- password: ${CYAN}${config.password}`); + log.debug(`- username: ${CYAN}${config.username ? '********' : 'undefined'}`); + log.debug(`- password: ${CYAN}${config.password ? '********' : 'undefined'}`); log.debug(`- exposeSwitch: ${CYAN}${config.exposeSwitch}`); log.debug(`- exposeInput: ${CYAN}${config.exposeInput}`); log.debug(`- exposePowerMeter: ${CYAN}${config.exposePowerMeter}`); @@ -240,7 +249,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { } }); if (definition) { - const mbDevice = new MatterbridgeDevice(definition, undefined, config.debug as boolean); + const mbDevice = this.createMutableDevice(definition, undefined, config.debug as boolean); mbDevice.createDefaultBridgedDeviceBasicInformationClusterServer( bthomeDevice.name, bthomeDevice.addr + (this.postfix ? '-' + this.postfix : ''), @@ -476,7 +485,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { } // Create a new Matterbridge device - const mbDevice = new MatterbridgeDevice(bridgedNode, undefined, config.debug as boolean); + const mbDevice = this.createMutableDevice(bridgedNode, undefined, config.debug as boolean); mbDevice.createDefaultBridgedDeviceBasicInformationClusterServer( device.name, device.id + (this.postfix ? '-' + this.postfix : ''), @@ -762,10 +771,10 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { } else if (component.name === 'Input') { const inputComponent = device.getComponent(key); // Skip the input component if it is disabled in Gen 2/3 devices - if (inputComponent && inputComponent?.hasProperty('enable') && inputComponent?.getValue('enable') === false) continue; + if (inputComponent && inputComponent.hasProperty('enable') && inputComponent.getValue('enable') === false) continue; if ( inputComponent && - inputComponent?.hasProperty('state') && + inputComponent.hasProperty('state') && (config.exposeInput === 'contact' || (config.exposeInput === 'disabled' && config.inputContactList && (config.inputContactList as string[]).includes(device.id))) ) { const state = inputComponent.getValue('state') as boolean; @@ -1007,8 +1016,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { mbDevice.subscribeAttribute( ThermostatCluster.id, 'occupiedHeatingSetpoint', - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (newValue: any, oldValue: any) => { + (newValue: number, oldValue: number) => { mbDevice.log.info(`Thermostat occupiedHeatingSetpoint changed from ${oldValue / 100} to ${newValue / 100}`); if (device.thermostatSetpointTimeout) clearTimeout(device.thermostatSetpointTimeout); device.thermostatSetpointTimeout = setTimeout(() => { @@ -1022,8 +1030,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { mbDevice.subscribeAttribute( ThermostatCluster.id, 'occupiedCoolingSetpoint', - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (newValue: any, oldValue: any) => { + (newValue: number, oldValue: number) => { mbDevice.log.info(`Thermostat occupiedCoolingSetpoint changed from ${oldValue / 100} to ${newValue / 100}`); if (device.thermostatSetpointTimeout) clearTimeout(device.thermostatSetpointTimeout); device.thermostatSetpointTimeout = setTimeout(() => { From 7233a41186c64fd66cc356f904d9243552a9be45 Mon Sep 17 00:00:00 2001 From: Luligu Date: Mon, 18 Nov 2024 22:04:11 +0100 Subject: [PATCH 02/15] Add createMutableDevice --- eslint.config.js | 17 +--- package-lock.json | 198 +++++++++++++++++----------------------------- package.json | 7 +- src/platform.ts | 19 +++-- 4 files changed, 92 insertions(+), 149 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 51ac8a3..00f7440 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -8,7 +8,7 @@ import eslintPluginPrettier from 'eslint-plugin-prettier/recommended'; export default [ { name: 'global ignores', - ignores: ['dist/', 'build/', 'node_modules/', 'coverage/', 'frontend/', 'rock-s0/'], + ignores: ['**/dist/', '**/build/', '**/node_modules/', '**/coverage/', '**/frontend/'], }, eslint.configs.recommended, ...tseslint.configs.strict, @@ -20,13 +20,6 @@ export default [ languageOptions: { ecmaVersion: 'latest', sourceType: 'module', - /* - parser: tseslint.parser, - parserOptions: { - project: './tsconfig.eslint.json', - tsconfigRootDir: import.meta.dirname, - }, - */ }, linterOptions: { reportUnusedDisableDirectives: 'warn', @@ -41,7 +34,7 @@ export default [ { name: 'javascript', files: ['**/*.js'], - // ...tseslint.configs.disableTypeChecked, + ...tseslint.configs.disableTypeChecked, }, { name: 'typescript', @@ -66,13 +59,11 @@ export default [ { name: 'jest', files: ['**/__test__/*', '**/*.test.ts', '**/*.spec.ts'], - // ...tseslint.configs.disableTypeChecked, plugins: { '@typescript-eslint': tseslint.plugin, jest: jesteslint, }, - rules: { - ...jesteslint.configs['flat/recommended'].rules, - }, + ...tseslint.configs.disableTypeChecked, + ...jesteslint.configs['flat/recommended'], }, ]; diff --git a/package-lock.json b/package-lock.json index 4570d82..017d42f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,12 @@ { "name": "matterbridge-shelly", - "version": "1.0.9", + "version": "1.0.10-dev.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "matterbridge-shelly", - "version": "1.0.9", - "hasInstallScript": true, + "version": "1.0.10-dev.1", "license": "Apache-2.0", "dependencies": { "coap": "1.4.0", @@ -25,6 +24,7 @@ "@types/multicast-dns": "7.2.4", "@types/node": "22.9.0", "@types/ws": "8.5.13", + "eslint": "9.15.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-jest": "28.9.0", "eslint-plugin-prettier": "5.2.1", @@ -33,7 +33,7 @@ "rimraf": "^6.0.1", "ts-jest": "29.2.5", "typescript": "5.6.3", - "typescript-eslint": "8.14.0" + "typescript-eslint": "8.15.0" }, "engines": { "node": ">=18.0.0" @@ -631,7 +631,6 @@ "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "@eslint/object-schema": "^2.1.4", "debug": "^4.3.1", @@ -647,7 +646,6 @@ "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", "dev": true, "license": "Apache-2.0", - "peer": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -658,7 +656,6 @@ "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -693,7 +690,6 @@ "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", "dev": true, "license": "Apache-2.0", - "peer": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -704,7 +700,6 @@ "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "levn": "^0.4.1" }, @@ -718,7 +713,6 @@ "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", "dev": true, "license": "Apache-2.0", - "peer": true, "engines": { "node": ">=18.18.0" } @@ -729,7 +723,6 @@ "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.3.0" @@ -744,7 +737,6 @@ "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", "dev": true, "license": "Apache-2.0", - "peer": true, "engines": { "node": ">=18.18" }, @@ -759,7 +751,6 @@ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, "license": "Apache-2.0", - "peer": true, "engines": { "node": ">=12.22" }, @@ -774,7 +765,6 @@ "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", "dev": true, "license": "Apache-2.0", - "peer": true, "engines": { "node": ">=18.18" }, @@ -1635,17 +1625,17 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.14.0.tgz", - "integrity": "sha512-tqp8H7UWFaZj0yNO6bycd5YjMwxa6wIHOLZvWPkidwbgLCsBMetQoGj7DPuAlWa2yGO3H48xmPwjhsSPPCGU5w==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.15.0.tgz", + "integrity": "sha512-+zkm9AR1Ds9uLWN3fkoeXgFppaQ+uEVtfOV62dDmsy9QCNqlRHWNEck4yarvRNrvRcHQLGfqBNui3cimoz8XAg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/type-utils": "8.14.0", - "@typescript-eslint/utils": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/scope-manager": "8.15.0", + "@typescript-eslint/type-utils": "8.15.0", + "@typescript-eslint/utils": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -1669,16 +1659,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.14.0.tgz", - "integrity": "sha512-2p82Yn9juUJq0XynBXtFCyrBDb6/dJombnz6vbo6mgQEtWHfvHbQuEa9kAOVIt1c9YFwi7H6WxtPj1kg+80+RA==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.15.0.tgz", + "integrity": "sha512-7n59qFpghG4uazrF9qtGKBZXn7Oz4sOMm8dwNWDQY96Xlm2oX67eipqcblDj+oY1lLCbf1oltMZFpUso66Kl1A==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/typescript-estree": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/scope-manager": "8.15.0", + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/typescript-estree": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0", "debug": "^4.3.4" }, "engines": { @@ -1698,14 +1688,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.14.0.tgz", - "integrity": "sha512-aBbBrnW9ARIDn92Zbo7rguLnqQ/pOrUguVpbUwzOhkFg2npFDwTgPGqFqE0H5feXcOoJOfX3SxlJaKEVtq54dw==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.15.0.tgz", + "integrity": "sha512-QRGy8ADi4J7ii95xz4UoiymmmMd/zuy9azCaamnZ3FM8T5fZcex8UfJcjkiEZjJSztKfEBe3dZ5T/5RHAmw2mA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0" + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1716,14 +1706,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.14.0.tgz", - "integrity": "sha512-Xcz9qOtZuGusVOH5Uk07NGs39wrKkf3AxlkK79RBK6aJC1l03CobXjJbwBPSidetAOV+5rEVuiT1VSBUOAsanQ==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.15.0.tgz", + "integrity": "sha512-UU6uwXDoI3JGSXmcdnP5d8Fffa2KayOhUUqr/AiBnG1Gl7+7ut/oyagVeSkh7bxQ0zSXV9ptRh/4N15nkCqnpw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.14.0", - "@typescript-eslint/utils": "8.14.0", + "@typescript-eslint/typescript-estree": "8.15.0", + "@typescript-eslint/utils": "8.15.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -1734,6 +1724,9 @@ "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, "peerDependenciesMeta": { "typescript": { "optional": true @@ -1741,9 +1734,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.14.0.tgz", - "integrity": "sha512-yjeB9fnO/opvLJFAsPNYlKPnEM8+z4og09Pk504dkqonT02AyL5Z9SSqlE0XqezS93v6CXn49VHvB2G7XSsl0g==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.15.0.tgz", + "integrity": "sha512-n3Gt8Y/KyJNe0S3yDCD2RVKrHBC4gTUcLTebVBXacPy091E6tNspFLKRXlk3hwT4G55nfr1n2AdFqi/XMxzmPQ==", "dev": true, "license": "MIT", "engines": { @@ -1755,14 +1748,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.14.0.tgz", - "integrity": "sha512-OPXPLYKGZi9XS/49rdaCbR5j/S14HazviBlUQFvSKz3npr3NikF+mrgK7CFVur6XEt95DZp/cmke9d5i3vtVnQ==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.15.0.tgz", + "integrity": "sha512-1eMp2JgNec/niZsR7ioFBlsh/Fk0oJbhaqO0jRyQBMgkz7RrFfkqF9lYYmBoGBaSiLnu8TAPQTwoTUiSTUW9dg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -1810,16 +1803,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.14.0.tgz", - "integrity": "sha512-OGqj6uB8THhrHj0Fk27DcHPojW7zKwKkPmHXHvQ58pLYp4hy8CSUdTKykKeh+5vFqTTVmjz0zCOOPKRovdsgHA==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.15.0.tgz", + "integrity": "sha512-k82RI9yGhr0QM3Dnq+egEpz9qB6Un+WLYhmoNcvl8ltMEededhh7otBVVIDDsEEttauwdY/hQoSsOv13lxrFzQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/typescript-estree": "8.14.0" + "@typescript-eslint/scope-manager": "8.15.0", + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/typescript-estree": "8.15.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1830,17 +1823,22 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.14.0.tgz", - "integrity": "sha512-vG0XZo8AdTH9OE6VFRwAZldNc7qtJ/6NLGWak+BtENuEUXGZgFpihILPiBvKXvJ2nFu27XNGC6rKiwuaoMbYzQ==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.15.0.tgz", + "integrity": "sha512-h8vYOulWec9LhpwfAdZf2bjr8xIp0KNKnpgqSz0qqYYKAW/QZKw3ktRndbiAtUz4acH4QLQavwZBYCc0wulA/Q==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.14.0", - "eslint-visitor-keys": "^3.4.3" + "@typescript-eslint/types": "8.15.0", + "eslint-visitor-keys": "^4.2.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1850,19 +1848,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -1881,7 +1866,6 @@ "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1895,7 +1879,6 @@ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "license": "MIT", - "peer": true, "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } @@ -1906,7 +1889,6 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1979,8 +1961,7 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "license": "Python-2.0", - "peer": true + "license": "Python-2.0" }, "node_modules/async": { "version": "3.2.6", @@ -2540,8 +2521,7 @@ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/deepmerge": { "version": "4.3.1", @@ -2661,7 +2641,6 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=10" }, @@ -2675,7 +2654,6 @@ "integrity": "sha512-7CrWySmIibCgT1Os28lUU6upBshZ+GxybLOrmRzi08kS8MBuO8QA7pXEgYgY5W8vK3e74xv0lpjo9DbaGU9Rkw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", @@ -2806,7 +2784,6 @@ "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -2824,7 +2801,6 @@ "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", "dev": true, "license": "Apache-2.0", - "peer": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -2838,7 +2814,6 @@ "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "acorn": "^8.14.0", "acorn-jsx": "^5.3.2", @@ -2871,7 +2846,6 @@ "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "license": "BSD-3-Clause", - "peer": true, "dependencies": { "estraverse": "^5.1.0" }, @@ -2885,7 +2859,6 @@ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "estraverse": "^5.2.0" }, @@ -2899,7 +2872,6 @@ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "engines": { "node": ">=4.0" } @@ -2910,7 +2882,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -2988,8 +2959,7 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/fast-diff": { "version": "1.3.0", @@ -3040,8 +3010,7 @@ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/fastq": { "version": "1.17.1", @@ -3098,7 +3067,6 @@ "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "flat-cache": "^4.0.0" }, @@ -3158,7 +3126,6 @@ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -3176,7 +3143,6 @@ "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" @@ -3190,8 +3156,7 @@ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true, - "license": "ISC", - "peer": true + "license": "ISC" }, "node_modules/foreground-child": { "version": "3.3.0", @@ -3338,7 +3303,6 @@ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "license": "ISC", - "peer": true, "dependencies": { "is-glob": "^4.0.3" }, @@ -3352,7 +3316,6 @@ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=18" }, @@ -3450,7 +3413,6 @@ "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -4308,7 +4270,6 @@ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "argparse": "^2.0.1" }, @@ -4334,8 +4295,7 @@ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", @@ -4349,16 +4309,14 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/json5": { "version": "2.2.3", @@ -4379,7 +4337,6 @@ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "json-buffer": "3.0.1" } @@ -4410,7 +4367,6 @@ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -4432,7 +4388,6 @@ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "p-locate": "^5.0.0" }, @@ -4455,8 +4410,7 @@ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/lru-cache": { "version": "10.4.3", @@ -4731,7 +4685,6 @@ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", @@ -4766,7 +4719,6 @@ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "p-limit": "^3.0.2" }, @@ -4800,7 +4752,6 @@ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "callsites": "^3.0.0" }, @@ -4996,7 +4947,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 0.8.0" } @@ -5087,7 +5037,6 @@ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=6" } @@ -5210,7 +5159,6 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=4" } @@ -5740,7 +5688,6 @@ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "prelude-ls": "^1.2.1" }, @@ -5786,15 +5733,15 @@ } }, "node_modules/typescript-eslint": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.14.0.tgz", - "integrity": "sha512-K8fBJHxVL3kxMmwByvz8hNdBJ8a0YqKzKDX6jRlrjMuNXyd5T2V02HIq37+OiWXvUUOXgOOGiSSOh26Mh8pC3w==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.15.0.tgz", + "integrity": "sha512-wY4FRGl0ZI+ZU4Jo/yjdBu0lVTSML58pu6PgGtJmCufvzfV565pUF6iACQt092uFOd49iLOTX/sEVmHtbSrS+w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.14.0", - "@typescript-eslint/parser": "8.14.0", - "@typescript-eslint/utils": "8.14.0" + "@typescript-eslint/eslint-plugin": "8.15.0", + "@typescript-eslint/parser": "8.15.0", + "@typescript-eslint/utils": "8.15.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -5803,6 +5750,9 @@ "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, "peerDependenciesMeta": { "typescript": { "optional": true @@ -5852,7 +5802,6 @@ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "punycode": "^2.1.0" } @@ -5913,7 +5862,6 @@ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } diff --git a/package.json b/package.json index 87b53c5..9fbcbf2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matterbridge-shelly", - "version": "1.0.9", + "version": "1.0.10-dev.1", "description": "Matterbridge shelly plugin", "author": "https://github.com/Luligu", "license": "Apache-2.0", @@ -94,7 +94,7 @@ "dev:unlink": "npm unlink matterbridge", "install:dependencies": "npm install node-ansi-logger node-persist-manager coap multicast-dns node-fetch ws && npm install --save-dev rimraf @types/multicast-dns @types/ws", "install:typescript": "npm install --save-dev typescript @types/node && npm run install && npm run build", - "install:eslint": "npm install --save-dev @eslint/js @types/eslint__js typescript typescript-eslint", + "install:eslint": "npm install --save-dev eslint @eslint/js @types/eslint__js typescript typescript-eslint", "install:prettier": "npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier", "install:jest": "npm install --save-dev jest ts-jest @types/jest eslint-plugin-jest" }, @@ -114,6 +114,7 @@ "@types/multicast-dns": "7.2.4", "@types/node": "22.9.0", "@types/ws": "8.5.13", + "eslint": "9.15.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-jest": "28.9.0", "eslint-plugin-prettier": "5.2.1", @@ -122,6 +123,6 @@ "rimraf": "^6.0.1", "ts-jest": "29.2.5", "typescript": "5.6.3", - "typescript-eslint": "8.14.0" + "typescript-eslint": "8.15.0" } } \ No newline at end of file diff --git a/src/platform.ts b/src/platform.ts index f1dcc79..7f5c58f 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -63,7 +63,6 @@ import { VendorId, ModeSelectCluster, EndpointOptions, - MatterbridgeEndpoint, } from 'matterbridge'; // import { EveHistory, EveHistoryCluster, MatterHistory } from 'matterbridge/history'; @@ -108,11 +107,15 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { private postfix; private failsafeCount; - createMutableDevice(definition: DeviceTypeDefinition | AtLeastOne, options: EndpointOptions = {}, debug = false): MatterbridgeDevice { - let device: MatterbridgeDevice | MatterbridgeEndpoint; - if ('edge' in this.matterbridge && this.matterbridge.edge === true) device = new MatterbridgeEndpoint(definition, options, debug); - else device = new MatterbridgeDevice(definition, options, debug); - return device as unknown as MatterbridgeDevice; + async createMutableDevice(definition: DeviceTypeDefinition | AtLeastOne, options: EndpointOptions = {}, debug = false): Promise { + let device: MatterbridgeDevice; + const matterbridge = await import('matterbridge'); + if ('edge' in this.matterbridge && this.matterbridge.edge === true && 'MatterbridgeEndpoint' in matterbridge) { + // Dynamically resolve the MatterbridgeEndpoint class from the imported module and instantiate it without throwing a TypeScript error for old versions of Matterbridge + // eslint-disable-next-line @typescript-eslint/no-explicit-any + device = new (matterbridge as any).MatterbridgeEndpoint(definition, options, debug) as MatterbridgeDevice; + } else device = new MatterbridgeDevice(definition, options, debug); + return device; } constructor(matterbridge: Matterbridge, log: AnsiLogger, config: PlatformConfig) { @@ -249,7 +252,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { } }); if (definition) { - const mbDevice = this.createMutableDevice(definition, undefined, config.debug as boolean); + const mbDevice = await this.createMutableDevice(definition, undefined, config.debug as boolean); mbDevice.createDefaultBridgedDeviceBasicInformationClusterServer( bthomeDevice.name, bthomeDevice.addr + (this.postfix ? '-' + this.postfix : ''), @@ -485,7 +488,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { } // Create a new Matterbridge device - const mbDevice = this.createMutableDevice(bridgedNode, undefined, config.debug as boolean); + const mbDevice = await this.createMutableDevice(bridgedNode, undefined, config.debug as boolean); mbDevice.createDefaultBridgedDeviceBasicInformationClusterServer( device.name, device.id + (this.postfix ? '-' + this.postfix : ''), From 5cf358125e8be3f24e388da8b7d486ecd3e5acbe Mon Sep 17 00:00:00 2001 From: Luligu Date: Mon, 18 Nov 2024 22:23:04 +0100 Subject: [PATCH 03/15] Add createMutableDevice --- eslint.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index 00f7440..610a265 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -8,7 +8,7 @@ import eslintPluginPrettier from 'eslint-plugin-prettier/recommended'; export default [ { name: 'global ignores', - ignores: ['**/dist/', '**/build/', '**/node_modules/', '**/coverage/', '**/frontend/'], + ignores: ['**/dist/', '**/build/', '**/node_modules/', '**/coverage/', '**/frontend/', '**/rock-s0/'], }, eslint.configs.recommended, ...tseslint.configs.strict, From 25eddfcfef1af136f5833db34b8bfa359e4cb01f Mon Sep 17 00:00:00 2001 From: Luligu Date: Tue, 19 Nov 2024 15:24:12 +0100 Subject: [PATCH 04/15] Dev 1.0.10-dev.1 --- src/platform.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/platform.ts b/src/platform.ts index 7f5c58f..ce1d428 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -114,7 +114,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { // Dynamically resolve the MatterbridgeEndpoint class from the imported module and instantiate it without throwing a TypeScript error for old versions of Matterbridge // eslint-disable-next-line @typescript-eslint/no-explicit-any device = new (matterbridge as any).MatterbridgeEndpoint(definition, options, debug) as MatterbridgeDevice; - } else device = new MatterbridgeDevice(definition, options, debug); + } else device = new MatterbridgeDevice(definition, undefined, debug); return device; } @@ -252,7 +252,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { } }); if (definition) { - const mbDevice = await this.createMutableDevice(definition, undefined, config.debug as boolean); + const mbDevice = await this.createMutableDevice(definition, { uniqueStorageKey: bthomeDevice.name }, config.debug as boolean); mbDevice.createDefaultBridgedDeviceBasicInformationClusterServer( bthomeDevice.name, bthomeDevice.addr + (this.postfix ? '-' + this.postfix : ''), @@ -303,9 +303,9 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { mbDevice.setAttribute(ThermostatCluster.id, 'minHeatSetpointLimit', 4 * 100, mbDevice.log); mbDevice.setAttribute(ThermostatCluster.id, 'maxHeatSetpointLimit', 30 * 100, mbDevice.log); // eslint-disable-next-line @typescript-eslint/no-explicit-any - (mbDevice.getClusterServerById(ThermostatCluster.id)?.attributes['absMinHeatSetpointLimit'] as any).value = 400; + (mbDevice.getClusterServerById(ThermostatCluster.id)?.attributes['absMinHeatSetpointLimit'] as any).value = 4 * 100; // eslint-disable-next-line @typescript-eslint/no-explicit-any - (mbDevice.getClusterServerById(ThermostatCluster.id)?.attributes['absMaxHeatSetpointLimit'] as any).value = 3000; + (mbDevice.getClusterServerById(ThermostatCluster.id)?.attributes['absMaxHeatSetpointLimit'] as any).value = 30 * 100; mbDevice.subscribeAttribute( ThermostatCluster.id, 'systemMode', @@ -329,8 +329,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { mbDevice.subscribeAttribute( ThermostatCluster.id, 'occupiedHeatingSetpoint', - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (newValue: any, oldValue: any) => { + (newValue: number, oldValue: number) => { if (!isValidNumber(newValue) || !isValidNumber(oldValue) || newValue === oldValue) return; mbDevice.log.info(`Thermostat occupiedHeatingSetpoint changed from ${oldValue / 100} to ${newValue / 100}`); if (device.thermostatSetpointTimeout) clearTimeout(device.thermostatSetpointTimeout); @@ -488,7 +487,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { } // Create a new Matterbridge device - const mbDevice = await this.createMutableDevice(bridgedNode, undefined, config.debug as boolean); + const mbDevice = await this.createMutableDevice(bridgedNode, { uniqueStorageKey: device.name }, config.debug as boolean); mbDevice.createDefaultBridgedDeviceBasicInformationClusterServer( device.name, device.id + (this.postfix ? '-' + this.postfix : ''), @@ -682,7 +681,6 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { const rgb = hslColorToRgbColor((request.hue / 254) * 360, (request.saturation / 254) * 100, 50); this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'ColorRGB', state, level, { r: rgb.r, g: rgb.g, b: rgb.b }); }); - mbDevice.addCommandHandler('moveToColorTemperature', async ({ request, attributes, endpoint }) => { attributes.colorMode.setLocal(ColorControl.ColorMode.ColorTemperatureMireds); const state = child.getClusterServer(OnOffCluster)?.getOnOffAttribute(); @@ -974,9 +972,9 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { mbDevice.setAttribute(ThermostatCluster.id, 'minHeatSetpointLimit', 5 * 100, mbDevice.log, child); mbDevice.setAttribute(ThermostatCluster.id, 'maxHeatSetpointLimit', 35 * 100, mbDevice.log, child); // eslint-disable-next-line @typescript-eslint/no-explicit-any - (child.getClusterServerById(ThermostatCluster.id)?.attributes['absMinHeatSetpointLimit'] as any).value = 500; + (child.getClusterServerById(ThermostatCluster.id)?.attributes['absMinHeatSetpointLimit'] as any).value = 5 * 100; // eslint-disable-next-line @typescript-eslint/no-explicit-any - (child.getClusterServerById(ThermostatCluster.id)?.attributes['absMaxHeatSetpointLimit'] as any).value = 3500; + (child.getClusterServerById(ThermostatCluster.id)?.attributes['absMaxHeatSetpointLimit'] as any).value = 35 * 100; } if (thermostatComponent.getValue('type') === 'cooling') { mbDevice.setAttribute(ThermostatCluster.id, 'systemMode', Thermostat.SystemMode.Cool, mbDevice.log, child); @@ -986,9 +984,9 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { mbDevice.setAttribute(ThermostatCluster.id, 'minCoolSetpointLimit', 5 * 100, mbDevice.log, child); mbDevice.setAttribute(ThermostatCluster.id, 'maxCoolSetpointLimit', 35 * 100, mbDevice.log, child); // eslint-disable-next-line @typescript-eslint/no-explicit-any - (child.getClusterServerById(ThermostatCluster.id)?.attributes['absMinCoolSetpointLimit'] as any).value = 500; + (child.getClusterServerById(ThermostatCluster.id)?.attributes['absMinCoolSetpointLimit'] as any).value = 5 * 100; // eslint-disable-next-line @typescript-eslint/no-explicit-any - (child.getClusterServerById(ThermostatCluster.id)?.attributes['absMaxCoolSetpointLimit'] as any).value = 3500; + (child.getClusterServerById(ThermostatCluster.id)?.attributes['absMaxCoolSetpointLimit'] as any).value = 35 * 100; } if (thermostatComponent.getValue('enable') === false) mbDevice.setAttribute(ThermostatCluster.id, 'systemMode', Thermostat.SystemMode.Off, mbDevice.log, child); From 7e2e3b0561f0a82265222b42e97c9ea55307ed37 Mon Sep 17 00:00:00 2001 From: Luligu Date: Wed, 20 Nov 2024 09:32:17 +0100 Subject: [PATCH 05/15] Dev 1.0.10-dev.2 --- package-lock.json | 22 ++++++------ package.json | 2 +- src/platform.ts | 87 ++++++++++++++++++++++++++++++++--------------- 3 files changed, 72 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index 017d42f..7de633d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "matterbridge-shelly", - "version": "1.0.10-dev.1", + "version": "1.0.10-dev.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "matterbridge-shelly", - "version": "1.0.10-dev.1", + "version": "1.0.10-dev.2", "license": "Apache-2.0", "dependencies": { "coap": "1.4.0", @@ -2461,9 +2461,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.5.tgz", - "integrity": "sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "license": "MIT", "dependencies": { @@ -2589,9 +2589,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.62", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.62.tgz", - "integrity": "sha512-t8c+zLmJHa9dJy96yBZRXGQYoiCEnHYgFwn1asvSPZSUdVxnB62A4RASd7k41ytG3ErFBA0TpHlKg9D9SQBmLg==", + "version": "1.5.63", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.63.tgz", + "integrity": "sha512-ddeXKuY9BHo/mw145axlyWjlJ1UBt4WK3AlvkT7W2AbqfRQoacVoRUCF6wL3uIx/8wT9oLKXzI+rFqHHscByaA==", "dev": true, "license": "ISC" }, @@ -3152,9 +3152,9 @@ } }, "node_modules/flatted": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", - "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", "dev": true, "license": "ISC" }, diff --git a/package.json b/package.json index 9fbcbf2..8b219d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matterbridge-shelly", - "version": "1.0.10-dev.1", + "version": "1.0.10-dev.2", "description": "Matterbridge shelly plugin", "author": "https://github.com/Luligu", "license": "Apache-2.0", diff --git a/src/platform.ts b/src/platform.ts index ce1d428..3c0f5ee 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -643,49 +643,39 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { this.shellyLightCommandHandler(mbDevice, data.endpoint.number, device, 'Toggle', false); }); mbDevice.addCommandHandler('moveToLevel', async ({ request, endpoint }) => { - const state = child.getClusterServer(OnOffCluster)?.getOnOffAttribute(); - this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'Level', state, request.level); + this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'Level', undefined, request.level); }); mbDevice.addCommandHandler('moveToLevelWithOnOff', async ({ request, endpoint }) => { - const state = child.getClusterServer(OnOffCluster)?.getOnOffAttribute(); - this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'Level', state, request.level); + this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'Level', undefined, request.level); }); mbDevice.addCommandHandler('moveToHue', async ({ request, attributes, endpoint }) => { attributes.colorMode.setLocal(ColorControl.ColorMode.CurrentHueAndCurrentSaturation); - const state = child.getClusterServer(OnOffCluster)?.getOnOffAttribute(); - const level = child.getClusterServer(LevelControlCluster)?.getCurrentLevelAttribute(); const saturation = child.getClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation))?.getCurrentSaturationAttribute() ?? 0; const rgb = hslColorToRgbColor((request.hue / 254) * 360, (saturation / 254) * 100, 50); this.log.warn(`Sending command moveToHue => ColorRGB(${rgb.r}, ${rgb.g}, ${rgb.b})`); if (device.colorCommandTimeout) clearTimeout(device.colorCommandTimeout); device.colorCommandTimeout = setTimeout(() => { - this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'ColorRGB', state, level, { r: rgb.r, g: rgb.g, b: rgb.b }); + this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'ColorRGB', undefined, undefined, { r: rgb.r, g: rgb.g, b: rgb.b }); }, 500); }); mbDevice.addCommandHandler('moveToSaturation', async ({ request, attributes, endpoint }) => { attributes.colorMode.setLocal(ColorControl.ColorMode.CurrentHueAndCurrentSaturation); - const state = child.getClusterServer(OnOffCluster)?.getOnOffAttribute(); - const level = child.getClusterServer(LevelControlCluster)?.getCurrentLevelAttribute(); const hue = child.getClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation))?.getCurrentHueAttribute() ?? 0; const rgb = hslColorToRgbColor((hue / 254) * 360, (request.saturation / 254) * 100, 50); this.log.warn(`Sending command moveToSaturation => ColorRGB(${rgb.r}, ${rgb.g}, ${rgb.b})`); if (device.colorCommandTimeout) clearTimeout(device.colorCommandTimeout); device.colorCommandTimeout = setTimeout(() => { - this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'ColorRGB', state, level, { r: rgb.r, g: rgb.g, b: rgb.b }); + this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'ColorRGB', undefined, undefined, { r: rgb.r, g: rgb.g, b: rgb.b }); }, 500); }); mbDevice.addCommandHandler('moveToHueAndSaturation', async ({ request, attributes, endpoint }) => { attributes.colorMode.setLocal(ColorControl.ColorMode.CurrentHueAndCurrentSaturation); - const state = child.getClusterServer(OnOffCluster)?.getOnOffAttribute(); - const level = child.getClusterServer(LevelControlCluster)?.getCurrentLevelAttribute(); const rgb = hslColorToRgbColor((request.hue / 254) * 360, (request.saturation / 254) * 100, 50); - this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'ColorRGB', state, level, { r: rgb.r, g: rgb.g, b: rgb.b }); + this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'ColorRGB', undefined, undefined, { r: rgb.r, g: rgb.g, b: rgb.b }); }); mbDevice.addCommandHandler('moveToColorTemperature', async ({ request, attributes, endpoint }) => { attributes.colorMode.setLocal(ColorControl.ColorMode.ColorTemperatureMireds); - const state = child.getClusterServer(OnOffCluster)?.getOnOffAttribute(); - const level = child.getClusterServer(LevelControlCluster)?.getCurrentLevelAttribute(); - this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'ColorTemp', state, level, undefined, request.colorTemperatureMireds); + this.shellyLightCommandHandler(mbDevice, endpoint.number, device, 'ColorTemp', undefined, undefined, undefined, request.colorTemperatureMireds); }); // Add event handler from Shelly @@ -709,14 +699,28 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { // Add command handlers mbDevice.addCommandHandler('on', async (data) => { - this.shellyLightCommandHandler(mbDevice, data.endpoint.number, device, 'On', true); + this.shellySwitchCommandHandler(mbDevice, data.endpoint.number, device, 'On'); }); mbDevice.addCommandHandler('off', async (data) => { - this.shellyLightCommandHandler(mbDevice, data.endpoint.number, device, 'Off', false); + this.shellySwitchCommandHandler(mbDevice, data.endpoint.number, device, 'Off'); }); mbDevice.addCommandHandler('toggle', async (data) => { - this.shellyLightCommandHandler(mbDevice, data.endpoint.number, device, 'Toggle', false); + this.shellySwitchCommandHandler(mbDevice, data.endpoint.number, device, 'Toggle'); }); + if ('edge' in this.matterbridge && this.matterbridge.edge === true) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (child as any).addCommandHandler('on', async () => { + this.shellySwitchCommandHandler(mbDevice, child.number, device, 'On'); + }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (child as any).addCommandHandler('off', async () => { + this.shellySwitchCommandHandler(mbDevice, child.number, device, 'Off'); + }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (child as any).addCommandHandler('toggle', async () => { + this.shellySwitchCommandHandler(mbDevice, child.number, device, 'Toggle'); + }); + } // Add event handler switchComponent.on('update', (component: string, property: string, value: ShellyDataType) => { @@ -1405,11 +1409,6 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { const updateProperties = () => { for (const property of component.properties) { if (!['voltage', 'current', 'power', 'apower', 'act_power', 'total', 'aenergy'].includes(property.key)) continue; - /* - shelly.log.info( - `***Property ${property.key} value ${property.value !== null && typeof property.value === 'object' ? debugStringify(property.value as object) : property.value}${rs}`, - ); - */ this.shellyUpdateHandler(device, shelly, component.id, property.key, property.value); } }; @@ -1495,6 +1494,38 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { this.shellyDevices.set(device.id, device); } + private shellySwitchCommandHandler(matterbridgeDevice: MatterbridgeDevice, endpointNumber: EndpointNumber | undefined, shellyDevice: ShellyDevice, command: string): boolean { + // Get the matter endpoint + if (!endpointNumber) { + shellyDevice.log.error(`shellyCommandHandler error: endpointNumber undefined for shelly device ${dn}${shellyDevice?.id}${er}`); + return false; + } + const endpoint = matterbridgeDevice.getChildEndpoint(endpointNumber); + if (!endpoint) { + shellyDevice.log.error(`shellyCommandHandler error: endpoint not found for shelly device ${dn}${shellyDevice?.id}${er}`); + return false; + } + // Get the Shelly component + const componentName = endpoint.uniqueStorageKey; + if (!componentName) { + shellyDevice.log.error(`shellyCommandHandler error: componentName not found for endpoint ${endpointNumber} on shelly device ${dn}${shellyDevice?.id}${er}`); + return false; + } + const switchComponent = shellyDevice.getComponent(componentName) as ShellySwitchComponent; + if (!switchComponent) { + shellyDevice.log.error(`shellyCommandHandler error: component ${componentName} not found for shelly device ${dn}${shellyDevice?.id}${er}`); + return false; + } + + // Send On() Off() Toggle() command + if (command === 'On') switchComponent.On(); + else if (command === 'Off') switchComponent.Off(); + else if (command === 'Toggle') switchComponent.Toggle(); + if (command === 'On' || command === 'Off' || command === 'Toggle') + shellyDevice.log.info(`${db}Sent command ${hk}${componentName}${nf}:${command}()${db} to shelly device ${idn}${shellyDevice?.id}${rs}${db}`); + return true; + } + private shellyLightCommandHandler( matterbridgeDevice: MatterbridgeDevice, endpointNumber: EndpointNumber | undefined, @@ -1518,7 +1549,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { // Get the Shelly component const componentName = endpoint.uniqueStorageKey; if (!componentName) { - shellyDevice.log.error(`shellyCommandHandler error: componentName not found for shelly device ${dn}${shellyDevice?.id}${er}`); + shellyDevice.log.error(`shellyCommandHandler error: componentName not found for endpoint ${endpointNumber} on shelly device ${dn}${shellyDevice?.id}${er}`); return false; } const lightComponent = shellyDevice?.getComponent(componentName) as ShellyLightComponent; @@ -1526,6 +1557,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { shellyDevice.log.error(`shellyCommandHandler error: component ${componentName} not found for shelly device ${dn}${shellyDevice?.id}${er}`); return false; } + // Send On() Off() Toggle() command if (command === 'On') lightComponent.On(); else if (command === 'Off') lightComponent.Off(); @@ -1587,7 +1619,7 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { // Get the Shelly cover component const componentName = endpoint.uniqueStorageKey; if (!componentName) { - shellyDevice.log.error(`shellyCoverCommandHandler error: componentName not found for shelly device ${dn}${shellyDevice?.id}${er}`); + shellyDevice.log.error(`shellyCoverCommandHandler error: componentName not found for endpoint ${endpointNumber} on shelly device ${dn}${shellyDevice?.id}${er}`); return false; } const coverComponent = shellyDevice?.getComponent(componentName) as ShellyCoverComponent; @@ -1632,7 +1664,8 @@ export class ShellyPlatform extends MatterbridgeDynamicPlatform { value: ShellyDataType, endpointName?: string, ) { - const endpoint = matterbridgeDevice.getChildEndpointByName(endpointName ?? component); + let endpoint = matterbridgeDevice.getChildEndpointByName(endpointName ?? component); + if (!endpoint) endpoint = matterbridgeDevice.getChildEndpointByName(component.replace(':', '')); if (!endpoint) { shellyDevice.log.debug(`shellyUpdateHandler error: endpoint ${component} not found for shelly device ${dn}${shellyDevice?.id}${db}`); return; From f7256e3e3ed408dbc3c4679b31a51480ddde5620 Mon Sep 17 00:00:00 2001 From: Luligu Date: Wed, 20 Nov 2024 11:56:54 +0100 Subject: [PATCH 06/15] Update scanBTHomeComponents to the new BLU firmware 1.0.20 (model identification change from v1.0.18) --- CHANGELOG.md | 3 ++- package.json | 2 +- src/shellyDevice.ts | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69982af..7a76a40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge-shelly and sponsoring it. -## [1.0.10] - 2024-11-18 +## [1.0.10] - 2024-11-20 ### Added @@ -12,6 +12,7 @@ If you like this project and find it useful, please consider giving it a star on ### Changed +- [BTHome]: Update scanBTHomeComponents to the new BLU firmware 1.0.20 (model identification change from v1.0.18). - [log]: Show username and password with **** in logs. - [package]: Updated dependencies. diff --git a/package.json b/package.json index 8b219d1..792e093 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matterbridge-shelly", - "version": "1.0.10-dev.2", + "version": "1.0.10-dev.3", "description": "Matterbridge shelly plugin", "author": "https://github.com/Luligu", "license": "Apache-2.0", diff --git a/src/shellyDevice.ts b/src/shellyDevice.ts index a876226..1450aed 100644 --- a/src/shellyDevice.ts +++ b/src/shellyDevice.ts @@ -327,6 +327,15 @@ export class ShellyDevice extends EventEmitter { 'SBBT-004CUS': 'Shelly BLU RC Button 4', 'TRV': 'Shelly BLU Trv', }; + /* + From: https://shelly-api-docs.shelly.cloud/docs-ble/common + The shortened device name in advertising packet will be modified starting from FW v1.0.18 and will contain 4 digits of the mac address at the end: + SBBT-USxxxx, SBBT-EUxxxx + */ + if (model.startsWith('SBBT-2C')) return modelsMap['SBBT-002C']; + if (model.startsWith('SBDW-2C')) return modelsMap['SBDW-002C']; + if (model.startsWith('SBHT-3C')) return modelsMap['SBHT-003C']; + if (model.startsWith('SBMO-3Z')) return modelsMap['SBMO-003Z']; if (model.startsWith('SBBT-EU')) return modelsMap['SBBT-004CEU']; if (model.startsWith('SBBT-US')) return modelsMap['SBBT-004CUS']; return modelsMap[model] || `Unknown Shelly BLU model ${model}`; From db8250110c27aaf74d5709fa2eb949f94b5fc26b Mon Sep 17 00:00:00 2001 From: Luligu Date: Wed, 20 Nov 2024 12:00:54 +0100 Subject: [PATCH 07/15] Dev 1.0.10-dev.3 --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7de633d..f7f4eab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "matterbridge-shelly", - "version": "1.0.10-dev.2", + "version": "1.0.10-dev.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "matterbridge-shelly", - "version": "1.0.10-dev.2", + "version": "1.0.10-dev.3", "license": "Apache-2.0", "dependencies": { "coap": "1.4.0", @@ -22,7 +22,7 @@ "@types/eslint__js": "8.42.3", "@types/jest": "29.5.14", "@types/multicast-dns": "7.2.4", - "@types/node": "22.9.0", + "@types/node": "22.9.1", "@types/ws": "8.5.13", "eslint": "9.15.0", "eslint-config-prettier": "9.1.0", @@ -1572,9 +1572,9 @@ } }, "node_modules/@types/node": { - "version": "22.9.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz", - "integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==", + "version": "22.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz", + "integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==", "license": "MIT", "dependencies": { "undici-types": "~6.19.8" diff --git a/package.json b/package.json index 792e093..94d5824 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "@types/eslint__js": "8.42.3", "@types/jest": "29.5.14", "@types/multicast-dns": "7.2.4", - "@types/node": "22.9.0", + "@types/node": "22.9.1", "@types/ws": "8.5.13", "eslint": "9.15.0", "eslint-config-prettier": "9.1.0", From 8d541dc3dbeaa3b095ee1f0f80dcb563a8f1cc92 Mon Sep 17 00:00:00 2001 From: Luligu Date: Wed, 20 Nov 2024 12:16:30 +0100 Subject: [PATCH 08/15] Dev 1.0.10-dev.3 --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a76a40..75300b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ If you like this project and find it useful, please consider giving it a star on ### Changed -- [BTHome]: Update scanBTHomeComponents to the new BLU firmware 1.0.20 (model identification change from v1.0.18). +- [ShellyCommandHandler]: Refactor shellyCommandHandlers. +- [BTHome]: Update scanBTHomeComponents to the new BLU firmware 1.0.20 (model identification changes from v1.0.18). - [log]: Show username and password with **** in logs. - [package]: Updated dependencies. From 70b551aa078dae48600a81cfcbf1aa3e28eeee1e Mon Sep 17 00:00:00 2001 From: Luligu Date: Wed, 20 Nov 2024 12:27:40 +0100 Subject: [PATCH 09/15] Dev 1.0.10-dev.3 --- package-lock.json | 320 ---------------------------------------------- package.json | 3 +- 2 files changed, 1 insertion(+), 322 deletions(-) diff --git a/package-lock.json b/package-lock.json index f7f4eab..5a07692 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,6 @@ "eslint-plugin-prettier": "5.2.1", "jest": "29.7.0", "prettier": "3.3.3", - "rimraf": "^6.0.1", "ts-jest": "29.2.5", "typescript": "5.6.3", "typescript-eslint": "8.15.0" @@ -773,109 +772,6 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -2565,13 +2461,6 @@ "node": ">=6" } }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, - "license": "MIT" - }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -3158,36 +3047,6 @@ "dev": true, "license": "ISC" }, - "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "dev": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/foreground-child/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/formdata-polyfill": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", @@ -3639,22 +3498,6 @@ "node": ">=8" } }, - "node_modules/jackspeak": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", - "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/jake": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", @@ -4505,16 +4348,6 @@ "node": "*" } }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -4739,13 +4572,6 @@ "node": ">=6" } }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "dev": true, - "license": "BlueOak-1.0.0" - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -4815,33 +4641,6 @@ "dev": true, "license": "MIT" }, - "node_modules/path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/path-scurry/node_modules/lru-cache": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.2.tgz", - "integrity": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==", - "dev": true, - "license": "ISC", - "engines": { - "node": "20 || >=22" - } - }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -5184,76 +4983,6 @@ "node": ">=0.10.0" } }, - "node_modules/rimraf": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", - "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^11.0.0", - "package-json-from-dist": "^1.0.0" - }, - "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", - "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -5453,22 +5182,6 @@ "node": ">=8" } }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -5482,20 +5195,6 @@ "node": ">=8" } }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -5884,25 +5583,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index 94d5824..0275162 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "matterbridge:list": "matterbridge -list", "dev:link": "npm link matterbridge", "dev:unlink": "npm unlink matterbridge", - "install:dependencies": "npm install node-ansi-logger node-persist-manager coap multicast-dns node-fetch ws && npm install --save-dev rimraf @types/multicast-dns @types/ws", + "install:dependencies": "npm install node-ansi-logger node-persist-manager coap multicast-dns node-fetch ws && npm install --save-dev @types/multicast-dns @types/ws", "install:typescript": "npm install --save-dev typescript @types/node && npm run install && npm run build", "install:eslint": "npm install --save-dev eslint @eslint/js @types/eslint__js typescript typescript-eslint", "install:prettier": "npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier", @@ -120,7 +120,6 @@ "eslint-plugin-prettier": "5.2.1", "jest": "29.7.0", "prettier": "3.3.3", - "rimraf": "^6.0.1", "ts-jest": "29.2.5", "typescript": "5.6.3", "typescript-eslint": "8.15.0" From ae090edea191fc775fb66c5f2e65d8fe591c41b4 Mon Sep 17 00:00:00 2001 From: Luligu Date: Wed, 20 Nov 2024 17:08:32 +0100 Subject: [PATCH 10/15] Added Jest mock tests for shellyswitch25 switch and cover mode --- ....json => shellyswitch25-3494546BBF7E.json} | 74 ++++++----- .../shellyswitch25-3494546BBF7E.mdns.json | 27 +++- ....json => shellyswitch25-3494547BF36C.json} | 100 ++++++++------- .../shellyswitch25-3494547BF36C.mdns.json | 85 +++++++++++++ src/shellyDevice.mock.test.ts | 115 ++++++++++++++++++ src/shellyDevice.real.test.ts | 2 +- src/shellyDevice.realgen1.test.ts | 2 +- src/shellyDevice.realgen2.test.ts | 2 +- src/shellyDevice.realgen3.test.ts | 2 +- 9 files changed, 327 insertions(+), 82 deletions(-) rename src/mock/{shellyswitch25-3494546BBF7E.roller.json => shellyswitch25-3494546BBF7E.json} (87%) rename src/mock/{shellyswitch25-3494546BBF7E.relay.json => shellyswitch25-3494547BF36C.json} (80%) create mode 100644 src/mock/shellyswitch25-3494547BF36C.mdns.json diff --git a/src/mock/shellyswitch25-3494546BBF7E.roller.json b/src/mock/shellyswitch25-3494546BBF7E.json similarity index 87% rename from src/mock/shellyswitch25-3494546BBF7E.roller.json rename to src/mock/shellyswitch25-3494546BBF7E.json index 08afe83..2c6c1f7 100644 --- a/src/mock/shellyswitch25-3494546BBF7E.roller.json +++ b/src/mock/shellyswitch25-3494546BBF7E.json @@ -36,8 +36,8 @@ "dns": null }, "wifi_sta1": { - "enabled": false, - "ssid": null, + "enabled": true, + "ssid": "wifiAlbatros", "ipv4_method": "dhcp", "ip": null, "gw": null, @@ -45,7 +45,7 @@ "dns": null }, "ap_roaming": { - "enabled": true, + "enabled": false, "threshold": -70 }, "mqtt": { @@ -64,7 +64,7 @@ "coiot": { "enabled": true, "update_period": 15, - "peer": "192.168.1.189:5683" + "peer": "192.168.1.20:5683" }, "sntp": { "server": "time.google.com", @@ -76,7 +76,7 @@ "username": "admin" }, "pin_code": "", - "name": "My Shelly 2.5", + "name": "2.5 Gen1 Cover", "fw": "20230913-112234/v1.14.0-gcb84623", "factory_reset_from_switch": true, "pon_wifi_reset": false, @@ -94,11 +94,11 @@ "lat": null, "lng": null, "tzautodetect": true, - "tz_utc_offset": 7200, + "tz_utc_offset": 3600, "tz_dst": false, "tz_dst_auto": true, - "time": "09:26", - "unixtime": 1718609179, + "time": "16:26", + "unixtime": 1732116409, "led_status_disable": false, "debug_enable": false, "allow_cross_origin": false, @@ -168,7 +168,7 @@ "swap": false, "swap_inputs": false, "input_mode": "openclose", - "button_type": "toggle", + "button_type": "momentary", "btn_reverse": 0, "state": "stop", "power": 0, @@ -188,11 +188,11 @@ "positioning": true } ], - "favorites_enabled": false, + "favorites_enabled": true, "favorites": [ { "name": "Position 1", - "pos": 0 + "pos": 50 }, { "name": "Position 2", @@ -223,9 +223,9 @@ "mqtt": { "connected": false }, - "time": "09:26", - "unixtime": 1718609179, - "serial": 2689, + "time": "16:26", + "unixtime": 1732116409, + "serial": 207, "has_update": false, "mac": "3494546BBF7E", "cfg_changed_cnt": 0, @@ -235,14 +235,14 @@ "rollers": [ { "state": "stop", - "source": "input", + "source": "http", "power": 0, "is_valid": true, "safety_switch": false, "overtemperature": false, "stop_reason": "normal", "last_direction": "close", - "current_pos": 112, + "current_pos": 0, "calibrating": false, "positioning": true } @@ -252,17 +252,25 @@ "power": 0, "overpower": 0, "is_valid": true, - "timestamp": 1718616379, - "counters": [0, 0, 0], - "total": 0 + "timestamp": 1732120009, + "counters": [ + 0, + 0, + 0 + ], + "total": 2 }, { "power": 0, "overpower": 0, "is_valid": true, - "timestamp": 1718616379, - "counters": [0, 0, 0], - "total": 0 + "timestamp": 1732120009, + "counters": [ + 0, + 0, + 0 + ], + "total": 2 } ], "inputs": [ @@ -277,11 +285,11 @@ "event_cnt": 0 } ], - "temperature": 56.29, + "temperature": 54.9, "overtemperature": false, "tmp": { - "tC": 56.29, - "tF": 133.32, + "tC": 54.9, + "tF": 130.81, "is_valid": true }, "temperature_status": "Normal", @@ -293,10 +301,14 @@ "beta_version": "20231107-163214/v1.14.1-rc1-g0617c15" }, "ram_total": 50720, - "ram_free": 37668, + "ram_free": 37452, "fs_size": 233681, - "fs_free": 146082, - "voltage": 240.36, - "uptime": 122102 - } -} + "fs_free": 145831, + "voltage": 241.68, + "uptime": 9440 + }, + "components": [], + "cfg_rev": 0, + "offset": 0, + "total": 0 +} \ No newline at end of file diff --git a/src/mock/shellyswitch25-3494546BBF7E.mdns.json b/src/mock/shellyswitch25-3494546BBF7E.mdns.json index 1c5df23..2dee4bb 100644 --- a/src/mock/shellyswitch25-3494546BBF7E.mdns.json +++ b/src/mock/shellyswitch25-3494546BBF7E.mdns.json @@ -1,19 +1,27 @@ { "id": 0, "type": "response", - "flags": 1024, + "flags": 1152, "flag_qr": true, "opcode": "QUERY", "flag_aa": true, "flag_tc": false, "flag_rd": false, - "flag_ra": false, + "flag_ra": true, "flag_z": false, "flag_ad": false, "flag_cd": false, "rcode": "NOERROR", "questions": [], "answers": [ + { + "name": "_services._dns-sd._udp.local", + "type": "PTR", + "ttl": 4500, + "class": "IN", + "flush": false, + "data": "_http._tcp.local" + }, { "name": "_http._tcp.local", "type": "PTR", @@ -41,7 +49,14 @@ "ttl": 120, "class": "IN", "flush": true, - "data": ["id=shellyswitch25-3494546BBF7E", "arch=esp8266", "app=switch25", "fw_version=1.0", "fw_id=20230913-112234/v1.14.0-gcb84623", "discoverable=false"] + "data": [ + "id=shellyswitch25-3494546BBF7E", + "arch=esp8266", + "app=switch25", + "fw_version=1.0", + "fw_id=20230913-112234/v1.14.0-gcb84623", + "discoverable=false" + ] }, { "name": "shellyswitch25-3494546BBF7E.local", @@ -59,10 +74,12 @@ "flush": true, "data": { "nextDomain": "shellyswitch25-3494546BBF7E.local", - "rrtypes": ["A"] + "rrtypes": [ + "A" + ] } } ], "authorities": [], "additionals": [] -} +} \ No newline at end of file diff --git a/src/mock/shellyswitch25-3494546BBF7E.relay.json b/src/mock/shellyswitch25-3494547BF36C.json similarity index 80% rename from src/mock/shellyswitch25-3494546BBF7E.relay.json rename to src/mock/shellyswitch25-3494547BF36C.json index d073214..9a3be6c 100644 --- a/src/mock/shellyswitch25-3494546BBF7E.relay.json +++ b/src/mock/shellyswitch25-3494547BF36C.json @@ -1,7 +1,7 @@ { "shelly": { "type": "SHSW-25", - "mac": "3494546BBF7E", + "mac": "3494547BF36C", "auth": false, "fw": "20230913-112234/v1.14.0-gcb84623", "discoverable": false, @@ -14,8 +14,8 @@ "settings": { "device": { "type": "SHSW-25", - "mac": "3494546BBF7E", - "hostname": "shellyswitch25-3494546BBF7E", + "mac": "3494547BF36C", + "hostname": "shellyswitch25-3494547BF36C", "num_outputs": 2, "num_meters": 2, "num_rollers": 1, @@ -23,7 +23,7 @@ }, "wifi_ap": { "enabled": false, - "ssid": "shellyswitch25-3494546BBF7E", + "ssid": "shellyswitch25-3494547BF36C", "key": "" }, "wifi_sta": { @@ -36,8 +36,8 @@ "dns": null }, "wifi_sta1": { - "enabled": false, - "ssid": null, + "enabled": true, + "ssid": "wifiAlbatros", "ipv4_method": "dhcp", "ip": null, "gw": null, @@ -45,14 +45,14 @@ "dns": null }, "ap_roaming": { - "enabled": true, + "enabled": false, "threshold": -70 }, "mqtt": { "enable": false, "server": "192.168.33.3:1883", "user": "", - "id": "shellyswitch25-3494546BBF7E", + "id": "shellyswitch25-3494547BF36C", "reconnect_timeout_max": 60, "reconnect_timeout_min": 2, "clean_session": true, @@ -64,7 +64,7 @@ "coiot": { "enabled": true, "update_period": 15, - "peer": "192.168.1.189:5683" + "peer": "192.168.1.20:5683" }, "sntp": { "server": "time.google.com", @@ -76,7 +76,7 @@ "username": "admin" }, "pin_code": "", - "name": "My Shelly 2.5", + "name": "2.5 Gen1 Relay", "fw": "20230913-112234/v1.14.0-gcb84623", "factory_reset_from_switch": true, "pon_wifi_reset": false, @@ -88,14 +88,17 @@ }, "cloud": { "enabled": true, - "connected": false + "connected": true }, + "timezone": null, + "lat": null, + "lng": null, "tzautodetect": true, - "tz_utc_offset": 7200, + "tz_utc_offset": 3600, "tz_dst": false, "tz_dst_auto": true, - "time": "18:29", - "unixtime": 1718987375, + "time": "16:32", + "unixtime": 1732116720, "led_status_disable": false, "debug_enable": false, "allow_cross_origin": false, @@ -132,8 +135,8 @@ "appliance_type": "General", "ison": false, "has_timer": false, - "default_state": "last", - "btn_type": "momentary", + "default_state": "switch", + "btn_type": "toggle", "btn_reverse": 0, "auto_on": 0, "auto_off": 0, @@ -146,8 +149,8 @@ "appliance_type": "General", "ison": false, "has_timer": false, - "default_state": "last", - "btn_type": "momentary", + "default_state": "switch", + "btn_type": "toggle", "btn_reverse": 0, "auto_on": 0, "auto_off": 0, @@ -165,7 +168,7 @@ "swap": false, "swap_inputs": false, "input_mode": "openclose", - "button_type": "toggle", + "button_type": "momentary", "btn_reverse": 0, "state": "stop", "power": 0, @@ -210,21 +213,21 @@ "wifi_sta": { "connected": true, "ssid": "FibreBox_X6-12A4C7", - "ip": "192.168.1.222", - "rssi": -51 + "ip": "192.168.1.236", + "rssi": -62 }, "cloud": { "enabled": true, - "connected": false + "connected": true }, "mqtt": { "connected": false }, - "time": "18:29", - "unixtime": 1718987375, - "serial": 2, + "time": "16:32", + "unixtime": 1732116720, + "serial": 4, "has_update": false, - "mac": "3494546BBF7E", + "mac": "3494547BF36C", "cfg_changed_cnt": 0, "actions_stats": { "skipped": 0 @@ -258,16 +261,24 @@ "power": 0, "overpower": 0, "is_valid": true, - "timestamp": 1718994575, - "counters": [0, 0, 0], + "timestamp": 1732120320, + "counters": [ + 0, + 0, + 0 + ], "total": 0 }, { "power": 0, "overpower": 0, "is_valid": true, - "timestamp": 1718994575, - "counters": [0, 0, 0], + "timestamp": 1732120320, + "counters": [ + 0, + 0, + 0 + ], "total": 0 } ], @@ -283,25 +294,30 @@ "event_cnt": 0 } ], - "temperature": 56.18, + "temperature": 56.07, "overtemperature": false, "tmp": { - "tC": 56.18, - "tF": 133.12, + "tC": 56.07, + "tF": 132.93, "is_valid": true }, "temperature_status": "Normal", "update": { - "status": "unknown", + "status": "idle", "has_update": false, - "new_version": "", - "old_version": "20230913-112234/v1.14.0-gcb84623" + "new_version": "20230913-112234/v1.14.0-gcb84623", + "old_version": "20230913-112234/v1.14.0-gcb84623", + "beta_version": "20231107-163214/v1.14.1-rc1-g0617c15" }, "ram_total": 50720, - "ram_free": 37864, + "ram_free": 37416, "fs_size": 233681, - "fs_free": 146082, - "voltage": 240.93, - "uptime": 26 - } -} + "fs_free": 146333, + "voltage": 239.3, + "uptime": 104 + }, + "components": [], + "cfg_rev": 0, + "offset": 0, + "total": 0 +} \ No newline at end of file diff --git a/src/mock/shellyswitch25-3494547BF36C.mdns.json b/src/mock/shellyswitch25-3494547BF36C.mdns.json new file mode 100644 index 0000000..f516465 --- /dev/null +++ b/src/mock/shellyswitch25-3494547BF36C.mdns.json @@ -0,0 +1,85 @@ +{ + "id": 0, + "type": "response", + "flags": 1152, + "flag_qr": true, + "opcode": "QUERY", + "flag_aa": true, + "flag_tc": false, + "flag_rd": false, + "flag_ra": true, + "flag_z": false, + "flag_ad": false, + "flag_cd": false, + "rcode": "NOERROR", + "questions": [], + "answers": [ + { + "name": "_services._dns-sd._udp.local", + "type": "PTR", + "ttl": 4500, + "class": "IN", + "flush": false, + "data": "_http._tcp.local" + }, + { + "name": "_http._tcp.local", + "type": "PTR", + "ttl": 4500, + "class": "IN", + "flush": false, + "data": "shellyswitch25-3494547BF36C._http._tcp.local" + }, + { + "name": "shellyswitch25-3494547BF36C._http._tcp.local", + "type": "SRV", + "ttl": 120, + "class": "IN", + "flush": true, + "data": { + "priority": 0, + "weight": 0, + "port": 80, + "target": "shellyswitch25-3494547BF36C.local" + } + }, + { + "name": "shellyswitch25-3494547BF36C._http._tcp.local", + "type": "TXT", + "ttl": 120, + "class": "IN", + "flush": true, + "data": [ + "id=shellyswitch25-3494547BF36C", + "arch=esp8266", + "app=switch25", + "fw_version=1.0", + "fw_id=20230913-112234/v1.14.0-gcb84623", + "discoverable=false" + ] + }, + { + "name": "shellyswitch25-3494547BF36C.local", + "type": "A", + "ttl": 120, + "class": "IN", + "flush": true, + "data": "192.168.1.236" + }, + { + "name": "shellyswitch25-3494547BF36C.local", + "type": "NSEC", + "ttl": 120, + "class": "IN", + "flush": true, + "data": { + "nextDomain": "shellyswitch25-3494547BF36C.local", + "rrtypes": [ + "A" + ] + } + } + ], + "authorities": [], + "additionals": [] +} \ No newline at end of file diff --git a/src/shellyDevice.mock.test.ts b/src/shellyDevice.mock.test.ts index 4a51636..bb7b5fd 100644 --- a/src/shellyDevice.mock.test.ts +++ b/src/shellyDevice.mock.test.ts @@ -1022,6 +1022,121 @@ describe('Shelly devices test', () => { if (device) device.destroy(); }); + + test('Create a gen 1 shellyswitch25-3494547BF36C device relay mode', async () => { + id = 'shellyswitch25-3494547BF36C'; + log.logName = id; + + device = await ShellyDevice.create(shelly, log, path.join('src', 'mock', id + '.json')); + expect(device).not.toBeUndefined(); + if (!device) return; + expect(device.host).toBe(path.join('src', 'mock', id + '.json')); + expect(device.model).toBe('SHSW-25'); + expect(device.mac).toBe('3494547BF36C'); + expect(device.id).toBe(id); + expect(device.firmware).toBe(firmwareGen1); + expect(device.auth).toBe(false); + expect(device.gen).toBe(1); + expect(device.profile).toBe('switch'); + expect(device.name).toBe('2.5 Gen1 Relay'); + expect(device.hasUpdate).toBe(false); + expect(device.lastseen).not.toBe(0); + expect(device.online).toBe(true); + expect(device.cached).toBe(false); + expect(device.sleepMode).toBe(false); + + expect(device.components.length).toBe(14); + expect(device.getComponentNames()).toStrictEqual(['WiFi', 'MQTT', 'CoIoT', 'Sntp', 'Cloud', 'Relay', 'PowerMeter', 'Input', 'Sys']); + expect(device.getComponentIds()).toStrictEqual([ + 'wifi_ap', + 'wifi_sta', + 'wifi_sta1', + 'mqtt', + 'coiot', + 'sntp', + 'cloud', + 'relay:0', + 'relay:1', + 'meter:0', + 'meter:1', + 'input:0', + 'input:1', + 'sys', + ]); + + expect(device.getComponent('sys')?.getValue('temperature')).toBe(56.07); + expect(device.getComponent('sys')?.getValue('overtemperature')).toBe(false); + + expect(device.getComponent('relay:0')?.hasProperty('state')).toBe(true); + expect(device.getComponent('relay:0')?.hasProperty('ison')).toBe(true); + expect(device.getComponent('relay:0')?.hasProperty('gain')).toBe(false); + expect(device.getComponent('relay:0')?.hasProperty('brightness')).toBe(false); + expect(device.getComponent('relay:0')?.getValue('mode')).toBe(undefined); + + expect(device.getComponent('relay:1')?.hasProperty('state')).toBe(true); + expect(device.getComponent('relay:1')?.hasProperty('ison')).toBe(true); + expect(device.getComponent('relay:1')?.hasProperty('gain')).toBe(false); + expect(device.getComponent('relay:1')?.hasProperty('brightness')).toBe(false); + expect(device.getComponent('relay:1')?.getValue('mode')).toBe(undefined); + + expect(device.getComponent('meter:0')?.hasProperty('voltage')).toBe(false); + expect(device.getComponent('meter:0')?.hasProperty('current')).toBe(false); + expect(device.getComponent('meter:0')?.hasProperty('power')).toBe(true); + expect(device.getComponent('meter:0')?.hasProperty('total')).toBe(true); + + expect(device.getComponent('meter:1')?.hasProperty('voltage')).toBe(false); + expect(device.getComponent('meter:1')?.hasProperty('current')).toBe(false); + expect(device.getComponent('meter:1')?.hasProperty('power')).toBe(true); + expect(device.getComponent('meter:1')?.hasProperty('total')).toBe(true); + + expect(await device.fetchUpdate()).not.toBeNull(); + + if (device) device.destroy(); + }); + + test('Create a gen 1 shellyswitch25-3494546BBF7E device roller mode', async () => { + id = 'shellyswitch25-3494546BBF7E'; + log.logName = id; + + device = await ShellyDevice.create(shelly, log, path.join('src', 'mock', id + '.json')); + expect(device).not.toBeUndefined(); + if (!device) return; + expect(device.host).toBe(path.join('src', 'mock', id + '.json')); + expect(device.model).toBe('SHSW-25'); + expect(device.mac).toBe('3494546BBF7E'); + expect(device.id).toBe(id); + expect(device.firmware).toBe(firmwareGen1); + expect(device.auth).toBe(false); + expect(device.gen).toBe(1); + expect(device.profile).toBe('cover'); + expect(device.name).toBe('2.5 Gen1 Cover'); + expect(device.hasUpdate).toBe(false); + expect(device.lastseen).not.toBe(0); + expect(device.online).toBe(true); + expect(device.cached).toBe(false); + expect(device.sleepMode).toBe(false); + + expect(device.components.length).toBe(12); + expect(device.getComponentNames()).toStrictEqual(['WiFi', 'MQTT', 'CoIoT', 'Sntp', 'Cloud', 'Roller', 'PowerMeter', 'Input', 'Sys']); + expect(device.getComponentIds()).toStrictEqual(['wifi_ap', 'wifi_sta', 'wifi_sta1', 'mqtt', 'coiot', 'sntp', 'cloud', 'roller:0', 'meter:0', 'input:0', 'input:1', 'sys']); + + expect(device.getComponent('sys')?.getValue('temperature')).toBe(54.9); + expect(device.getComponent('sys')?.getValue('overtemperature')).toBe(false); + + expect(device.getComponent('roller:0')?.hasProperty('state')).toBe(true); + expect(device.getComponent('roller:0')?.hasProperty('current_pos')).toBe(true); + expect(device.getComponent('roller:0')?.hasProperty('source')).toBe(true); + expect(device.getComponent('roller:0')?.hasProperty('last_direction')).toBe(true); + + expect(device.getComponent('meter:0')?.hasProperty('voltage')).toBe(false); + expect(device.getComponent('meter:0')?.hasProperty('current')).toBe(false); + expect(device.getComponent('meter:0')?.hasProperty('power')).toBe(true); + expect(device.getComponent('meter:0')?.hasProperty('total')).toBe(true); + + expect(await device.fetchUpdate()).not.toBeNull(); + + if (device) device.destroy(); + }); }); describe('Test all gen 2 devices', () => { diff --git a/src/shellyDevice.real.test.ts b/src/shellyDevice.real.test.ts index 6896bcd..9a977ed 100644 --- a/src/shellyDevice.real.test.ts +++ b/src/shellyDevice.real.test.ts @@ -16,7 +16,7 @@ describe('Shellies', () => { const firmwareGen1 = 'v1.14.0-gcb84623'; const firmwareGen2 = '1.4.4-g6d2a586'; - const address = '30:f6:ef:69:2b:c5'; + const address = 'c4:cb:76:b3:cd:1f'; beforeAll(async () => { consoleLogSpy = jest.spyOn(console, 'log').mockImplementation((...args: any[]) => { diff --git a/src/shellyDevice.realgen1.test.ts b/src/shellyDevice.realgen1.test.ts index 6e62323..19f324c 100644 --- a/src/shellyDevice.realgen1.test.ts +++ b/src/shellyDevice.realgen1.test.ts @@ -16,7 +16,7 @@ describe('Shellies', () => { let device: ShellyDevice | undefined; const firmwareGen1 = 'v1.14.0-gcb84623'; - const address = '30:f6:ef:69:2b:c5'; + const address = 'c4:cb:76:b3:cd:1f'; beforeAll(async () => { consoleLogSpy = jest.spyOn(console, 'log').mockImplementation((...args: any[]) => { diff --git a/src/shellyDevice.realgen2.test.ts b/src/shellyDevice.realgen2.test.ts index 4fe92a9..156497f 100644 --- a/src/shellyDevice.realgen2.test.ts +++ b/src/shellyDevice.realgen2.test.ts @@ -15,7 +15,7 @@ describe('Shellies', () => { let device: ShellyDevice | undefined; const firmwareGen2 = '1.4.4-g6d2a586'; - const address = '30:f6:ef:69:2b:c5'; + const address = 'c4:cb:76:b3:cd:1f'; beforeAll(async () => { consoleLogSpy = jest.spyOn(console, 'log').mockImplementation((...args: any[]) => { diff --git a/src/shellyDevice.realgen3.test.ts b/src/shellyDevice.realgen3.test.ts index 2bd5c2d..d0c9564 100644 --- a/src/shellyDevice.realgen3.test.ts +++ b/src/shellyDevice.realgen3.test.ts @@ -16,7 +16,7 @@ describe('Shellies', () => { let device: ShellyDevice | undefined; const firmwareGen2 = '1.4.4-g6d2a586'; - const address = '30:f6:ef:69:2b:c5'; + const address = 'c4:cb:76:b3:cd:1f'; beforeAll(async () => { consoleLogSpy = jest.spyOn(console, 'log').mockImplementation((...args: any[]) => { From bcafa89a234c2feba2ee59643f38e71d3606df2f Mon Sep 17 00:00:00 2001 From: Luligu Date: Wed, 20 Nov 2024 17:36:10 +0100 Subject: [PATCH 11/15] Refactor Jest mock tests for Gen3 devices --- src/mock/shelly1g3-34B7DACAC830.json | 257 +------ src/mock/shelly1g3-34B7DACAC830.mdns.json | 59 +- src/mock/shelly1minig3-543204547478.json | 335 ++++++++- src/mock/shelly1minig3-543204547478.mdns.json | 57 -- src/mock/shelly1pmg3-34B7DAC68344.json | 388 ++++++----- src/mock/shelly1pmg3-34B7DAC68344.mdns.json | 59 +- src/mock/shelly2pmg3-34CDB0770C4C.json | 640 ++++++++++++++++++ src/mock/shelly2pmg3-34CDB0770C4C.mdns.json | 59 +- src/mock/shellyblugwg3-34CDB077BCD4.json | 536 +++++++++++---- src/mock/shellyblugwg3-34CDB077BCD4.mdns.json | 59 +- src/mock/shellyddimmerg3-84FCE636832C.json | 56 +- .../shellyddimmerg3-84FCE636832C.mdns.json | 43 +- src/mock/shellyemg3-84FCE636582C.json | 62 +- src/mock/shellyemg3-84FCE636582C.mdns.json | 98 +-- src/mock/shellyi4g3-5432045661B4.json | 241 +------ src/mock/shellyi4g3-5432045661B4.mdns.json | 59 +- src/shellyDevice.mock.test.ts | 105 ++- 17 files changed, 1833 insertions(+), 1280 deletions(-) create mode 100644 src/mock/shelly2pmg3-34CDB0770C4C.json diff --git a/src/mock/shelly1g3-34B7DACAC830.json b/src/mock/shelly1g3-34B7DACAC830.json index 354ff33..a8dc67a 100644 --- a/src/mock/shelly1g3-34B7DACAC830.json +++ b/src/mock/shelly1g3-34B7DACAC830.json @@ -1,13 +1,13 @@ { "shelly": { - "name": "My Shelly 1 Gen3", + "name": "1 Gen3", "id": "shelly1g3-34b7dacac830", "mac": "34B7DACAC830", - "slot": 1, + "slot": 0, "model": "S3SW-001X16EU", "gen": 3, - "fw_id": "20240819-074630/1.4.2-gc2639da", - "ver": "1.4.2", + "fw_id": "20241011-114449/1.4.4-g6d2a586", + "ver": "1.4.4", "app": "S1G3", "auth_en": false, "auth_domain": null @@ -57,7 +57,7 @@ }, "switch:0": { "id": 0, - "name": null, + "name": "1 Gen3", "in_mode": "follow", "initial_state": "match_input", "auto_on": false, @@ -67,9 +67,9 @@ }, "sys": { "device": { - "name": "My Shelly 1 Gen3", + "name": "1 Gen3", "mac": "34B7DACAC830", - "fw_id": "20240819-074630/1.4.2-gc2639da", + "fw_id": "20241011-114449/1.4.4-g6d2a586", "discoverable": true, "eco_mode": false, "addon_type": null @@ -96,7 +96,7 @@ "sntp": { "server": "time.google.com" }, - "cfg_rev": 14 + "cfg_rev": 18 }, "wifi": { "ap": { @@ -118,9 +118,9 @@ "nameserver": null }, "sta1": { - "ssid": null, - "is_open": true, - "enable": false, + "ssid": "wifiAlbatros", + "is_open": false, + "enable": true, "ipv4mode": "dhcp", "ip": null, "netmask": null, @@ -141,7 +141,9 @@ "status": { "ble": {}, "bthome": { - "errors": ["bluetooth_disabled"] + "errors": [ + "bluetooth_disabled" + ] }, "cloud": { "connected": true @@ -156,237 +158,42 @@ }, "switch:0": { "id": 0, - "source": "WS_in", + "source": "init", "output": false, "temperature": { - "tC": 45.5, - "tF": 113.9 + "tC": 51.9, + "tF": 125.4 } }, "sys": { "mac": "34B7DACAC830", "restart_required": false, - "time": "23:21", - "unixtime": 1725744078, - "uptime": 194, - "ram_size": 259336, - "ram_free": 134980, + "time": "16:51", + "unixtime": 1732117867, + "uptime": 1199, + "ram_size": 259180, + "ram_free": 131496, "fs_size": 1048576, - "fs_free": 589824, - "cfg_rev": 14, + "fs_free": 585728, + "cfg_rev": 18, "kvs_rev": 0, - "schedule_rev": 0, + "schedule_rev": 1, "webhook_rev": 0, "available_updates": {}, - "reset_reason": 3 + "reset_reason": 1 }, "wifi": { "sta_ip": "192.168.1.157", "status": "got ip", "ssid": "FibreBox_X6-12A4C7", - "rssi": -61 + "rssi": -51 }, "ws": { "connected": false } }, - "components": [ - { - "key": "ble", - "status": {}, - "config": { - "enable": false, - "rpc": { - "enable": true - }, - "observer": { - "enable": false - } - } - }, - { - "key": "bthome", - "status": { - "errors": ["bluetooth_disabled"] - }, - "config": {} - }, - { - "key": "cloud", - "status": { - "connected": true - }, - "config": { - "enable": true, - "server": "shelly-103-eu.shelly.cloud:6022/jrpc" - } - }, - { - "key": "input:0", - "status": { - "id": 0, - "state": false - }, - "config": { - "id": 0, - "name": null, - "type": "switch", - "enable": true, - "invert": false, - "factory_reset": true - } - }, - { - "key": "knx", - "status": {}, - "config": { - "enable": false, - "ia": "15.15.255", - "routing": { - "addr": "224.0.23.12:3671" - } - } - }, - { - "key": "mqtt", - "status": { - "connected": false - }, - "config": { - "enable": false, - "server": null, - "client_id": "shelly1g3-34b7dacac830", - "user": null, - "ssl_ca": null, - "topic_prefix": "shelly1g3-34b7dacac830", - "rpc_ntf": true, - "status_ntf": false, - "use_client_cert": false, - "enable_rpc": true, - "enable_control": true - } - }, - { - "key": "switch:0", - "status": { - "id": 0, - "source": "WS_in", - "output": false, - "temperature": { - "tC": 45.5, - "tF": 113.9 - } - }, - "config": { - "id": 0, - "name": null, - "in_mode": "follow", - "initial_state": "match_input", - "auto_on": false, - "auto_on_delay": 60, - "auto_off": false, - "auto_off_delay": 60 - } - }, - { - "key": "sys", - "status": { - "mac": "34B7DACAC830", - "restart_required": false, - "time": "23:21", - "unixtime": 1725744079, - "uptime": 194, - "ram_size": 259328, - "ram_free": 133180, - "fs_size": 1048576, - "fs_free": 589824, - "cfg_rev": 14, - "kvs_rev": 0, - "schedule_rev": 0, - "webhook_rev": 0, - "available_updates": {}, - "reset_reason": 3 - }, - "config": { - "device": { - "name": "My Shelly 1 Gen3", - "mac": "34B7DACAC830", - "fw_id": "20240819-074630/1.4.2-gc2639da", - "discoverable": true, - "eco_mode": false, - "addon_type": null - }, - "location": { - "tz": "Europe/Monaco", - "lat": 43.7314, - "lon": 7.419 - }, - "debug": { - "level": 2, - "file_level": null, - "mqtt": { - "enable": false - }, - "websocket": { - "enable": false - }, - "udp": { - "addr": null - } - }, - "ui_data": {}, - "rpc_udp": { - "dst_addr": null, - "listen_port": null - }, - "sntp": { - "server": "time.google.com" - }, - "cfg_rev": 14 - } - }, - { - "key": "wifi", - "status": { - "sta_ip": "192.168.1.157", - "status": "got ip", - "ssid": "FibreBox_X6-12A4C7", - "rssi": -61 - }, - "config": { - "ap": { - "ssid": "Shelly1G3-34B7DACAC830", - "is_open": true, - "enable": false, - "range_extender": { - "enable": false - } - }, - "sta": { - "ssid": "FibreBox_X6-12A4C7", - "is_open": false, - "enable": true, - "ipv4mode": "dhcp", - "ip": null, - "netmask": null, - "gw": null, - "nameserver": null - }, - "sta1": { - "ssid": null, - "is_open": true, - "enable": false, - "ipv4mode": "dhcp", - "ip": null, - "netmask": null, - "gw": null, - "nameserver": null - }, - "roam": { - "rssi_thr": -80, - "interval": 60 - } - } - } - ] -} + "components": [], + "cfg_rev": 18, + "offset": 0, + "total": 0 +} \ No newline at end of file diff --git a/src/mock/shelly1g3-34B7DACAC830.mdns.json b/src/mock/shelly1g3-34B7DACAC830.mdns.json index de9db39..bb69f0f 100644 --- a/src/mock/shelly1g3-34B7DACAC830.mdns.json +++ b/src/mock/shelly1g3-34B7DACAC830.mdns.json @@ -21,30 +21,6 @@ "class": "IN", "flush": false, "data": "shelly1g3-34b7dacac830._http._tcp.local" - }, - { - "name": "_shelly._tcp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "shelly1g3-34b7dacac830._shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_http._tcp.local" } ], "authorities": [], @@ -68,36 +44,9 @@ "ttl": 120, "class": "IN", "flush": false, - "data": ["gen=3"] - }, - { - "name": "Shelly1G3-34B7DACAC830.local", - "type": "A", - "ttl": 120, - "class": "IN", - "flush": true, - "data": "192.168.1.157" - }, - { - "name": "shelly1g3-34b7dacac830._shelly._tcp.local", - "type": "SRV", - "ttl": 120, - "class": "IN", - "flush": false, - "data": { - "priority": 0, - "weight": 0, - "port": 80, - "target": "Shelly1G3-34B7DACAC830.local" - } - }, - { - "name": "shelly1g3-34b7dacac830._shelly._tcp.local", - "type": "TXT", - "ttl": 120, - "class": "IN", - "flush": false, - "data": ["gen=3", "app=S1G3", "ver=1.4.2"] + "data": [ + "gen=3" + ] }, { "name": "Shelly1G3-34B7DACAC830.local", @@ -108,4 +57,4 @@ "data": "192.168.1.157" } ] -} +} \ No newline at end of file diff --git a/src/mock/shelly1minig3-543204547478.json b/src/mock/shelly1minig3-543204547478.json index 1618b1d..90184c6 100644 --- a/src/mock/shelly1minig3-543204547478.json +++ b/src/mock/shelly1minig3-543204547478.json @@ -14,12 +14,12 @@ }, "settings": { "ble": { - "enable": false, + "enable": true, "rpc": { "enable": true }, "observer": { - "enable": false + "enable": true } }, "bthome": {}, @@ -95,7 +95,7 @@ "sntp": { "server": "time.google.com" }, - "cfg_rev": 29 + "cfg_rev": 52 }, "wifi": { "ap": { @@ -139,11 +139,7 @@ }, "status": { "ble": {}, - "bthome": { - "errors": [ - "bluetooth_disabled" - ] - }, + "bthome": {}, "cloud": { "connected": true }, @@ -157,24 +153,24 @@ }, "switch:0": { "id": 0, - "source": "HTTP_in", + "source": "init", "output": false, "temperature": { - "tC": 64.4, - "tF": 148 + "tC": 63, + "tF": 145.4 } }, "sys": { "mac": "543204547478", "restart_required": false, - "time": "16:29", - "unixtime": 1730474961, - "uptime": 172140, - "ram_size": 259964, - "ram_free": 127820, + "time": "16:56", + "unixtime": 1732118218, + "uptime": 1568, + "ram_size": 259252, + "ram_free": 81056, "fs_size": 1048576, - "fs_free": 593920, - "cfg_rev": 29, + "fs_free": 585728, + "cfg_rev": 52, "kvs_rev": 8, "schedule_rev": 1, "webhook_rev": 0, @@ -191,8 +187,305 @@ "connected": false } }, - "components": [], - "cfg_rev": 29, + "components": [ + { + "key": "bthomedevice:200", + "status": { + "id": 200, + "rssi": null, + "battery": null, + "packet_id": null, + "last_updated_ts": 0 + }, + "config": { + "id": 200, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBDW-2Cd77b" + } + } + } + }, + { + "key": "bthomedevice:201", + "status": { + "id": 201, + "rssi": null, + "battery": null, + "packet_id": null, + "last_updated_ts": 0 + }, + "config": { + "id": 201, + "addr": "38:39:8f:8b:d2:29", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBBT-2Cd229", + "icon": null + } + } + } + }, + { + "key": "bthomedevice:202", + "status": { + "id": 202, + "rssi": -60, + "battery": 100, + "packet_id": 108, + "last_updated_ts": 1732118213 + }, + "config": { + "id": 202, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBHT-3C2d87", + "icon": null + } + } + } + }, + { + "key": "bthomedevice:203", + "status": { + "id": 203, + "rssi": null, + "battery": null, + "packet_id": null, + "last_updated_ts": 0 + }, + "config": { + "id": 203, + "addr": "0c:ae:5f:5a:0b:fa", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBMO-003Z", + "icon": null + } + } + } + }, + { + "key": "bthomesensor:200", + "status": { + "id": 200, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 200, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:201", + "status": { + "id": 201, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 201, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 5, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:202", + "status": { + "id": 202, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 202, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 45, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:203", + "status": { + "id": 203, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 203, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 63, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:204", + "status": { + "id": 204, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 204, + "addr": "38:39:8f:8b:d2:29", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:205", + "status": { + "id": 205, + "last_updated_ts": 1070221648 + }, + "config": { + "id": 205, + "addr": "38:39:8f:8b:d2:29", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:206", + "status": { + "id": 206, + "value": 100, + "last_updated_ts": 1732118213 + }, + "config": { + "id": 206, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:207", + "status": { + "id": 207, + "value": 26, + "last_updated_ts": 1732118213 + }, + "config": { + "id": 207, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 46, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:208", + "status": { + "id": 208, + "last_updated_ts": 1070221648 + }, + "config": { + "id": 208, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:209", + "status": { + "id": 209, + "value": 22.6, + "last_updated_ts": 1732118213 + }, + "config": { + "id": 209, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 69, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:210", + "status": { + "id": 210, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 210, + "addr": "0c:ae:5f:5a:0b:fa", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:211", + "status": { + "id": 211, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 211, + "addr": "0c:ae:5f:5a:0b:fa", + "name": null, + "obj_id": 33, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:212", + "status": { + "id": 212, + "last_updated_ts": 1070221648 + }, + "config": { + "id": 212, + "addr": "0c:ae:5f:5a:0b:fa", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null + } + } + ], + "cfg_rev": 52, "offset": 0, - "total": 0 + "total": 17 } \ No newline at end of file diff --git a/src/mock/shelly1minig3-543204547478.mdns.json b/src/mock/shelly1minig3-543204547478.mdns.json index 50c5d34..e87c2bd 100644 --- a/src/mock/shelly1minig3-543204547478.mdns.json +++ b/src/mock/shelly1minig3-543204547478.mdns.json @@ -21,30 +21,6 @@ "class": "IN", "flush": false, "data": "shelly1minig3-543204547478._http._tcp.local" - }, - { - "name": "_shelly._tcp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "shelly1minig3-543204547478._shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_http._tcp.local" } ], "authorities": [], @@ -72,39 +48,6 @@ "gen=3" ] }, - { - "name": "Shelly1MiniG3-543204547478.local", - "type": "A", - "ttl": 120, - "class": "IN", - "flush": true, - "data": "192.168.1.221" - }, - { - "name": "shelly1minig3-543204547478._shelly._tcp.local", - "type": "SRV", - "ttl": 120, - "class": "IN", - "flush": false, - "data": { - "priority": 0, - "weight": 0, - "port": 80, - "target": "Shelly1MiniG3-543204547478.local" - } - }, - { - "name": "shelly1minig3-543204547478._shelly._tcp.local", - "type": "TXT", - "ttl": 120, - "class": "IN", - "flush": false, - "data": [ - "gen=3", - "app=Mini1G3", - "ver=1.4.4" - ] - }, { "name": "Shelly1MiniG3-543204547478.local", "type": "A", diff --git a/src/mock/shelly1pmg3-34B7DAC68344.json b/src/mock/shelly1pmg3-34B7DAC68344.json index 00bf6b4..ad4b9f9 100644 --- a/src/mock/shelly1pmg3-34B7DAC68344.json +++ b/src/mock/shelly1pmg3-34B7DAC68344.json @@ -1,25 +1,25 @@ { "shelly": { - "name": "My Shelly 1PM Gen3", + "name": "1PM Gen3", "id": "shelly1pmg3-34b7dac68344", "mac": "34B7DAC68344", - "slot": 1, + "slot": 0, "model": "S3SW-001P16EU", "gen": 3, - "fw_id": "20240819-074639/1.4.2-gc2639da", - "ver": "1.4.2", + "fw_id": "20241011-114449/1.4.4-g6d2a586", + "ver": "1.4.4", "app": "S1PMG3", "auth_en": false, "auth_domain": null }, "settings": { "ble": { - "enable": false, + "enable": true, "rpc": { "enable": true }, "observer": { - "enable": false + "enable": true } }, "bthome": {}, @@ -57,7 +57,7 @@ }, "switch:0": { "id": 0, - "name": null, + "name": "1PM Gen3", "in_mode": "follow", "initial_state": "match_input", "auto_on": false, @@ -71,9 +71,9 @@ }, "sys": { "device": { - "name": "My Shelly 1PM Gen3", + "name": "1PM Gen3", "mac": "34B7DAC68344", - "fw_id": "20240819-074639/1.4.2-gc2639da", + "fw_id": "20241011-114449/1.4.4-g6d2a586", "discoverable": true, "eco_mode": false, "addon_type": null @@ -100,7 +100,7 @@ "sntp": { "server": "time.google.com" }, - "cfg_rev": 12 + "cfg_rev": 55 }, "wifi": { "ap": { @@ -122,9 +122,9 @@ "nameserver": null }, "sta1": { - "ssid": null, - "is_open": true, - "enable": false, + "ssid": "wifiAlbatros", + "is_open": false, + "enable": true, "ipv4mode": "dhcp", "ip": null, "netmask": null, @@ -144,9 +144,7 @@ }, "status": { "ble": {}, - "bthome": { - "errors": ["bluetooth_disabled"] - }, + "bthome": {}, "cloud": { "connected": true }, @@ -160,49 +158,57 @@ }, "switch:0": { "id": 0, - "source": "HTTP_in", + "source": "init", "output": false, "apower": 0, - "voltage": 237.1, + "voltage": 235.7, "freq": 50, "current": 0, "aenergy": { "total": 0, - "by_minute": [0, 0, 0], - "minute_ts": 1725745200 + "by_minute": [ + 0, + 0, + 0 + ], + "minute_ts": 1732119840 }, "ret_aenergy": { "total": 0, - "by_minute": [0, 0, 0], - "minute_ts": 1725745200 + "by_minute": [ + 0, + 0, + 0 + ], + "minute_ts": 1732119840 }, "temperature": { - "tC": 47.8, - "tF": 118.1 + "tC": 52, + "tF": 125.6 } }, "sys": { "mac": "34B7DAC68344", "restart_required": false, - "time": "23:40", - "unixtime": 1725745201, - "uptime": 267, - "ram_size": 258688, - "ram_free": 129920, + "time": "17:24", + "unixtime": 1732119875, + "uptime": 3208, + "ram_size": 257988, + "ram_free": 79448, "fs_size": 1048576, - "fs_free": 585728, - "cfg_rev": 12, + "fs_free": 577536, + "cfg_rev": 55, "kvs_rev": 0, "schedule_rev": 1, "webhook_rev": 0, "available_updates": {}, - "reset_reason": 3 + "reset_reason": 1 }, "wifi": { "sta_ip": "192.168.1.158", "status": "got ip", "ssid": "FibreBox_X6-12A4C7", - "rssi": -47 + "rssi": -60 }, "ws": { "connected": false @@ -210,176 +216,234 @@ }, "components": [ { - "key": "ble", - "status": {}, + "key": "bthomedevice:200", + "status": { + "id": 200, + "rssi": -67, + "battery": 100, + "packet_id": 135, + "last_updated_ts": 1732119833 + }, "config": { - "enable": false, - "rpc": { - "enable": true - }, - "observer": { - "enable": false + "id": 200, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "icon": null, + "local_name": "SBHT-003C" + } } } }, { - "key": "bthome", + "key": "bthomedevice:201", "status": { - "errors": ["bluetooth_disabled"] + "id": 201, + "rssi": -64, + "battery": 100, + "packet_id": 35, + "last_updated_ts": 1732118253 }, - "config": {} + "config": { + "id": 201, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBDW-002C", + "icon": null + } + } + } }, { - "key": "cloud", + "key": "bthomedevice:202", "status": { - "connected": true + "id": 202, + "rssi": -64, + "battery": 100, + "packet_id": 8, + "last_updated_ts": 1732118538 }, "config": { - "enable": true, - "server": "shelly-103-eu.shelly.cloud:6022/jrpc" + "id": 202, + "addr": "38:39:8f:8b:d2:29", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBBT-002C", + "icon": null + } + } } }, { - "key": "input:0", + "key": "bthomesensor:200", "status": { - "id": 0, - "state": false + "id": 200, + "value": 100, + "last_updated_ts": 1732119833 }, "config": { - "id": 0, + "id": 200, + "addr": "7c:c6:b6:65:2d:87", "name": null, - "type": "switch", - "enable": true, - "invert": false, - "factory_reset": true + "obj_id": 1, + "idx": 0, + "meta": null } }, { - "key": "knx", - "status": {}, + "key": "bthomesensor:201", + "status": { + "id": 201, + "value": 26, + "last_updated_ts": 1732119833 + }, "config": { - "enable": false, - "ia": "15.15.255", - "routing": { - "addr": "224.0.23.12:3671" - } + "id": 201, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 46, + "idx": 0, + "meta": null } }, { - "key": "mqtt", + "key": "bthomesensor:202", "status": { - "connected": false + "id": 202, + "last_updated_ts": 1070222912 }, "config": { - "enable": false, - "server": null, - "client_id": "shelly1pmg3-34b7dac68344", - "user": null, - "ssl_ca": null, - "topic_prefix": "shelly1pmg3-34b7dac68344", - "rpc_ntf": true, - "status_ntf": false, - "use_client_cert": false, - "enable_rpc": true, - "enable_control": true + "id": 202, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null } }, { - "key": "switch:0", + "key": "bthomesensor:203", "status": { - "id": 0, - "source": "HTTP_in", - "output": false, - "apower": 0, - "voltage": 237, - "freq": 50, - "current": 0, - "aenergy": { - "total": 0, - "by_minute": [0, 0, 0], - "minute_ts": 1725745200 - }, - "ret_aenergy": { - "total": 0, - "by_minute": [0, 0, 0], - "minute_ts": 1725745200 - }, - "temperature": { - "tC": 47.8, - "tF": 118.1 - } + "id": 203, + "value": 22.6, + "last_updated_ts": 1732119833 }, "config": { - "id": 0, + "id": 203, + "addr": "7c:c6:b6:65:2d:87", "name": null, - "in_mode": "follow", - "initial_state": "match_input", - "auto_on": false, - "auto_on_delay": 60, - "auto_off": false, - "auto_off_delay": 60, - "power_limit": 4480, - "voltage_limit": 280, - "autorecover_voltage_errors": false, - "current_limit": 16 + "obj_id": 69, + "idx": 0, + "meta": null } }, { - "key": "sys", + "key": "bthomesensor:204", "status": { - "mac": "34B7DAC68344", - "restart_required": false, - "time": "23:40", - "unixtime": 1725745201, - "uptime": 267, - "ram_size": 258684, - "ram_free": 128260, - "fs_size": 1048576, - "fs_free": 585728, - "cfg_rev": 12, - "kvs_rev": 0, - "schedule_rev": 1, - "webhook_rev": 0, - "available_updates": {}, - "reset_reason": 3 + "id": 204, + "value": 100, + "last_updated_ts": 1732118253 }, "config": { - "device": { - "name": "My Shelly 1PM Gen3", - "mac": "34B7DAC68344", - "fw_id": "20240819-074639/1.4.2-gc2639da", - "discoverable": true, - "eco_mode": false, - "addon_type": null - }, - "location": { - "tz": "Europe/Monaco", - "lat": 43.7314, - "lon": 7.419 - }, - "debug": { - "level": 2, - "file_level": null, - "mqtt": { - "enable": false - }, - "websocket": { - "enable": false - }, - "udp": { - "addr": null - } - }, - "ui_data": {}, - "rpc_udp": { - "dst_addr": null, - "listen_port": null - }, - "sntp": { - "server": "time.google.com" - }, - "cfg_rev": 12 + "id": 204, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:205", + "status": { + "id": 205, + "value": 37, + "last_updated_ts": 1732118253 + }, + "config": { + "id": 205, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 5, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:206", + "status": { + "id": 206, + "value": false, + "last_updated_ts": 1732118253 + }, + "config": { + "id": 206, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 45, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:207", + "status": { + "id": 207, + "value": 0, + "last_updated_ts": 1732118253 + }, + "config": { + "id": 207, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 63, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:208", + "status": { + "id": 208, + "value": 100, + "last_updated_ts": 1732118538 + }, + "config": { + "id": 208, + "addr": "38:39:8f:8b:d2:29", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:209", + "status": { + "id": 209, + "last_updated_ts": 1070222912 + }, + "config": { + "id": 209, + "addr": "38:39:8f:8b:d2:29", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null } } - ] -} + ], + "cfg_rev": 55, + "offset": 0, + "total": 13 +} \ No newline at end of file diff --git a/src/mock/shelly1pmg3-34B7DAC68344.mdns.json b/src/mock/shelly1pmg3-34B7DAC68344.mdns.json index 43ff2b9..bd25814 100644 --- a/src/mock/shelly1pmg3-34B7DAC68344.mdns.json +++ b/src/mock/shelly1pmg3-34B7DAC68344.mdns.json @@ -21,30 +21,6 @@ "class": "IN", "flush": false, "data": "shelly1pmg3-34b7dac68344._http._tcp.local" - }, - { - "name": "_shelly._tcp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "shelly1pmg3-34b7dac68344._shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_http._tcp.local" } ], "authorities": [], @@ -68,36 +44,9 @@ "ttl": 120, "class": "IN", "flush": false, - "data": ["gen=3"] - }, - { - "name": "Shelly1PMG3-34B7DAC68344.local", - "type": "A", - "ttl": 120, - "class": "IN", - "flush": true, - "data": "192.168.1.158" - }, - { - "name": "shelly1pmg3-34b7dac68344._shelly._tcp.local", - "type": "SRV", - "ttl": 120, - "class": "IN", - "flush": false, - "data": { - "priority": 0, - "weight": 0, - "port": 80, - "target": "Shelly1PMG3-34B7DAC68344.local" - } - }, - { - "name": "shelly1pmg3-34b7dac68344._shelly._tcp.local", - "type": "TXT", - "ttl": 120, - "class": "IN", - "flush": false, - "data": ["gen=3", "app=S1PMG3", "ver=1.4.2"] + "data": [ + "gen=3" + ] }, { "name": "Shelly1PMG3-34B7DAC68344.local", @@ -108,4 +57,4 @@ "data": "192.168.1.158" } ] -} +} \ No newline at end of file diff --git a/src/mock/shelly2pmg3-34CDB0770C4C.json b/src/mock/shelly2pmg3-34CDB0770C4C.json new file mode 100644 index 0000000..2054747 --- /dev/null +++ b/src/mock/shelly2pmg3-34CDB0770C4C.json @@ -0,0 +1,640 @@ +{ + "shelly": { + "name": "2PM Gen3", + "id": "shelly2pmg3-34cdb0770c4c", + "mac": "34CDB0770C4C", + "slot": 1, + "model": "S3SW-002P16EU", + "gen": 3, + "fw_id": "20240731-123728/1.4.99-2pmg3prod0-ge3db05c", + "ver": "1.4.99-2pmg3prod0", + "app": "S2PMG3", + "auth_en": false, + "auth_domain": null, + "profile": "switch" + }, + "settings": { + "ble": { + "enable": true, + "rpc": { + "enable": true + }, + "observer": { + "enable": true + } + }, + "bthome": {}, + "cloud": { + "enable": true, + "server": "shelly-103-eu.shelly.cloud:6022/jrpc" + }, + "input:0": { + "id": 0, + "name": null, + "type": "switch", + "enable": true, + "invert": false, + "factory_reset": true + }, + "input:1": { + "id": 1, + "name": null, + "type": "switch", + "enable": true, + "invert": false, + "factory_reset": true + }, + "knx": { + "enable": false, + "ia": "15.15.255", + "routing": { + "addr": "224.0.23.12:3671" + } + }, + "mqtt": { + "enable": false, + "server": null, + "client_id": "shelly2pmg3-34cdb0770c4c", + "user": null, + "ssl_ca": null, + "topic_prefix": "shelly2pmg3-34cdb0770c4c", + "rpc_ntf": true, + "status_ntf": false, + "use_client_cert": false, + "enable_rpc": true, + "enable_control": true + }, + "switch:0": { + "id": 0, + "name": null, + "in_mode": "follow", + "initial_state": "restore_last", + "auto_on": false, + "auto_on_delay": 60, + "auto_off": false, + "auto_off_delay": 60, + "power_limit": 2800, + "voltage_limit": 280, + "undervoltage_limit": 0, + "autorecover_voltage_errors": false, + "current_limit": 10 + }, + "switch:1": { + "id": 1, + "name": null, + "in_mode": "follow", + "initial_state": "match_input", + "auto_on": false, + "auto_on_delay": 60, + "auto_off": false, + "auto_off_delay": 60, + "power_limit": 2800, + "voltage_limit": 280, + "undervoltage_limit": 0, + "autorecover_voltage_errors": false, + "current_limit": 10 + }, + "sys": { + "device": { + "name": "2PM Gen3", + "mac": "34CDB0770C4C", + "fw_id": "20240731-123728/1.4.99-2pmg3prod0-ge3db05c", + "discoverable": true, + "eco_mode": true, + "profile": "switch", + "addon_type": null + }, + "location": null, + "debug": { + "level": 2, + "file_level": null, + "mqtt": { + "enable": false + }, + "websocket": { + "enable": false + }, + "udp": { + "addr": null + } + }, + "ui_data": {}, + "rpc_udp": { + "dst_addr": null, + "listen_port": null + }, + "sntp": { + "server": "time.google.com" + }, + "cfg_rev": 44 + }, + "wifi": { + "ap": { + "ssid": "Shelly2PMG3-34CDB0770C4C", + "is_open": true, + "enable": false, + "range_extender": { + "enable": false + } + }, + "sta": { + "ssid": "FibreBox_X6-12A4C7", + "is_open": false, + "enable": true, + "ipv4mode": "dhcp", + "ip": null, + "netmask": null, + "gw": null, + "nameserver": null + }, + "sta1": { + "ssid": "wifiAlbatros", + "is_open": false, + "enable": true, + "ipv4mode": "dhcp", + "ip": null, + "netmask": null, + "gw": null, + "nameserver": null + }, + "roam": { + "rssi_thr": -80, + "interval": 60 + } + }, + "ws": { + "enable": false, + "server": null, + "ssl_ca": "ca.pem" + } + }, + "status": { + "ble": {}, + "bthome": {}, + "cloud": { + "connected": true + }, + "input:0": { + "id": 0, + "state": false + }, + "input:1": { + "id": 1, + "state": false + }, + "knx": {}, + "mqtt": { + "connected": false + }, + "switch:0": { + "id": 0, + "source": "init", + "output": false, + "apower": 0, + "voltage": 235.4, + "freq": 50, + "current": 0, + "pf": 0, + "aenergy": { + "total": 145, + "by_minute": [ + 0, + 0, + 0 + ], + "minute_ts": 1732119960 + }, + "ret_aenergy": { + "total": 0, + "by_minute": [ + 0, + 0, + 0 + ], + "minute_ts": 1732119960 + }, + "temperature": { + "tC": 38.4, + "tF": 101.1 + } + }, + "switch:1": { + "id": 1, + "source": "init", + "output": false, + "apower": 0, + "voltage": 235.5, + "freq": 50, + "current": 0, + "pf": 0, + "aenergy": { + "total": 140, + "by_minute": [ + 0, + 0, + 0 + ], + "minute_ts": 1732119960 + }, + "ret_aenergy": { + "total": 0, + "by_minute": [ + 0, + 0, + 0 + ], + "minute_ts": 1732119960 + }, + "temperature": { + "tC": 38.4, + "tF": 101.1 + } + }, + "sys": { + "mac": "34CDB0770C4C", + "restart_required": false, + "time": "17:26", + "unixtime": 1732119975, + "uptime": 3342, + "ram_size": 255060, + "ram_free": 62288, + "fs_size": 1048576, + "fs_free": 561152, + "cfg_rev": 44, + "kvs_rev": 0, + "schedule_rev": 3, + "webhook_rev": 2, + "available_updates": {}, + "reset_reason": 1 + }, + "wifi": { + "sta_ip": "192.168.1.166", + "status": "got ip", + "ssid": "FibreBox_X6-12A4C7", + "rssi": -58 + }, + "ws": { + "connected": false + } + }, + "components": [ + { + "key": "bthomedevice:200", + "status": { + "id": 200, + "rssi": null, + "battery": null, + "packet_id": null, + "last_updated_ts": 0 + }, + "config": { + "id": 200, + "addr": "7c:c6:b6:58:b9:a0", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBBT-USb9a0", + "icon": null + } + } + } + }, + { + "key": "bthomedevice:201", + "status": { + "id": 201, + "rssi": null, + "battery": null, + "packet_id": null, + "last_updated_ts": 0 + }, + "config": { + "id": 201, + "addr": "0c:ef:f6:01:8d:b8", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBBT-EU8db8", + "icon": null + } + } + } + }, + { + "key": "bthomedevice:202", + "status": { + "id": 202, + "rssi": -55, + "battery": 100, + "packet_id": 35, + "last_updated_ts": 1732118253 + }, + "config": { + "id": 202, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBDW-002C", + "icon": null + } + } + } + }, + { + "key": "bthomedevice:203", + "status": { + "id": 203, + "rssi": null, + "battery": null, + "packet_id": null, + "last_updated_ts": 0 + }, + "config": { + "id": 203, + "addr": "0c:ae:5f:5a:0b:fa", + "name": null, + "key": null, + "meta": { + "ui": { + "view": "regular", + "local_name": "SBMO-003Z", + "icon": null + } + } + } + }, + { + "key": "bthomesensor:200", + "status": { + "id": 200, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 200, + "addr": "7c:c6:b6:58:b9:a0", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:201", + "status": { + "id": 201, + "last_updated_ts": 1070224832 + }, + "config": { + "id": 201, + "addr": "7c:c6:b6:58:b9:a0", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:202", + "status": { + "id": 202, + "last_updated_ts": 1070224832 + }, + "config": { + "id": 202, + "addr": "7c:c6:b6:58:b9:a0", + "name": null, + "obj_id": 58, + "idx": 1, + "meta": null + } + }, + { + "key": "bthomesensor:203", + "status": { + "id": 203, + "last_updated_ts": 1070224832 + }, + "config": { + "id": 203, + "addr": "7c:c6:b6:58:b9:a0", + "name": null, + "obj_id": 58, + "idx": 2, + "meta": null + } + }, + { + "key": "bthomesensor:204", + "status": { + "id": 204, + "last_updated_ts": 1070224832 + }, + "config": { + "id": 204, + "addr": "7c:c6:b6:58:b9:a0", + "name": null, + "obj_id": 58, + "idx": 3, + "meta": null + } + }, + { + "key": "bthomesensor:205", + "status": { + "id": 205, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 205, + "addr": "0c:ef:f6:01:8d:b8", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:206", + "status": { + "id": 206, + "last_updated_ts": 1070224832 + }, + "config": { + "id": 206, + "addr": "0c:ef:f6:01:8d:b8", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:207", + "status": { + "id": 207, + "last_updated_ts": 1070224832 + }, + "config": { + "id": 207, + "addr": "0c:ef:f6:01:8d:b8", + "name": null, + "obj_id": 58, + "idx": 1, + "meta": null + } + }, + { + "key": "bthomesensor:208", + "status": { + "id": 208, + "last_updated_ts": 1070224832 + }, + "config": { + "id": 208, + "addr": "0c:ef:f6:01:8d:b8", + "name": null, + "obj_id": 58, + "idx": 2, + "meta": null + } + }, + { + "key": "bthomesensor:209", + "status": { + "id": 209, + "last_updated_ts": 1070224832 + }, + "config": { + "id": 209, + "addr": "0c:ef:f6:01:8d:b8", + "name": null, + "obj_id": 58, + "idx": 3, + "meta": null + } + }, + { + "key": "bthomesensor:210", + "status": { + "id": 210, + "value": 100, + "last_updated_ts": 1732118253 + }, + "config": { + "id": 210, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:211", + "status": { + "id": 211, + "value": 37, + "last_updated_ts": 1732118253 + }, + "config": { + "id": 211, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 5, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:212", + "status": { + "id": 212, + "value": false, + "last_updated_ts": 1732118253 + }, + "config": { + "id": 212, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 45, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:213", + "status": { + "id": 213, + "value": 0, + "last_updated_ts": 1732118253 + }, + "config": { + "id": 213, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 63, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:214", + "status": { + "id": 214, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 214, + "addr": "0c:ae:5f:5a:0b:fa", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:215", + "status": { + "id": 215, + "value": null, + "last_updated_ts": 0 + }, + "config": { + "id": 215, + "addr": "0c:ae:5f:5a:0b:fa", + "name": null, + "obj_id": 33, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:216", + "status": { + "id": 216, + "last_updated_ts": 1070224832 + }, + "config": { + "id": 216, + "addr": "0c:ae:5f:5a:0b:fa", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null + } + } + ], + "cfg_rev": 44, + "offset": 0, + "total": 21 +} \ No newline at end of file diff --git a/src/mock/shelly2pmg3-34CDB0770C4C.mdns.json b/src/mock/shelly2pmg3-34CDB0770C4C.mdns.json index 6225125..5aad828 100644 --- a/src/mock/shelly2pmg3-34CDB0770C4C.mdns.json +++ b/src/mock/shelly2pmg3-34CDB0770C4C.mdns.json @@ -21,30 +21,6 @@ "class": "IN", "flush": false, "data": "shelly2pmg3-34cdb0770c4c._http._tcp.local" - }, - { - "name": "_shelly._tcp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "shelly2pmg3-34cdb0770c4c._shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_http._tcp.local" } ], "authorities": [], @@ -68,36 +44,9 @@ "ttl": 120, "class": "IN", "flush": false, - "data": ["gen=3"] - }, - { - "name": "Shelly2PMG3-34CDB0770C4C.local", - "type": "A", - "ttl": 120, - "class": "IN", - "flush": true, - "data": "192.168.1.166" - }, - { - "name": "shelly2pmg3-34cdb0770c4c._shelly._tcp.local", - "type": "SRV", - "ttl": 120, - "class": "IN", - "flush": false, - "data": { - "priority": 0, - "weight": 0, - "port": 80, - "target": "Shelly2PMG3-34CDB0770C4C.local" - } - }, - { - "name": "shelly2pmg3-34cdb0770c4c._shelly._tcp.local", - "type": "TXT", - "ttl": 120, - "class": "IN", - "flush": false, - "data": ["gen=3", "app=S2PMG3", "ver=1.4.99-2pmg3prod0"] + "data": [ + "gen=3" + ] }, { "name": "Shelly2PMG3-34CDB0770C4C.local", @@ -108,4 +57,4 @@ "data": "192.168.1.166" } ] -} +} \ No newline at end of file diff --git a/src/mock/shellyblugwg3-34CDB077BCD4.json b/src/mock/shellyblugwg3-34CDB077BCD4.json index 008a340..8505863 100644 --- a/src/mock/shellyblugwg3-34CDB077BCD4.json +++ b/src/mock/shellyblugwg3-34CDB077BCD4.json @@ -6,8 +6,8 @@ "slot": 0, "model": "S3GW-1DBT001", "gen": 3, - "fw_id": "20240926-112057/1.4.99-blugwg3prod1-ga62dce2", - "ver": "1.4.99-blugwg3prod1", + "fw_id": "20241021-140344/1.4.99-blugwg3prod4-g110402b", + "ver": "1.4.99-blugwg3prod4", "app": "BluGwG3", "auth_en": false, "auth_domain": null @@ -15,9 +15,6 @@ "settings": { "ble": { "enable": true, - "observer_scan_window_ms": 61, - "observer_scan_interval_ms": 241, - "gattc_sv_timeout_ms": 5000, "rpc": { "enable": true } @@ -47,7 +44,7 @@ "device": { "name": "BLU Gateway Gen3", "mac": "34CDB077BCD4", - "fw_id": "20240926-112057/1.4.99-blugwg3prod1-ga62dce2", + "fw_id": "20241021-140344/1.4.99-blugwg3prod4-g110402b", "discoverable": true, "eco_mode": false }, @@ -74,9 +71,9 @@ "listen_port": null }, "sntp": { - "server": "time.google.com" + "server": "time.cloudflare.com" }, - "cfg_rev": 40 + "cfg_rev": 2336 }, "wifi": { "ap": { @@ -98,9 +95,9 @@ "nameserver": null }, "sta1": { - "ssid": null, - "is_open": true, - "enable": false, + "ssid": "wifiAlbatros", + "is_open": false, + "enable": true, "ipv4mode": "dhcp", "ip": null, "netmask": null, @@ -131,16 +128,17 @@ "sys": { "mac": "34CDB077BCD4", "restart_required": false, - "time": "17:12", - "unixtime": 1727968338, - "uptime": 2016, - "ram_size": 254368, - "ram_free": 80900, + "time": "16:51", + "unixtime": 1732117918, + "uptime": 20388, + "ram_size": 253732, + "ram_free": 67588, + "ram_min_free": 34164, "fs_size": 1048576, - "fs_free": 606208, - "cfg_rev": 40, + "fs_free": 569344, + "cfg_rev": 2336, "kvs_rev": 0, - "schedule_rev": 0, + "schedule_rev": 1, "webhook_rev": 0, "available_updates": {}, "reset_reason": 3 @@ -149,7 +147,7 @@ "sta_ip": "192.168.1.164", "status": "got ip", "ssid": "FibreBox_X6-12A4C7", - "rssi": -54 + "rssi": -41 }, "ws": { "connected": false @@ -157,74 +155,156 @@ }, "components": [ { - "key": "ble", - "status": {}, + "key": "blutrv:200", + "status": { + "id": 200, + "rssi": -47, + "battery": 100, + "packet_id": 186, + "last_updated_ts": 1732117911, + "paired": true, + "rpc": true, + "rsv": 51 + }, "config": { - "enable": true, - "observer_scan_window_ms": 61, - "observer_scan_interval_ms": 241, - "gattc_sv_timeout_ms": 5000, - "rpc": { - "enable": true - } + "id": 200, + "addr": "28:68:47:fc:9a:6b", + "name": "BluTrv 200", + "key": null, + "trv": "bthomedevice:200", + "temp_sensors": [ + "bthomesensor:207" + ], + "dw_sensors": [ + "bthomesensor:210" + ], + "meta": {} } }, { - "key": "blugw", - "status": {}, + "key": "blutrv:201", + "status": { + "id": 201, + "rssi": -49, + "battery": 100, + "packet_id": 79, + "last_updated_ts": 1732117916, + "paired": true, + "rpc": true, + "rsv": 20 + }, "config": { - "sys_led_enable": true + "id": 201, + "addr": "28:db:a7:b5:d1:ca", + "name": "BluTrv 201", + "key": null, + "trv": "bthomedevice:203", + "temp_sensors": [ + "bthomesensor:219" + ], + "dw_sensors": [ + "bthomesensor:210" + ], + "meta": {} } }, { - "key": "blutrv:200", + "key": "bthomedevice:200", "status": { "id": 200, - "rssi": -28, + "rssi": -47, "battery": 100, - "packet_id": 225, - "last_updated_ts": 1727968324, + "packet_id": 186, + "last_updated_ts": 1732117911, "paired": true, "rpc": true, - "rsv": 49 + "rsv": 51 }, "config": { "id": 200, "addr": "28:68:47:fc:9a:6b", + "name": "BluTrv 200", + "key": null, + "meta": { + "ui": { + "view": "regular", + "icon": null + } + } + }, + "attrs": { + "flags": 17, + "model_id": 8 + } + }, + { + "key": "bthomedevice:201", + "status": { + "id": 201, + "rssi": -65, + "battery": 100, + "packet_id": 103, + "last_updated_ts": 1732117913, + "paired": true, + "rpc": false, + "rsv": -1 + }, + "config": { + "id": 201, + "addr": "7c:c6:b6:65:2d:87", "name": null, "key": null, - "trv": "bthomedevice:200", - "temp_sensors": [], - "dw_sensors": [], "meta": null + }, + "attrs": { + "flags": 17, + "model_id": 3 } }, { - "key": "bthome", - "status": {}, - "config": {} + "key": "bthomedevice:202", + "status": { + "id": 202, + "rssi": -59, + "battery": 100, + "packet_id": 34, + "last_updated_ts": 1732116452, + "paired": true, + "rpc": false, + "rsv": -1 + }, + "config": { + "id": 202, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "key": null, + "meta": null + }, + "attrs": { + "flags": 17, + "model_id": 2 + } }, { - "key": "bthomedevice:200", + "key": "bthomedevice:203", "status": { - "id": 200, - "rssi": -28, + "id": 203, + "rssi": -49, "battery": 100, - "packet_id": 225, - "last_updated_ts": 1727968324, + "packet_id": 79, + "last_updated_ts": 1732117916, "paired": true, "rpc": true, - "rsv": 49 + "rsv": 20 }, "config": { - "id": 200, - "addr": "28:68:47:fc:9a:6b", - "name": null, + "id": 203, + "addr": "28:db:a7:b5:d1:ca", + "name": "BluTrv 201", "key": null, "meta": { "ui": { - "view": "", - "local_name": "TRV", + "view": "regular", "icon": null } } @@ -234,12 +314,36 @@ "model_id": 8 } }, + { + "key": "bthomedevice:204", + "status": { + "id": 204, + "rssi": -57, + "battery": 100, + "packet_id": 95, + "last_updated_ts": 1732117909, + "paired": true, + "rpc": false, + "rsv": -1 + }, + "config": { + "id": 204, + "addr": "7c:c6:b6:bd:7a:9a", + "name": null, + "key": null, + "meta": null + }, + "attrs": { + "flags": 17, + "model_id": 3 + } + }, { "key": "bthomesensor:200", "status": { "id": 200, "value": 100, - "last_updated_ts": 1727968324 + "last_updated_ts": 1732117911 }, "config": { "id": 200, @@ -254,7 +358,7 @@ "key": "bthomesensor:201", "status": { "id": 201, - "last_updated_ts": 1070226352 + "last_updated_ts": 1070226336 }, "config": { "id": 201, @@ -269,8 +373,8 @@ "key": "bthomesensor:202", "status": { "id": 202, - "value": 11, - "last_updated_ts": 1727968324 + "value": 18, + "last_updated_ts": 1732117911 }, "config": { "id": 202, @@ -285,8 +389,8 @@ "key": "bthomesensor:203", "status": { "id": 203, - "value": 24, - "last_updated_ts": 1727968324 + "value": 22.7, + "last_updated_ts": 1732117911 }, "config": { "id": 203, @@ -298,92 +402,260 @@ } }, { - "key": "cloud", + "key": "bthomesensor:204", "status": { - "connected": true + "id": 204, + "value": 100, + "last_updated_ts": 1732117913 }, "config": { - "enable": true, - "server": "shelly-103-eu.shelly.cloud:6022/jrpc" + "id": 204, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null } }, { - "key": "mqtt", + "key": "bthomesensor:205", "status": { - "connected": false + "id": 205, + "value": 27, + "last_updated_ts": 1732117913 }, "config": { - "enable": false, - "server": null, - "client_id": "shellyblugwg3-34cdb077bcd4", - "user": null, - "ssl_ca": null, - "topic_prefix": "shellyblugwg3-34cdb077bcd4", - "rpc_ntf": true, - "status_ntf": false, - "use_client_cert": false, - "enable_rpc": true, - "enable_control": true + "id": 205, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 46, + "idx": 0, + "meta": null } }, { - "key": "sys", + "key": "bthomesensor:206", "status": { - "mac": "34CDB077BCD4", - "restart_required": false, - "time": "17:12", - "unixtime": 1727968338, - "uptime": 2017, - "ram_size": 254364, - "ram_free": 77824, - "fs_size": 1048576, - "fs_free": 606208, - "cfg_rev": 40, - "kvs_rev": 0, - "schedule_rev": 0, - "webhook_rev": 0, - "available_updates": {}, - "reset_reason": 3 + "id": 206, + "last_updated_ts": 4 }, "config": { - "device": { - "name": "BLU Gateway Gen3", - "mac": "34CDB077BCD4", - "fw_id": "20240926-112057/1.4.99-blugwg3prod1-ga62dce2", - "discoverable": true, - "eco_mode": false - }, - "location": { - "tz": "Europe/Monaco", - "lat": 43.7314, - "lon": 7.419 - }, - "debug": { - "level": 2, - "file_level": null, - "mqtt": { - "enable": false - }, - "websocket": { - "enable": false - }, - "file_log": { - "enable": false - }, - "udp": { - "addr": null - } - }, - "ui_data": {}, - "rpc_udp": { - "dst_addr": null, - "listen_port": null - }, - "sntp": { - "server": "time.google.com" - }, - "cfg_rev": 40 + "id": 206, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:207", + "status": { + "id": 207, + "value": 22.6, + "last_updated_ts": 1732117913 + }, + "config": { + "id": 207, + "addr": "7c:c6:b6:65:2d:87", + "name": null, + "obj_id": 69, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:208", + "status": { + "id": 208, + "value": 100, + "last_updated_ts": 1732116452 + }, + "config": { + "id": 208, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:209", + "status": { + "id": 209, + "value": 37, + "last_updated_ts": 1732116452 + }, + "config": { + "id": 209, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 5, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:210", + "status": { + "id": 210, + "value": false, + "last_updated_ts": 1732116452 + }, + "config": { + "id": 210, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 45, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:211", + "status": { + "id": 211, + "value": 0, + "last_updated_ts": 1732116452 + }, + "config": { + "id": 211, + "addr": "0c:ef:f6:f1:d7:7b", + "name": null, + "obj_id": 63, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:212", + "status": { + "id": 212, + "value": 100, + "last_updated_ts": 1732117916 + }, + "config": { + "id": 212, + "addr": "28:db:a7:b5:d1:ca", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:213", + "status": { + "id": 213, + "last_updated_ts": 1070226336 + }, + "config": { + "id": 213, + "addr": "28:db:a7:b5:d1:ca", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:214", + "status": { + "id": 214, + "value": 21, + "last_updated_ts": 1732117916 + }, + "config": { + "id": 214, + "addr": "28:db:a7:b5:d1:ca", + "name": null, + "obj_id": 69, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:215", + "status": { + "id": 215, + "value": 22.5, + "last_updated_ts": 1732117916 + }, + "config": { + "id": 215, + "addr": "28:db:a7:b5:d1:ca", + "name": null, + "obj_id": 69, + "idx": 1, + "meta": null + } + }, + { + "key": "bthomesensor:216", + "status": { + "id": 216, + "value": 100, + "last_updated_ts": 1732117909 + }, + "config": { + "id": 216, + "addr": "7c:c6:b6:bd:7a:9a", + "name": null, + "obj_id": 1, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:217", + "status": { + "id": 217, + "value": 26, + "last_updated_ts": 1732117909 + }, + "config": { + "id": 217, + "addr": "7c:c6:b6:bd:7a:9a", + "name": null, + "obj_id": 46, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:218", + "status": { + "id": 218, + "last_updated_ts": 1070226336 + }, + "config": { + "id": 218, + "addr": "7c:c6:b6:bd:7a:9a", + "name": null, + "obj_id": 58, + "idx": 0, + "meta": null + } + }, + { + "key": "bthomesensor:219", + "status": { + "id": 219, + "value": 22.7, + "last_updated_ts": 1732117909 + }, + "config": { + "id": 219, + "addr": "7c:c6:b6:bd:7a:9a", + "name": null, + "obj_id": 69, + "idx": 0, + "meta": null } } - ] -} + ], + "cfg_rev": 2336, + "offset": 0, + "total": 27 +} \ No newline at end of file diff --git a/src/mock/shellyblugwg3-34CDB077BCD4.mdns.json b/src/mock/shellyblugwg3-34CDB077BCD4.mdns.json index 1e41a2d..0b62e8f 100644 --- a/src/mock/shellyblugwg3-34CDB077BCD4.mdns.json +++ b/src/mock/shellyblugwg3-34CDB077BCD4.mdns.json @@ -21,30 +21,6 @@ "class": "IN", "flush": false, "data": "shellyblugwg3-34cdb077bcd4._http._tcp.local" - }, - { - "name": "_shelly._tcp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "shellyblugwg3-34cdb077bcd4._shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_http._tcp.local" } ], "authorities": [], @@ -68,36 +44,9 @@ "ttl": 120, "class": "IN", "flush": false, - "data": ["gen=3"] - }, - { - "name": "ShellyBluGwG3-34CDB077BCD4.local", - "type": "A", - "ttl": 120, - "class": "IN", - "flush": true, - "data": "192.168.1.164" - }, - { - "name": "shellyblugwg3-34cdb077bcd4._shelly._tcp.local", - "type": "SRV", - "ttl": 120, - "class": "IN", - "flush": false, - "data": { - "priority": 0, - "weight": 0, - "port": 80, - "target": "ShellyBluGwG3-34CDB077BCD4.local" - } - }, - { - "name": "shellyblugwg3-34cdb077bcd4._shelly._tcp.local", - "type": "TXT", - "ttl": 120, - "class": "IN", - "flush": false, - "data": ["gen=3", "app=BluGwG3", "ver=1.4.99-blugwg3prod1"] + "data": [ + "gen=3" + ] }, { "name": "ShellyBluGwG3-34CDB077BCD4.local", @@ -108,4 +57,4 @@ "data": "192.168.1.164" } ] -} +} \ No newline at end of file diff --git a/src/mock/shellyddimmerg3-84FCE636832C.json b/src/mock/shellyddimmerg3-84FCE636832C.json index b97aa11..5d83d50 100644 --- a/src/mock/shellyddimmerg3-84FCE636832C.json +++ b/src/mock/shellyddimmerg3-84FCE636832C.json @@ -1,6 +1,6 @@ { "shelly": { - "name": "My Shelly DALI Dimmer Gen3", + "name": "DALI Dimmer Gen3", "id": "shellyddimmerg3-84fce636832c", "mac": "84FCE636832C", "slot": 0, @@ -14,12 +14,12 @@ }, "settings": { "ble": { - "enable": false, + "enable": true, "rpc": { "enable": true }, "observer": { - "enable": false + "enable": true } }, "bthome": {}, @@ -88,7 +88,7 @@ }, "sys": { "device": { - "name": "My Shelly DALI Dimmer Gen3", + "name": "DALI Dimmer Gen3", "mac": "84FCE636832C", "fw_id": "20240719-122242/g55db545", "discoverable": true @@ -118,7 +118,7 @@ "sntp": { "server": "time.google.com" }, - "cfg_rev": 11 + "cfg_rev": 13 }, "wifi": { "ap": { @@ -140,9 +140,9 @@ "nameserver": null }, "sta1": { - "ssid": null, - "is_open": true, - "enable": false, + "ssid": "wifiAlbatros", + "is_open": false, + "enable": true, "ipv4mode": "dhcp", "ip": null, "netmask": null, @@ -162,9 +162,7 @@ }, "status": { "ble": {}, - "bthome": { - "errors": ["bluetooth_disabled"] - }, + "bthome": {}, "cloud": { "connected": true }, @@ -182,12 +180,12 @@ "knx": {}, "light:0": { "id": 0, - "source": "HTTP_in", - "output": true, - "brightness": 100, + "source": "init", + "output": false, + "brightness": 1, "temperature": { - "tC": 56.4, - "tF": 133.6 + "tC": 71.2, + "tF": 160.2 } }, "mqtt": { @@ -196,28 +194,32 @@ "sys": { "mac": "84FCE636832C", "restart_required": false, - "time": "08:10", - "unixtime": 1722579044, - "uptime": 2137, - "ram_size": 257176, - "ram_free": 128904, + "time": "16:52", + "unixtime": 1732117957, + "uptime": 1337, + "ram_size": 256516, + "ram_free": 78204, "fs_size": 1048576, - "fs_free": 577536, - "cfg_rev": 11, + "fs_free": 573440, + "cfg_rev": 13, "kvs_rev": 0, "schedule_rev": 1, "webhook_rev": 0, "available_updates": {}, - "reset_reason": 3 + "reset_reason": 1 }, "wifi": { "sta_ip": "192.168.1.242", "status": "got ip", "ssid": "FibreBox_X6-12A4C7", - "rssi": -51 + "rssi": -62 }, "ws": { "connected": false } - } -} + }, + "components": [], + "cfg_rev": 13, + "offset": 0, + "total": 0 +} \ No newline at end of file diff --git a/src/mock/shellyddimmerg3-84FCE636832C.mdns.json b/src/mock/shellyddimmerg3-84FCE636832C.mdns.json index 15174b8..2c14434 100644 --- a/src/mock/shellyddimmerg3-84FCE636832C.mdns.json +++ b/src/mock/shellyddimmerg3-84FCE636832C.mdns.json @@ -21,14 +21,6 @@ "class": "IN", "flush": false, "data": "shellyddimmerg3-84fce636832c._http._tcp.local" - }, - { - "name": "_shelly._tcp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "shellyddimmerg3-84fce636832c._shelly._tcp.local" } ], "authorities": [], @@ -52,36 +44,9 @@ "ttl": 120, "class": "IN", "flush": false, - "data": ["gen=3"] - }, - { - "name": "ShellyDDimmerG3-84FCE636832C.local", - "type": "A", - "ttl": 120, - "class": "IN", - "flush": true, - "data": "192.168.1.242" - }, - { - "name": "shellyddimmerg3-84fce636832c._shelly._tcp.local", - "type": "SRV", - "ttl": 120, - "class": "IN", - "flush": false, - "data": { - "priority": 0, - "weight": 0, - "port": 80, - "target": "ShellyDDimmerG3-84FCE636832C.local" - } - }, - { - "name": "shellyddimmerg3-84fce636832c._shelly._tcp.local", - "type": "TXT", - "ttl": 120, - "class": "IN", - "flush": false, - "data": ["gen=3", "app=DDimmerG3", "ver=1.4.99-dev101226"] + "data": [ + "gen=3" + ] }, { "name": "ShellyDDimmerG3-84FCE636832C.local", @@ -92,4 +57,4 @@ "data": "192.168.1.242" } ] -} +} \ No newline at end of file diff --git a/src/mock/shellyemg3-84FCE636582C.json b/src/mock/shellyemg3-84FCE636582C.json index cd5de40..80d062f 100644 --- a/src/mock/shellyemg3-84FCE636582C.json +++ b/src/mock/shellyemg3-84FCE636582C.json @@ -1,6 +1,6 @@ { "shelly": { - "name": "My Shelly EM Gen3", + "name": "EM Gen3", "id": "shellyemg3-84fce636582c", "mac": "84FCE636582C", "slot": 0, @@ -14,12 +14,12 @@ }, "settings": { "ble": { - "enable": false, + "enable": true, "rpc": { - "enable": false + "enable": true }, "observer": { - "enable": false + "enable": true } }, "bthome": {}, @@ -65,11 +65,11 @@ }, "sys": { "device": { - "name": "My Shelly EM Gen3", + "name": "EM Gen3", "mac": "84FCE636582C", "fw_id": "20240724-112312/g1216eb0", "discoverable": true, - "eco_mode": false, + "eco_mode": true, "addon_type": null }, "location": null, @@ -97,7 +97,7 @@ "sntp": { "server": "time.google.com" }, - "cfg_rev": 15 + "cfg_rev": 69 }, "wifi": { "ap": { @@ -119,8 +119,8 @@ "nameserver": null }, "sta1": { - "ssid": null, - "is_open": true, + "ssid": "wifiAlbatros", + "is_open": false, "enable": false, "ipv4mode": "dhcp", "ip": null, @@ -141,16 +141,14 @@ }, "status": { "ble": {}, - "bthome": { - "errors": ["bluetooth_disabled"] - }, + "bthome": {}, "cloud": { "connected": true }, "em1:0": { "id": 0, "current": 0.02, - "voltage": 237.3, + "voltage": 237.5, "act_power": 0, "aprt_power": 4.8, "pf": 0, @@ -159,17 +157,17 @@ }, "em1:1": { "id": 1, - "current": 0.02, - "voltage": 237.3, + "current": 0.021, + "voltage": 237.5, "act_power": 0, - "aprt_power": 4.8, + "aprt_power": 4.9, "pf": 0, "freq": 50, "calibration": "factory" }, "em1data:0": { "id": 0, - "total_act_energy": 0, + "total_act_energy": 0.01, "total_act_ret_energy": 0 }, "em1data:1": { @@ -185,35 +183,39 @@ "source": "init", "output": false, "temperature": { - "tC": 56.2, - "tF": 133.2 + "tC": 52.9, + "tF": 127.3 } }, "sys": { "mac": "84FCE636582C", "restart_required": false, - "time": "23:13", - "unixtime": 1722978832, - "uptime": 9711, - "ram_size": 253168, - "ram_free": 122824, + "time": "17:24", + "unixtime": 1732119845, + "uptime": 17, + "ram_size": 252664, + "ram_free": 76236, "fs_size": 786432, - "fs_free": 331776, - "cfg_rev": 15, + "fs_free": 323584, + "cfg_rev": 69, "kvs_rev": 0, "schedule_rev": 0, "webhook_rev": 0, "available_updates": {}, - "reset_reason": 1 + "reset_reason": 3 }, "wifi": { "sta_ip": "192.168.1.243", "status": "got ip", "ssid": "FibreBox_X6-12A4C7", - "rssi": -52 + "rssi": -60 }, "ws": { "connected": false } - } -} + }, + "components": [], + "cfg_rev": 69, + "offset": 0, + "total": 0 +} \ No newline at end of file diff --git a/src/mock/shellyemg3-84FCE636582C.mdns.json b/src/mock/shellyemg3-84FCE636582C.mdns.json index 759b989..63aec63 100644 --- a/src/mock/shellyemg3-84FCE636582C.mdns.json +++ b/src/mock/shellyemg3-84FCE636582C.mdns.json @@ -21,102 +21,8 @@ "class": "IN", "flush": true, "data": "192.168.1.243" - }, - { - "name": "ShellyEMG3-84FCE636582C.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": true, - "data": "243.1.168.192.in-addr.arpa" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_shelly._tcp.local" - }, - { - "name": "_shelly._tcp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "shellyemg3-84fce636582c._shelly._tcp.local" - }, - { - "name": "shellyemg3-84fce636582c._shelly._tcp.local", - "type": "SRV", - "ttl": 120, - "class": "IN", - "flush": true, - "data": { - "priority": 0, - "weight": 0, - "port": 80, - "target": "ShellyEMG3-84FCE636582C.local" - } - }, - { - "name": "shellyemg3-84fce636582c._shelly._tcp.local", - "type": "TXT", - "ttl": 120, - "class": "IN", - "flush": true, - "data": ["gen=3", "app=EMG3", "ver=1.4.99-dev101493"] - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_http._tcp.local" - }, - { - "name": "_http._tcp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "shellyemg3-84fce636582c._http._tcp.local" - }, - { - "name": "shellyemg3-84fce636582c._http._tcp.local", - "type": "SRV", - "ttl": 120, - "class": "IN", - "flush": true, - "data": { - "priority": 0, - "weight": 0, - "port": 80, - "target": "ShellyEMG3-84FCE636582C.local" - } - }, - { - "name": "shellyemg3-84fce636582c._http._tcp.local", - "type": "TXT", - "ttl": 120, - "class": "IN", - "flush": true, - "data": ["gen=3"] } ], "authorities": [], - "additionals": [ - { - "name": "ShellyEMG3-84FCE636582C.local", - "type": "NSEC", - "ttl": 1, - "class": "IN", - "flush": true, - "data": { - "nextDomain": "ShellyEMG3-84FCE636582C.local", - "rrtypes": [] - } - } - ] -} + "additionals": [] +} \ No newline at end of file diff --git a/src/mock/shellyi4g3-5432045661B4.json b/src/mock/shellyi4g3-5432045661B4.json index 53b71fb..a4e1227 100644 --- a/src/mock/shellyi4g3-5432045661B4.json +++ b/src/mock/shellyi4g3-5432045661B4.json @@ -1,13 +1,13 @@ { "shelly": { - "name": "My Shelly i4 Gen3", + "name": "i4 Gen3", "id": "shellyi4g3-5432045661b4", "mac": "5432045661B4", - "slot": 1, + "slot": 0, "model": "S3SN-0024X", "gen": 3, - "fw_id": "20240819-074305/1.4.2-gc2639da", - "ver": "1.4.2", + "fw_id": "20241011-114457/1.4.4-g6d2a586", + "ver": "1.4.4", "app": "I4G3", "auth_en": false, "auth_domain": null @@ -30,7 +30,7 @@ "input:0": { "id": 0, "name": null, - "type": "switch", + "type": "button", "enable": true, "invert": false, "factory_reset": true @@ -38,8 +38,8 @@ "input:1": { "id": 1, "name": null, - "type": "switch", - "enable": true, + "type": "button", + "enable": false, "invert": false, "factory_reset": true }, @@ -55,7 +55,7 @@ "id": 3, "name": null, "type": "switch", - "enable": true, + "enable": false, "invert": false, "factory_reset": true }, @@ -81,11 +81,11 @@ }, "sys": { "device": { - "name": "My Shelly i4 Gen3", + "name": "i4 Gen3", "mac": "5432045661B4", - "fw_id": "20240819-074305/1.4.2-gc2639da", + "fw_id": "20241011-114457/1.4.4-g6d2a586", "discoverable": true, - "eco_mode": false, + "eco_mode": true, "addon_type": null }, "location": null, @@ -110,7 +110,7 @@ "sntp": { "server": "time.google.com" }, - "cfg_rev": 13 + "cfg_rev": 15 }, "wifi": { "ap": { @@ -132,9 +132,9 @@ "nameserver": null }, "sta1": { - "ssid": null, - "is_open": true, - "enable": false, + "ssid": "wifiAlbatros", + "is_open": false, + "enable": true, "ipv4mode": "dhcp", "ip": null, "netmask": null, @@ -155,18 +155,20 @@ "status": { "ble": {}, "bthome": { - "errors": ["bluetooth_disabled"] + "errors": [ + "bluetooth_disabled" + ] }, "cloud": { "connected": true }, "input:0": { "id": 0, - "state": false + "state": null }, "input:1": { "id": 1, - "state": false + "state": null }, "input:2": { "id": 2, @@ -174,7 +176,7 @@ }, "input:3": { "id": 3, - "state": false + "state": null }, "knx": {}, "mqtt": { @@ -183,207 +185,32 @@ "sys": { "mac": "5432045661B4", "restart_required": false, - "time": "23:57", - "unixtime": 1725746265, - "uptime": 252, - "ram_size": 259824, - "ram_free": 133164, + "time": "17:31", + "unixtime": 1732120286, + "uptime": 3618, + "ram_size": 259732, + "ram_free": 130736, "fs_size": 1048576, "fs_free": 593920, - "cfg_rev": 13, + "cfg_rev": 15, "kvs_rev": 0, "schedule_rev": 0, "webhook_rev": 0, "available_updates": {}, - "reset_reason": 3 + "reset_reason": 1 }, "wifi": { "sta_ip": "192.168.1.159", "status": "got ip", "ssid": "FibreBox_X6-12A4C7", - "rssi": -54 + "rssi": -44 }, "ws": { "connected": false } }, - "components": [ - { - "key": "ble", - "status": {}, - "config": { - "enable": false, - "rpc": { - "enable": true - }, - "observer": { - "enable": false - } - } - }, - { - "key": "bthome", - "status": { - "errors": ["bluetooth_disabled"] - }, - "config": {} - }, - { - "key": "cloud", - "status": { - "connected": true - }, - "config": { - "enable": true, - "server": "shelly-103-eu.shelly.cloud:6022/jrpc" - } - }, - { - "key": "input:0", - "status": { - "id": 0, - "state": false - }, - "config": { - "id": 0, - "name": null, - "type": "switch", - "enable": true, - "invert": false, - "factory_reset": true - } - }, - { - "key": "input:1", - "status": { - "id": 1, - "state": false - }, - "config": { - "id": 1, - "name": null, - "type": "switch", - "enable": true, - "invert": false, - "factory_reset": true - } - }, - { - "key": "input:2", - "status": { - "id": 2, - "state": false - }, - "config": { - "id": 2, - "name": null, - "type": "switch", - "enable": true, - "invert": false, - "factory_reset": true - } - }, - { - "key": "input:3", - "status": { - "id": 3, - "state": false - }, - "config": { - "id": 3, - "name": null, - "type": "switch", - "enable": true, - "invert": false, - "factory_reset": true - } - }, - { - "key": "knx", - "status": {}, - "config": { - "enable": false, - "ia": "15.15.255", - "routing": { - "addr": "224.0.23.12:3671" - } - } - }, - { - "key": "mqtt", - "status": { - "connected": false - }, - "config": { - "enable": false, - "server": null, - "client_id": "shellyi4g3-5432045661b4", - "user": null, - "ssl_ca": null, - "topic_prefix": "shellyi4g3-5432045661b4", - "rpc_ntf": true, - "status_ntf": false, - "use_client_cert": false, - "enable_rpc": true, - "enable_control": true - } - }, - { - "key": "sys", - "status": { - "mac": "5432045661B4", - "restart_required": false, - "time": "23:57", - "unixtime": 1725746266, - "uptime": 252, - "ram_size": 259816, - "ram_free": 131616, - "fs_size": 1048576, - "fs_free": 593920, - "cfg_rev": 13, - "kvs_rev": 0, - "schedule_rev": 0, - "webhook_rev": 0, - "available_updates": {}, - "reset_reason": 3 - }, - "config": { - "device": { - "name": "My Shelly i4 Gen3", - "mac": "5432045661B4", - "fw_id": "20240819-074305/1.4.2-gc2639da", - "discoverable": true, - "eco_mode": false, - "addon_type": null - }, - "location": { - "tz": "Europe/Monaco", - "lat": 43.7314, - "lon": 7.419 - }, - "debug": { - "level": 2, - "file_level": null, - "mqtt": { - "enable": false - }, - "websocket": { - "enable": false - }, - "udp": { - "addr": null - } - }, - "ui_data": {}, - "rpc_udp": { - "dst_addr": null, - "listen_port": null - }, - "sntp": { - "server": "time.google.com" - }, - "cfg_rev": 13 - } - } - ] -} + "components": [], + "cfg_rev": 15, + "offset": 0, + "total": 0 +} \ No newline at end of file diff --git a/src/mock/shellyi4g3-5432045661B4.mdns.json b/src/mock/shellyi4g3-5432045661B4.mdns.json index 51da85f..2f1ab43 100644 --- a/src/mock/shellyi4g3-5432045661B4.mdns.json +++ b/src/mock/shellyi4g3-5432045661B4.mdns.json @@ -21,30 +21,6 @@ "class": "IN", "flush": false, "data": "shellyi4g3-5432045661b4._http._tcp.local" - }, - { - "name": "_shelly._tcp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "shellyi4g3-5432045661b4._shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_shelly._tcp.local" - }, - { - "name": "_services._dns-sd._udp.local", - "type": "PTR", - "ttl": 120, - "class": "IN", - "flush": false, - "data": "_http._tcp.local" } ], "authorities": [], @@ -68,36 +44,9 @@ "ttl": 120, "class": "IN", "flush": false, - "data": ["gen=3"] - }, - { - "name": "ShellyI4G3-5432045661B4.local", - "type": "A", - "ttl": 120, - "class": "IN", - "flush": true, - "data": "192.168.1.159" - }, - { - "name": "shellyi4g3-5432045661b4._shelly._tcp.local", - "type": "SRV", - "ttl": 120, - "class": "IN", - "flush": false, - "data": { - "priority": 0, - "weight": 0, - "port": 80, - "target": "ShellyI4G3-5432045661B4.local" - } - }, - { - "name": "shellyi4g3-5432045661b4._shelly._tcp.local", - "type": "TXT", - "ttl": 120, - "class": "IN", - "flush": false, - "data": ["gen=3", "app=I4G3", "ver=1.4.2"] + "data": [ + "gen=3" + ] }, { "name": "ShellyI4G3-5432045661B4.local", @@ -108,4 +57,4 @@ "data": "192.168.1.159" } ] -} +} \ No newline at end of file diff --git a/src/shellyDevice.mock.test.ts b/src/shellyDevice.mock.test.ts index bb7b5fd..699e09d 100644 --- a/src/shellyDevice.mock.test.ts +++ b/src/shellyDevice.mock.test.ts @@ -1821,6 +1821,10 @@ describe('Shelly devices test', () => { expect(device.getComponent('switch:0')?.hasProperty('aenergy')).toBe(true); expect((device.getComponent('switch:0')?.getValue('aenergy') as ShellyData).total).toBeGreaterThanOrEqual(0); + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(0); + expect(device.bthomeSensors.size).toBe(0); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); @@ -1841,7 +1845,7 @@ describe('Shelly devices test', () => { expect(device.auth).toBe(false); expect(device.gen).toBe(3); expect(device.profile).toBe(undefined); - expect(device.name).toBe('My Shelly EM Gen3'); + expect(device.name).toBe('EM Gen3'); expect(device.hasUpdate).toBe(false); expect(device.lastseen).not.toBe(0); expect(device.online).toBe(true); @@ -1855,6 +1859,10 @@ describe('Shelly devices test', () => { expect(device.getComponent('sys')?.getValue('temperature')).toBe(undefined); expect(device.getComponent('sys')?.getValue('overtemperature')).toBe(undefined); + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(0); + expect(device.bthomeSensors.size).toBe(0); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); @@ -1875,7 +1883,7 @@ describe('Shelly devices test', () => { expect(device.auth).toBe(false); expect(device.gen).toBe(3); expect(device.profile).toBe(undefined); - expect(device.name).toBe('My Shelly DALI Dimmer Gen3'); + expect(device.name).toBe('DALI Dimmer Gen3'); expect(device.hasUpdate).toBe(false); expect(device.lastseen).not.toBe(0); expect(device.online).toBe(true); @@ -1896,6 +1904,10 @@ describe('Shelly devices test', () => { expect(device.getComponent('light:0')?.hasProperty('green')).toBe(false); expect(device.getComponent('light:0')?.hasProperty('blu')).toBe(false); + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(0); + expect(device.bthomeSensors.size).toBe(0); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); @@ -1912,11 +1924,11 @@ describe('Shelly devices test', () => { expect(device.model).toBe('S3SW-001X16EU'); expect(device.mac).toBe('34B7DACAC830'); expect(device.id).toBe(id); - expect(device.firmware).toBe('1.4.2-gc2639da'); // firmwareGen2 + expect(device.firmware).toBe(firmwareGen2); expect(device.auth).toBe(false); expect(device.gen).toBe(3); expect(device.profile).toBe(undefined); - expect(device.name).toBe('My Shelly 1 Gen3'); + expect(device.name).toBe('1 Gen3'); expect(device.hasUpdate).toBe(false); expect(device.lastseen).not.toBe(0); expect(device.online).toBe(true); @@ -1939,6 +1951,57 @@ describe('Shelly devices test', () => { expect(device.getComponent('switch:0')?.hasProperty('green')).toBe(false); expect(device.getComponent('switch:0')?.hasProperty('blu')).toBe(false); + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(0); + expect(device.bthomeSensors.size).toBe(0); + + expect(await device.fetchUpdate()).not.toBeNull(); + + if (device) device.destroy(); + }); + + test('Create a gen 3 shelly1minig3 device', async () => { + id = 'shelly1minig3-543204547478'; + log.logName = id; + + device = await ShellyDevice.create(shelly, log, path.join('src', 'mock', id + '.json')); + expect(device).not.toBeUndefined(); + if (!device) return; + expect(device.host).toBe(path.join('src', 'mock', id + '.json')); + expect(device.model).toBe('S3SW-001X8EU'); + expect(device.mac).toBe('543204547478'); + expect(device.id).toBe(id); + expect(device.firmware).toBe(firmwareGen2); + expect(device.auth).toBe(true); + expect(device.gen).toBe(3); + expect(device.profile).toBe(undefined); + expect(device.name).toBe('1mini Gen3'); + expect(device.hasUpdate).toBe(false); + expect(device.lastseen).not.toBe(0); + expect(device.online).toBe(true); + expect(device.cached).toBe(false); + expect(device.sleepMode).toBe(false); + + expect(device.components.length).toBe(11); + expect(device.getComponentNames()).toStrictEqual(['Ble', 'Cloud', 'Input', 'MQTT', 'Switch', 'Sys', 'Sntp', 'WiFi', 'WS']); + expect(device.getComponentIds()).toStrictEqual(['ble', 'cloud', 'input:0', 'mqtt', 'switch:0', 'sys', 'sntp', 'wifi_ap', 'wifi_sta', 'wifi_sta1', 'ws']); + + expect(device.getComponent('sys')?.getValue('temperature')).toBe(undefined); + expect(device.getComponent('sys')?.getValue('overtemperature')).toBe(undefined); + + expect(device.getComponent('input:0')?.hasProperty('state')).toBe(true); + + expect(device.getComponent('switch:0')?.hasProperty('state')).toBe(true); + expect(device.getComponent('switch:0')?.hasProperty('brightness')).toBe(false); + expect(device.getComponent('switch:0')?.hasProperty('rgb')).toBe(false); + expect(device.getComponent('switch:0')?.hasProperty('red')).toBe(false); + expect(device.getComponent('switch:0')?.hasProperty('green')).toBe(false); + expect(device.getComponent('switch:0')?.hasProperty('blu')).toBe(false); + + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(4); + expect(device.bthomeSensors.size).toBe(13); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); @@ -1955,11 +2018,11 @@ describe('Shelly devices test', () => { expect(device.model).toBe('S3SW-001P16EU'); expect(device.mac).toBe('34B7DAC68344'); expect(device.id).toBe(id); - expect(device.firmware).toBe('1.4.2-gc2639da'); // firmwareGen2 + expect(device.firmware).toBe(firmwareGen2); expect(device.auth).toBe(false); expect(device.gen).toBe(3); expect(device.profile).toBe(undefined); - expect(device.name).toBe('My Shelly 1PM Gen3'); + expect(device.name).toBe('1PM Gen3'); expect(device.hasUpdate).toBe(false); expect(device.lastseen).not.toBe(0); expect(device.online).toBe(true); @@ -1988,6 +2051,10 @@ describe('Shelly devices test', () => { expect(device.getComponent('switch:0')?.hasProperty('aenergy')).toBe(true); expect((device.getComponent('switch:0')?.getValue('aenergy') as ShellyData).total).toBeGreaterThanOrEqual(0); + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(3); + expect(device.bthomeSensors.size).toBe(10); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); @@ -2053,6 +2120,10 @@ describe('Shelly devices test', () => { expect(device.getComponent('switch:1')?.hasProperty('aenergy')).toBe(true); expect((device.getComponent('switch:1')?.getValue('aenergy') as ShellyData).total).toBeGreaterThanOrEqual(0); + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(0); + expect(device.bthomeSensors.size).toBe(0); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); @@ -2097,6 +2168,10 @@ describe('Shelly devices test', () => { expect(device.getComponent('cover:0')?.hasProperty('aenergy')).toBe(true); expect((device.getComponent('cover:0')?.getValue('aenergy') as ShellyData).total).toBeGreaterThanOrEqual(0); + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(0); + expect(device.bthomeSensors.size).toBe(0); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); @@ -2113,11 +2188,11 @@ describe('Shelly devices test', () => { expect(device.model).toBe('S3SN-0024X'); expect(device.mac).toBe('5432045661B4'); expect(device.id).toBe(id); - expect(device.firmware).toBe('1.4.2-gc2639da'); // firmwareGen2 + expect(device.firmware).toBe(firmwareGen2); expect(device.auth).toBe(false); expect(device.gen).toBe(3); expect(device.profile).toBe(undefined); - expect(device.name).toBe('My Shelly i4 Gen3'); + expect(device.name).toBe('i4 Gen3'); expect(device.hasUpdate).toBe(false); expect(device.lastseen).not.toBe(0); expect(device.online).toBe(true); @@ -2136,6 +2211,10 @@ describe('Shelly devices test', () => { expect(device.getComponent('input:2')?.hasProperty('state')).toBe(true); expect(device.getComponent('input:3')?.hasProperty('state')).toBe(true); + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(0); + expect(device.bthomeSensors.size).toBe(0); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); @@ -2182,6 +2261,10 @@ describe('Shelly devices test', () => { expect(device.getComponent('light:0')?.hasProperty('apower')).toBe(true); expect(device.getComponent('light:0')?.hasProperty('aenergy')).toBe(true); + expect(device.bthomeTrvs.size).toBe(0); + expect(device.bthomeDevices.size).toBe(0); + expect(device.bthomeSensors.size).toBe(0); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); @@ -2198,7 +2281,7 @@ describe('Shelly devices test', () => { expect(device.model).toBe('S3GW-1DBT001'); expect(device.mac).toBe('34CDB077BCD4'); expect(device.id).toBe(id); - expect(device.firmware).toBe('1.4.99-blugwg3prod1-ga62dce2'); + expect(device.firmware).toBe('1.4.99-blugwg3prod4-g110402b'); expect(device.auth).toBe(false); expect(device.gen).toBe(3); expect(device.profile).toBe(undefined); @@ -2216,6 +2299,10 @@ describe('Shelly devices test', () => { expect(device.getComponent('sys')?.getValue('temperature')).toBe(undefined); expect(device.getComponent('sys')?.getValue('overtemperature')).toBe(undefined); + expect(device.bthomeTrvs.size).toBe(2); + expect(device.bthomeDevices.size).toBe(5); + expect(device.bthomeSensors.size).toBe(20); + expect(await device.fetchUpdate()).not.toBeNull(); if (device) device.destroy(); From 24b2603e4088e6851bd72187069a0ec7a19a72a8 Mon Sep 17 00:00:00 2001 From: Luligu Date: Wed, 20 Nov 2024 18:17:35 +0100 Subject: [PATCH 12/15] Refactor Jest real tests for Gen3 devices --- src/shellyDevice.realgen3.test.ts | 216 ++++++++++++++++++++++++++++-- 1 file changed, 202 insertions(+), 14 deletions(-) diff --git a/src/shellyDevice.realgen3.test.ts b/src/shellyDevice.realgen3.test.ts index d0c9564..45f3643 100644 --- a/src/shellyDevice.realgen3.test.ts +++ b/src/shellyDevice.realgen3.test.ts @@ -188,26 +188,124 @@ describe('Shellies', () => { expect(device.getComponentIds()).toStrictEqual(['ble', 'cloud', 'input:0', 'mqtt', 'switch:0', 'sys', 'sntp', 'wifi_ap', 'wifi_sta', 'wifi_sta1', 'ws']); expect(device.bthomeTrvs.size).toBe(0); - expect(device.bthomeDevices.size).toBe(0); - expect(device.bthomeSensors.size).toBe(0); + + expect(device.bthomeDevices.size).toBe(4); + expect(device.bthomeDevices.has('0c:ef:f6:f1:d7:7b')).toBe(true); + expect(device.bthomeDevices.get('0c:ef:f6:f1:d7:7b')?.model).toBe('Shelly BLU DoorWindow'); + expect(device.bthomeDevices.has('38:39:8f:8b:d2:29')).toBe(true); + expect(device.bthomeDevices.get('38:39:8f:8b:d2:29')?.model).toBe('Shelly BLU Button1'); + expect(device.bthomeDevices.has('7c:c6:b6:65:2d:87')).toBe(true); + expect(device.bthomeDevices.get('7c:c6:b6:65:2d:87')?.model).toBe('Shelly BLU HT'); + expect(device.bthomeDevices.has('0c:ae:5f:5a:0b:fa')).toBe(true); + expect(device.bthomeDevices.get('0c:ae:5f:5a:0b:fa')?.model).toBe('Shelly BLU Motion'); + + expect(device.bthomeSensors.size).toBe(14); + + // BLU DoorWindow + expect(device.bthomeSensors.has('bthomesensor:200')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:200')?.addr).toBe('0c:ef:f6:f1:d7:7b'); + expect(device.bthomeSensors.get('bthomesensor:200')?.name).toBe('Battery'); + expect(device.bthomeSensors.get('bthomesensor:200')?.sensorId).toBe(1); + expect(device.bthomeSensors.get('bthomesensor:200')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:201')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:201')?.addr).toBe('0c:ef:f6:f1:d7:7b'); + expect(device.bthomeSensors.get('bthomesensor:201')?.name).toBe('Illuminance'); + expect(device.bthomeSensors.get('bthomesensor:201')?.sensorId).toBe(5); + expect(device.bthomeSensors.get('bthomesensor:201')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:202')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:202')?.addr).toBe('0c:ef:f6:f1:d7:7b'); + expect(device.bthomeSensors.get('bthomesensor:202')?.name).toBe('Contact'); + expect(device.bthomeSensors.get('bthomesensor:202')?.sensorId).toBe(45); + expect(device.bthomeSensors.get('bthomesensor:202')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:203')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:203')?.addr).toBe('0c:ef:f6:f1:d7:7b'); + expect(device.bthomeSensors.get('bthomesensor:203')?.name).toBe('Rotation'); + expect(device.bthomeSensors.get('bthomesensor:203')?.sensorId).toBe(63); + expect(device.bthomeSensors.get('bthomesensor:203')?.sensorIdx).toBe(0); + + // BLU Button + expect(device.bthomeSensors.has('bthomesensor:204')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:204')?.addr).toBe('38:39:8f:8b:d2:29'); + expect(device.bthomeSensors.get('bthomesensor:204')?.name).toBe('Battery'); + expect(device.bthomeSensors.get('bthomesensor:204')?.sensorId).toBe(1); + expect(device.bthomeSensors.get('bthomesensor:204')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:205')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:205')?.addr).toBe('38:39:8f:8b:d2:29'); + expect(device.bthomeSensors.get('bthomesensor:205')?.name).toBe('Button'); + expect(device.bthomeSensors.get('bthomesensor:205')?.sensorId).toBe(58); + expect(device.bthomeSensors.get('bthomesensor:205')?.sensorIdx).toBe(0); + + // BLU HT + expect(device.bthomeSensors.has('bthomesensor:206')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:206')?.addr).toBe('7c:c6:b6:65:2d:87'); + expect(device.bthomeSensors.get('bthomesensor:206')?.name).toBe('Battery'); + expect(device.bthomeSensors.get('bthomesensor:206')?.sensorId).toBe(1); + expect(device.bthomeSensors.get('bthomesensor:206')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:207')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:207')?.addr).toBe('7c:c6:b6:65:2d:87'); + expect(device.bthomeSensors.get('bthomesensor:207')?.name).toBe('Humidity'); + expect(device.bthomeSensors.get('bthomesensor:207')?.sensorId).toBe(46); + expect(device.bthomeSensors.get('bthomesensor:207')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:208')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:208')?.addr).toBe('7c:c6:b6:65:2d:87'); + expect(device.bthomeSensors.get('bthomesensor:208')?.name).toBe('Button'); + expect(device.bthomeSensors.get('bthomesensor:208')?.sensorId).toBe(58); + expect(device.bthomeSensors.get('bthomesensor:208')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:209')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:209')?.addr).toBe('7c:c6:b6:65:2d:87'); + expect(device.bthomeSensors.get('bthomesensor:209')?.name).toBe('Temperature'); + expect(device.bthomeSensors.get('bthomesensor:209')?.sensorId).toBe(69); + expect(device.bthomeSensors.get('bthomesensor:209')?.sensorIdx).toBe(0); + + // BLU Motion + expect(device.bthomeSensors.has('bthomesensor:210')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:210')?.addr).toBe('0c:ae:5f:5a:0b:fa'); + expect(device.bthomeSensors.get('bthomesensor:210')?.name).toBe('Battery'); + expect(device.bthomeSensors.get('bthomesensor:210')?.sensorId).toBe(1); + expect(device.bthomeSensors.get('bthomesensor:210')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:211')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:211')?.addr).toBe('0c:ae:5f:5a:0b:fa'); + expect(device.bthomeSensors.get('bthomesensor:211')?.name).toBe('Motion'); + expect(device.bthomeSensors.get('bthomesensor:211')?.sensorId).toBe(33); + expect(device.bthomeSensors.get('bthomesensor:211')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:212')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:212')?.addr).toBe('0c:ae:5f:5a:0b:fa'); + expect(device.bthomeSensors.get('bthomesensor:212')?.name).toBe('Button'); + expect(device.bthomeSensors.get('bthomesensor:212')?.sensorId).toBe(58); + expect(device.bthomeSensors.get('bthomesensor:212')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:213')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:213')?.addr).toBe('0c:ae:5f:5a:0b:fa'); + expect(device.bthomeSensors.get('bthomesensor:213')?.name).toBe('Illuminance'); + expect(device.bthomeSensors.get('bthomesensor:213')?.sensorId).toBe(5); + expect(device.bthomeSensors.get('bthomesensor:213')?.sensorIdx).toBe(0); const component = device.getComponent('switch:0'); expect(component).not.toBeUndefined(); // prettier-ignore if (isSwitchComponent(component)) { - component.On(); - await waiter('On', () => { return component.getValue('state') === true; }, true); + component.On(); + await waiter('On', () => { return component.getValue('state') === true; }, true); - component.Off(); - await waiter('Off', () => { return component.getValue('state') === false; }, true); + component.Off(); + await waiter('Off', () => { return component.getValue('state') === false; }, true); - component.Toggle(); - await waiter('Toggle', () => { return component.getValue('state') === true; }, true); + component.Toggle(); + await waiter('Toggle', () => { return component.getValue('state') === true; }, true); - component.Off(); - await waiter('Off', () => { return component.getValue('state') === false; }, true); - } + component.Off(); + await waiter('Off', () => { return component.getValue('state') === false; }, true); + } shelly.removeDevice(device); device.destroy(); @@ -423,11 +521,21 @@ describe('Shellies', () => { expect(device.getComponentNames()).toStrictEqual(['Ble', 'Cloud', 'Input', 'MQTT', 'Switch', 'Sys', 'Sntp', 'WiFi', 'WS']); expect(device.getComponentIds()).toStrictEqual(['ble', 'cloud', 'input:0', 'input:1', 'mqtt', 'switch:0', 'switch:1', 'sys', 'sntp', 'wifi_ap', 'wifi_sta', 'wifi_sta1', 'ws']); - expect(device.bthomeDevices.size).toBe(1); + expect(device.bthomeTrvs.size).toBe(0); + + expect(device.bthomeDevices.size).toBe(4); expect(device.bthomeDevices.has('7c:c6:b6:58:b9:a0')).toBe(true); expect(device.bthomeDevices.get('7c:c6:b6:58:b9:a0')?.model).toBe('Shelly BLU RC Button 4'); + expect(device.bthomeDevices.has('0c:ef:f6:01:8d:b8')).toBe(true); + expect(device.bthomeDevices.get('0c:ef:f6:01:8d:b8')?.model).toBe('Shelly BLU Wall Switch 4'); + expect(device.bthomeDevices.has('0c:ef:f6:f1:d7:7b')).toBe(true); + expect(device.bthomeDevices.get('0c:ef:f6:f1:d7:7b')?.model).toBe('Shelly BLU DoorWindow'); + expect(device.bthomeDevices.has('0c:ae:5f:5a:0b:fa')).toBe(true); + expect(device.bthomeDevices.get('0c:ae:5f:5a:0b:fa')?.model).toBe('Shelly BLU Motion'); + + expect(device.bthomeSensors.size).toBe(18); - expect(device.bthomeSensors.size).toBe(5); + // BLU RC Button 4 expect(device.bthomeSensors.has('bthomesensor:200')).toBe(true); expect(device.bthomeSensors.get('bthomesensor:200')?.addr).toBe('7c:c6:b6:58:b9:a0'); expect(device.bthomeSensors.get('bthomesensor:200')?.name).toBe('Battery'); @@ -457,7 +565,87 @@ describe('Shellies', () => { expect(device.bthomeSensors.get('bthomesensor:204')?.name).toBe('Button'); expect(device.bthomeSensors.get('bthomesensor:204')?.sensorId).toBe(58); expect(device.bthomeSensors.get('bthomesensor:204')?.sensorIdx).toBe(3); - expect(device.bthomeTrvs.size).toBe(0); + + // BLU RC Wall Switch 4 + expect(device.bthomeSensors.has('bthomesensor:205')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:205')?.addr).toBe('0c:ef:f6:01:8d:b8'); + expect(device.bthomeSensors.get('bthomesensor:205')?.name).toBe('Battery'); + expect(device.bthomeSensors.get('bthomesensor:205')?.sensorId).toBe(1); + expect(device.bthomeSensors.get('bthomesensor:205')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:206')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:206')?.addr).toBe('0c:ef:f6:01:8d:b8'); + expect(device.bthomeSensors.get('bthomesensor:206')?.name).toBe('Button'); + expect(device.bthomeSensors.get('bthomesensor:206')?.sensorId).toBe(58); + expect(device.bthomeSensors.get('bthomesensor:206')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:207')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:207')?.addr).toBe('0c:ef:f6:01:8d:b8'); + expect(device.bthomeSensors.get('bthomesensor:207')?.name).toBe('Button'); + expect(device.bthomeSensors.get('bthomesensor:207')?.sensorId).toBe(58); + expect(device.bthomeSensors.get('bthomesensor:207')?.sensorIdx).toBe(1); + + expect(device.bthomeSensors.has('bthomesensor:208')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:208')?.addr).toBe('0c:ef:f6:01:8d:b8'); + expect(device.bthomeSensors.get('bthomesensor:208')?.name).toBe('Button'); + expect(device.bthomeSensors.get('bthomesensor:208')?.sensorId).toBe(58); + expect(device.bthomeSensors.get('bthomesensor:208')?.sensorIdx).toBe(2); + + expect(device.bthomeSensors.has('bthomesensor:209')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:209')?.addr).toBe('0c:ef:f6:01:8d:b8'); + expect(device.bthomeSensors.get('bthomesensor:209')?.name).toBe('Button'); + expect(device.bthomeSensors.get('bthomesensor:209')?.sensorId).toBe(58); + expect(device.bthomeSensors.get('bthomesensor:209')?.sensorIdx).toBe(3); + + // BLU DoorWindow + expect(device.bthomeSensors.has('bthomesensor:210')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:210')?.addr).toBe('0c:ef:f6:f1:d7:7b'); + expect(device.bthomeSensors.get('bthomesensor:210')?.name).toBe('Battery'); + expect(device.bthomeSensors.get('bthomesensor:210')?.sensorId).toBe(1); + expect(device.bthomeSensors.get('bthomesensor:210')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:211')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:211')?.addr).toBe('0c:ef:f6:f1:d7:7b'); + expect(device.bthomeSensors.get('bthomesensor:211')?.name).toBe('Illuminance'); + expect(device.bthomeSensors.get('bthomesensor:211')?.sensorId).toBe(5); + expect(device.bthomeSensors.get('bthomesensor:211')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:212')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:212')?.addr).toBe('0c:ef:f6:f1:d7:7b'); + expect(device.bthomeSensors.get('bthomesensor:212')?.name).toBe('Contact'); + expect(device.bthomeSensors.get('bthomesensor:212')?.sensorId).toBe(45); + expect(device.bthomeSensors.get('bthomesensor:212')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:213')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:213')?.addr).toBe('0c:ef:f6:f1:d7:7b'); + expect(device.bthomeSensors.get('bthomesensor:213')?.name).toBe('Rotation'); + expect(device.bthomeSensors.get('bthomesensor:213')?.sensorId).toBe(63); + expect(device.bthomeSensors.get('bthomesensor:213')?.sensorIdx).toBe(0); + + // BLU Motion + expect(device.bthomeSensors.has('bthomesensor:214')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:214')?.addr).toBe('0c:ae:5f:5a:0b:fa'); + expect(device.bthomeSensors.get('bthomesensor:214')?.name).toBe('Battery'); + expect(device.bthomeSensors.get('bthomesensor:214')?.sensorId).toBe(1); + expect(device.bthomeSensors.get('bthomesensor:214')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:215')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:215')?.addr).toBe('0c:ae:5f:5a:0b:fa'); + expect(device.bthomeSensors.get('bthomesensor:215')?.name).toBe('Motion'); + expect(device.bthomeSensors.get('bthomesensor:215')?.sensorId).toBe(33); + expect(device.bthomeSensors.get('bthomesensor:215')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:216')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:216')?.addr).toBe('0c:ae:5f:5a:0b:fa'); + expect(device.bthomeSensors.get('bthomesensor:216')?.name).toBe('Button'); + expect(device.bthomeSensors.get('bthomesensor:216')?.sensorId).toBe(58); + expect(device.bthomeSensors.get('bthomesensor:216')?.sensorIdx).toBe(0); + + expect(device.bthomeSensors.has('bthomesensor:217')).toBe(true); + expect(device.bthomeSensors.get('bthomesensor:217')?.addr).toBe('0c:ae:5f:5a:0b:fa'); + expect(device.bthomeSensors.get('bthomesensor:217')?.name).toBe('Illuminance'); + expect(device.bthomeSensors.get('bthomesensor:217')?.sensorId).toBe(5); + expect(device.bthomeSensors.get('bthomesensor:217')?.sensorIdx).toBe(0); const component = device.getComponent('switch:0'); expect(component).not.toBeUndefined(); From 7b7ec9beee8ba1436c9d34639bfda2b6148964d3 Mon Sep 17 00:00:00 2001 From: Luligu Date: Thu, 21 Nov 2024 10:53:10 +0100 Subject: [PATCH 13/15] Release 1.0.10 --- CHANGELOG.md | 7 ++++++- package-lock.json | 10 +++++----- package.json | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75300b8..43de514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,16 @@ All notable changes to this project will be documented in this file. If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge-shelly and sponsoring it. -## [1.0.10] - 2024-11-20 +You can also sponsor Tamer here https://buymeacoffee.com/6sjde6vkzl for his invaluable contribution to this project. + +## [1.0.10] - 2024-11-21 ### Added - [edge]: Preliminary updates to support Matterbridge edge (matter.js new API). +- [Jest]: Refactor Jest real tests for Gen3 devices +- [Jest]: Refactor Jest mock tests for Gen3 devices +- [Jest]: Added Jest mock tests for shellyswitch25 switch and cover mode ### Changed diff --git a/package-lock.json b/package-lock.json index 5a07692..c7fa798 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "matterbridge-shelly", - "version": "1.0.10-dev.3", + "version": "1.0.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "matterbridge-shelly", - "version": "1.0.10-dev.3", + "version": "1.0.10", "license": "Apache-2.0", "dependencies": { "coap": "1.4.0", @@ -2163,9 +2163,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001680", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz", - "integrity": "sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA==", + "version": "1.0.30001683", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001683.tgz", + "integrity": "sha512-iqmNnThZ0n70mNwvxpEC2nBJ037ZHZUoBI5Gorh1Mw6IlEAZujEoU1tXA628iZfzm7R9FvFzxbfdgml82a3k8Q==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index 0275162..add87de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matterbridge-shelly", - "version": "1.0.10-dev.3", + "version": "1.0.10", "description": "Matterbridge shelly plugin", "author": "https://github.com/Luligu", "license": "Apache-2.0", From f41669f5402e8bceeb14f80daf38549242e76e35 Mon Sep 17 00:00:00 2001 From: Luligu Date: Thu, 21 Nov 2024 10:54:53 +0100 Subject: [PATCH 14/15] Release 1.0.10 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43de514..e8f8e9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge-shelly and sponsoring it. +If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge-shelly and sponsoring it here https://www.buymeacoffee.com/luligugithub. You can also sponsor Tamer here https://buymeacoffee.com/6sjde6vkzl for his invaluable contribution to this project. From 8cc70999cd1f5c78b29e4b414dd239a50c07f10a Mon Sep 17 00:00:00 2001 From: Luligu Date: Thu, 21 Nov 2024 10:59:54 +0100 Subject: [PATCH 15/15] Release 1.0.10 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 98e82a6..309a43e 100644 --- a/README.md +++ b/README.md @@ -57,13 +57,13 @@ I would like to express my appreciation to [Tamer Salah](https://github.com/tamm Follow these steps to install or update Matterbridge if it is not already installed and up to date: ``` -npm install -g matterbridge +npm install -g matterbridge --omit=dev ``` on Linux you may need the necessary permissions: ``` -sudo npm install -g matterbridge +sudo npm install -g matterbridge --omit=dev ``` See the complete guidelines on [Matterbridge](https://github.com/Luligu/matterbridge/blob/main/README.md) for more information. @@ -107,7 +107,7 @@ On windows: ``` cd $HOME\Matterbridge -npm install -g matterbridge-shelly +npm install -g matterbridge-shelly --omit=dev matterbridge -add matterbridge-shelly ``` @@ -115,7 +115,7 @@ On linux: ``` cd ~/Matterbridge -sudo npm install -g matterbridge-shelly +sudo npm install -g matterbridge-shelly --omit=dev matterbridge -add matterbridge-shelly ```