From 1bc9bef7e8cdd1307cc4e7333be7e7381ea0cf76 Mon Sep 17 00:00:00 2001 From: Marc Sowen Date: Tue, 21 Dec 2021 16:18:07 +0100 Subject: [PATCH] Added device-specific config. Added config options for HmIP-DLD. --- CHANGELOG.md | 13 ++ package-lock.json | 198 +++++++++++++++---------------- package.json | 10 +- src/HmIPPlatform.ts | 31 ++++- src/HmIPSecuritySystem.ts | 3 + src/devices/HmIPDoorLockDrive.ts | 42 ++++--- src/devices/HmIPGenericDevice.ts | 6 + src/settings.ts | 2 +- 8 files changed, 180 insertions(+), 125 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51ce970..d6b4277 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## 0.7.1 (2021-12-21) + +### Improvements + +- **General**: Added per-device config. All devices can be hidden by setting config.json option "hidden": true. See + [GitHub Wiki](https://github.com/marcsowen/homebridge-homematicip/wiki) for details. +- **HmIP-DLD**: New option "openLatch". When set to true, opening the lock will open the door completely by pulling + the door latch. + +### Bugfix + +- **HmIP-DLD**: Lock target state was not always updated correctly displaying an opening/closing animation in Home app. + ## 0.7.0 (2021-12-18) ### New devices diff --git a/package-lock.json b/package-lock.json index 05114d4..e666da9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "homebridge-homematicip", - "version": "0.7.0", + "version": "0.7.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "homebridge-homematicip", - "version": "0.7.0", + "version": "0.7.1", "license": "Apache-2.0", "dependencies": { "bottleneck": "^2.19.5", @@ -14,13 +14,13 @@ "moment": "^2.29.1", "node-fetch": "3.0.0-beta.9", "semver": "^7.3.5", - "ws": "^8.3.0" + "ws": "^8.4.0" }, "devDependencies": { - "@types/node": "^17.0.0", + "@types/node": "^17.0.2", "@types/ws": "^8.2.2", - "@typescript-eslint/eslint-plugin": "^5.7.0", - "@typescript-eslint/parser": "^5.7.0", + "@typescript-eslint/eslint-plugin": "^5.8.0", + "@typescript-eslint/parser": "^5.8.0", "abort-controller": "^3.0.0", "eslint": "^8.5.0", "homebridge": "^1.3.8", @@ -203,9 +203,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", - "integrity": "sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==", + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz", + "integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA==", "dev": true }, "node_modules/@types/ws": { @@ -218,13 +218,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.7.0.tgz", - "integrity": "sha512-8RTGBpNn5a9M628wBPrCbJ+v3YTEOE2qeZb7TDkGKTDXSj36KGRg92SpFFaR/0S3rSXQxM0Og/kV9EyadsYSBg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.0.tgz", + "integrity": "sha512-spu1UW7QuBn0nJ6+psnfCc3iVoQAifjKORgBngKOmC8U/1tbe2YJMzYQqDGYB4JCss7L8+RM2kKLb1B1Aw9BNA==", "dev": true, "dependencies": { - "@typescript-eslint/experimental-utils": "5.7.0", - "@typescript-eslint/scope-manager": "5.7.0", + "@typescript-eslint/experimental-utils": "5.8.0", + "@typescript-eslint/scope-manager": "5.8.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -259,15 +259,15 @@ } }, "node_modules/@typescript-eslint/experimental-utils": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.7.0.tgz", - "integrity": "sha512-u57eZ5FbEpzN5kSjmVrSesovWslH2ZyNPnaXQMXWgH57d5+EVHEt76W75vVuI9qKZ5BMDKNfRN+pxcPEjQjb2A==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.0.tgz", + "integrity": "sha512-KN5FvNH71bhZ8fKtL+lhW7bjm7cxs1nt+hrDZWIqb6ViCffQcWyLunGrgvISgkRojIDcXIsH+xlFfI4RCDA0xA==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.7.0", - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/typescript-estree": "5.7.0", + "@typescript-eslint/scope-manager": "5.8.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/typescript-estree": "5.8.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -279,18 +279,18 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "node_modules/@typescript-eslint/parser": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.7.0.tgz", - "integrity": "sha512-m/gWCCcS4jXw6vkrPQ1BjZ1vomP01PArgzvauBqzsoZ3urLbsRChexB8/YV8z9HwE3qlJM35FxfKZ1nfP/4x8g==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.0.tgz", + "integrity": "sha512-Gleacp/ZhRtJRYs5/T8KQR3pAQjQI89Dn/k+OzyCKOsLiZH2/Vh60cFBTnFsHNI6WAD+lNUo/xGZ4NeA5u0Ipw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.7.0", - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/typescript-estree": "5.7.0", + "@typescript-eslint/scope-manager": "5.8.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/typescript-estree": "5.8.0", "debug": "^4.3.2" }, "engines": { @@ -310,13 +310,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.7.0.tgz", - "integrity": "sha512-7mxR520DGq5F7sSSgM0HSSMJ+TFUymOeFRMfUfGFAVBv8BR+Jv1vHgAouYUvWRZeszVBJlLcc9fDdktxb5kmxA==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.0.tgz", + "integrity": "sha512-x82CYJsLOjPCDuFFEbS6e7K1QEWj7u5Wk1alw8A+gnJiYwNnDJk0ib6PCegbaPMjrfBvFKa7SxE3EOnnIQz2Gg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/visitor-keys": "5.7.0" + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/visitor-keys": "5.8.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -327,9 +327,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.7.0.tgz", - "integrity": "sha512-5AeYIF5p2kAneIpnLFve8g50VyAjq7udM7ApZZ9JYjdPjkz0LvODfuSHIDUVnIuUoxafoWzpFyU7Sqbxgi79mA==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.0.tgz", + "integrity": "sha512-LdCYOqeqZWqCMOmwFnum6YfW9F3nKuxJiR84CdIRN5nfHJ7gyvGpXWqL/AaW0k3Po0+wm93ARAsOdzlZDPCcXg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -340,13 +340,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.7.0.tgz", - "integrity": "sha512-aO1Ql+izMrTnPj5aFFlEJkpD4jRqC4Gwhygu2oHK2wfVQpmOPbyDSveJ+r/NQo+PWV43M6uEAeLVbTi09dFLhg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.0.tgz", + "integrity": "sha512-srfeZ3URdEcUsSLbkOFqS7WoxOqn8JNil2NSLO9O+I2/Uyc85+UlfpEvQHIpj5dVts7KKOZnftoJD/Fdv0L7nQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/visitor-keys": "5.7.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/visitor-keys": "5.8.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -367,12 +367,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.7.0.tgz", - "integrity": "sha512-hdohahZ4lTFcglZSJ3DGdzxQHBSxsLVqHzkiOmKi7xVAWC4y2c1bIMKmPJSrA4aOEoRUPOKQ87Y/taC7yVHpFg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.0.tgz", + "integrity": "sha512-+HDIGOEMnqbxdAHegxvnOqESUH6RWFRR2b8qxP1W9CZnnYh4Usz6MBL+2KMAgPk/P0o9c1HqnYtwzVH6GTIqug==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.7.0", + "@typescript-eslint/types": "5.8.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -1494,9 +1494,9 @@ "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" }, "node_modules/fastq": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", - "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -1780,9 +1780,9 @@ } }, "node_modules/globby/node_modules/ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, "engines": { "node": ">= 4" @@ -3918,9 +3918,9 @@ } }, "node_modules/ws": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.3.0.tgz", - "integrity": "sha512-Gs5EZtpqZzLvmIM59w4igITU57lrtYVFneaa434VROv4thzJyV6UjIL3D42lslWlI+D4KzLYnxSwtfuiO79sNw==", + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz", + "integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==", "engines": { "node": ">=10.0.0" }, @@ -4101,9 +4101,9 @@ "dev": true }, "@types/node": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", - "integrity": "sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==", + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz", + "integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA==", "dev": true }, "@types/ws": { @@ -4116,13 +4116,13 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.7.0.tgz", - "integrity": "sha512-8RTGBpNn5a9M628wBPrCbJ+v3YTEOE2qeZb7TDkGKTDXSj36KGRg92SpFFaR/0S3rSXQxM0Og/kV9EyadsYSBg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.0.tgz", + "integrity": "sha512-spu1UW7QuBn0nJ6+psnfCc3iVoQAifjKORgBngKOmC8U/1tbe2YJMzYQqDGYB4JCss7L8+RM2kKLb1B1Aw9BNA==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "5.7.0", - "@typescript-eslint/scope-manager": "5.7.0", + "@typescript-eslint/experimental-utils": "5.8.0", + "@typescript-eslint/scope-manager": "5.8.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -4140,55 +4140,55 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.7.0.tgz", - "integrity": "sha512-u57eZ5FbEpzN5kSjmVrSesovWslH2ZyNPnaXQMXWgH57d5+EVHEt76W75vVuI9qKZ5BMDKNfRN+pxcPEjQjb2A==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.0.tgz", + "integrity": "sha512-KN5FvNH71bhZ8fKtL+lhW7bjm7cxs1nt+hrDZWIqb6ViCffQcWyLunGrgvISgkRojIDcXIsH+xlFfI4RCDA0xA==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.7.0", - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/typescript-estree": "5.7.0", + "@typescript-eslint/scope-manager": "5.8.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/typescript-estree": "5.8.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/parser": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.7.0.tgz", - "integrity": "sha512-m/gWCCcS4jXw6vkrPQ1BjZ1vomP01PArgzvauBqzsoZ3urLbsRChexB8/YV8z9HwE3qlJM35FxfKZ1nfP/4x8g==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.0.tgz", + "integrity": "sha512-Gleacp/ZhRtJRYs5/T8KQR3pAQjQI89Dn/k+OzyCKOsLiZH2/Vh60cFBTnFsHNI6WAD+lNUo/xGZ4NeA5u0Ipw==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.7.0", - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/typescript-estree": "5.7.0", + "@typescript-eslint/scope-manager": "5.8.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/typescript-estree": "5.8.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.7.0.tgz", - "integrity": "sha512-7mxR520DGq5F7sSSgM0HSSMJ+TFUymOeFRMfUfGFAVBv8BR+Jv1vHgAouYUvWRZeszVBJlLcc9fDdktxb5kmxA==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.0.tgz", + "integrity": "sha512-x82CYJsLOjPCDuFFEbS6e7K1QEWj7u5Wk1alw8A+gnJiYwNnDJk0ib6PCegbaPMjrfBvFKa7SxE3EOnnIQz2Gg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/visitor-keys": "5.7.0" + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/visitor-keys": "5.8.0" } }, "@typescript-eslint/types": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.7.0.tgz", - "integrity": "sha512-5AeYIF5p2kAneIpnLFve8g50VyAjq7udM7ApZZ9JYjdPjkz0LvODfuSHIDUVnIuUoxafoWzpFyU7Sqbxgi79mA==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.0.tgz", + "integrity": "sha512-LdCYOqeqZWqCMOmwFnum6YfW9F3nKuxJiR84CdIRN5nfHJ7gyvGpXWqL/AaW0k3Po0+wm93ARAsOdzlZDPCcXg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.7.0.tgz", - "integrity": "sha512-aO1Ql+izMrTnPj5aFFlEJkpD4jRqC4Gwhygu2oHK2wfVQpmOPbyDSveJ+r/NQo+PWV43M6uEAeLVbTi09dFLhg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.0.tgz", + "integrity": "sha512-srfeZ3URdEcUsSLbkOFqS7WoxOqn8JNil2NSLO9O+I2/Uyc85+UlfpEvQHIpj5dVts7KKOZnftoJD/Fdv0L7nQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/visitor-keys": "5.7.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/visitor-keys": "5.8.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -4197,12 +4197,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.7.0.tgz", - "integrity": "sha512-hdohahZ4lTFcglZSJ3DGdzxQHBSxsLVqHzkiOmKi7xVAWC4y2c1bIMKmPJSrA4aOEoRUPOKQ87Y/taC7yVHpFg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.0.tgz", + "integrity": "sha512-+HDIGOEMnqbxdAHegxvnOqESUH6RWFRR2b8qxP1W9CZnnYh4Usz6MBL+2KMAgPk/P0o9c1HqnYtwzVH6GTIqug==", "dev": true, "requires": { - "@typescript-eslint/types": "5.7.0", + "@typescript-eslint/types": "5.8.0", "eslint-visitor-keys": "^3.0.0" }, "dependencies": { @@ -5057,9 +5057,9 @@ "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" }, "fastq": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", - "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -5267,9 +5267,9 @@ }, "dependencies": { "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true } } @@ -6817,9 +6817,9 @@ } }, "ws": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.3.0.tgz", - "integrity": "sha512-Gs5EZtpqZzLvmIM59w4igITU57lrtYVFneaa434VROv4thzJyV6UjIL3D42lslWlI+D4KzLYnxSwtfuiO79sNw==", + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz", + "integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==", "requires": {} }, "xdg-basedir": { diff --git a/package.json b/package.json index 9fa77b9..77e79fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-homematicip", - "version": "0.7.0", + "version": "0.7.1", "description": "Homematic IP plugin for homebridge", "license": "Apache-2.0", "author": "Marc Sowen ", @@ -30,10 +30,10 @@ "homebridge": ">=1.0.0" }, "devDependencies": { - "@types/node": "^17.0.0", + "@types/node": "^17.0.2", "@types/ws": "^8.2.2", - "@typescript-eslint/eslint-plugin": "^5.7.0", - "@typescript-eslint/parser": "^5.7.0", + "@typescript-eslint/eslint-plugin": "^5.8.0", + "@typescript-eslint/parser": "^5.8.0", "abort-controller": "^3.0.0", "eslint": "^8.5.0", "homebridge": "^1.3.8", @@ -48,6 +48,6 @@ "moment": "^2.29.1", "node-fetch": "3.0.0-beta.9", "semver": "^7.3.5", - "ws": "^8.3.0" + "ws": "^8.4.0" } } diff --git a/src/HmIPPlatform.ts b/src/HmIPPlatform.ts index 24e4a76..73b0165 100644 --- a/src/HmIPPlatform.ts +++ b/src/HmIPPlatform.ts @@ -154,8 +154,21 @@ export class HmIPPlatform implements DynamicPlatformPlugin { this.updateAccessory(id, device); } + this.securitySystem = this.createSecuritySystem(hmIPState.home); + // find cached but now removed accessories and unregister them const accessoriesToBeRemoved: PlatformAccessory[] = []; + + if (this.securitySystem.hidden) { + const id = hmIPState.home.id + '_security'; + const uuid = this.api.hap.uuid.generate(id); + const cachedAccessory = this.getAccessory(uuid); + if (cachedAccessory !== undefined) { + this.log.info('Removing home security system'); + accessoriesToBeRemoved.push(cachedAccessory); + } + } + for (const id in hmIPState.devices) { if (!this.deviceMap.has(id)) { const uuid = this.api.hap.uuid.generate(id); @@ -172,8 +185,6 @@ export class HmIPPlatform implements DynamicPlatformPlugin { this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessoriesToBeRemoved); } - this.securitySystem = this.createSecuritySystem(hmIPState.home); - // Start websocket immediately and register handlers await this.connector.connectWs(data => { const stateChange = JSON.parse(data.toString()); @@ -307,8 +318,11 @@ export class HmIPPlatform implements DynamicPlatformPlugin { this.log.warn(`Device not implemented: ${device.modelType} - ${device.label} via type ${device.type}`); return; } - this.deviceMap.set(id, homebridgeDevice); - hmIPAccessory.register(); + + if (!homebridgeDevice.hidden) { + this.deviceMap.set(id, homebridgeDevice); + hmIPAccessory.register(); + } } private createAccessory(uuid: string, displayName: string, deviceContext: unknown): HmIPAccessory { @@ -333,10 +347,15 @@ export class HmIPPlatform implements DynamicPlatformPlugin { } private createSecuritySystem(home: HmIPHome): HmIPSecuritySystem { - const uuid = this.api.hap.uuid.generate(home.id + '_security'); + const id = home.id + '_security'; + const uuid = this.api.hap.uuid.generate(id); const hmIPAccessory = this.createAccessory(uuid, 'Home Security System', home); const securitySystem = new HmIPSecuritySystem(this, hmIPAccessory.accessory); - hmIPAccessory.register(); + + if (!securitySystem.hidden) { + this.deviceMap.set(id, securitySystem); + hmIPAccessory.register(); + } return securitySystem; } diff --git a/src/HmIPSecuritySystem.ts b/src/HmIPSecuritySystem.ts index 3bb8fd1..bdb2c75 100644 --- a/src/HmIPSecuritySystem.ts +++ b/src/HmIPSecuritySystem.ts @@ -39,6 +39,7 @@ class SecuritySystemTarget { export class HmIPSecuritySystem { private service: Service; + public hidden = false; private activationInProgress = false; private intrusionAlarmActive = false; private safetyAlarmActive = false; @@ -50,6 +51,8 @@ export class HmIPSecuritySystem { protected platform: HmIPPlatform, protected accessory: PlatformAccessory, ) { + this.hidden = platform.config['devices']?.['HOME_SECURITY_SYSTEM']?.['hide'] === true; + this.platform.log.debug('Created security system'); const home = accessory.context.device; diff --git a/src/devices/HmIPDoorLockDrive.ts b/src/devices/HmIPDoorLockDrive.ts index dbc5243..6ff7ff4 100644 --- a/src/devices/HmIPDoorLockDrive.ts +++ b/src/devices/HmIPDoorLockDrive.ts @@ -48,6 +48,8 @@ export class HmIPDoorLockDrive extends HmIPGenericDevice implements Updateable { private lockState: LockState = LockState.UNLOCKED; private motorState: MotorState = MotorState.STOPPED; private targetLockState = this.platform.Characteristic.LockTargetState.UNSECURED; + private openLatch = false; + private pin; constructor( platform: HmIPPlatform, @@ -55,6 +57,9 @@ export class HmIPDoorLockDrive extends HmIPGenericDevice implements Updateable { ) { super(platform, accessory); + this.openLatch = this.accessoryConfig?.['openLatch'] === true; + this.pin = this.accessoryConfig?.['pin']; + this.platform.log.debug(`Created door lock drive ${accessory.context.device.label}`); this.service = this.accessory.getService(this.platform.Service.LockMechanism) || this.accessory.addService(this.platform.Service.LockMechanism); @@ -80,11 +85,11 @@ export class HmIPDoorLockDrive extends HmIPGenericDevice implements Updateable { async handleLockTargetStateSet(value: CharacteristicValue) { this.targetLockState = value; - this.platform.log.info('Setting door lock drive %s to %s', this.accessory.displayName, this.getLockTargetState(value)); + this.platform.log.info('Setting door lock drive %s to %s', this.accessory.displayName, this.getLockTargetStateString(value)); const body = { channelIndex: 1, deviceId: this.accessory.context.device.id, - authorizationPin: '', + authorizationPin: this.pin !== undefined ? this.pin : '', targetLockState: this.getHmIPTargetLockState(value), }; await this.platform.connector.apiCall('device/control/setLockState', body); @@ -101,20 +106,22 @@ export class HmIPDoorLockDrive extends HmIPGenericDevice implements Updateable { if (doorLockChannel.lockState !== null && doorLockChannel.lockState !== this.lockState) { this.lockState = doorLockChannel.lockState; this.platform.log.info('Door lock drive lock state of %s changed to %s', this.accessory.displayName, this.lockState); + this.updateHmKitLockTargetState(); this.service.updateCharacteristic(this.platform.Characteristic.LockCurrentState, this.getHmKitLockCurrentState(this.lockState)); - this.service.updateCharacteristic(this.platform.Characteristic.LockTargetState, this.getHmKitLockTargetState()); + this.service.updateCharacteristic(this.platform.Characteristic.LockTargetState, this.targetLockState); } if (doorLockChannel.motorState !== null && doorLockChannel.motorState !== this.motorState) { this.motorState = doorLockChannel.motorState; this.platform.log.info('Door lock drive motor state of %s changed to %s', this.accessory.displayName, this.motorState); - this.service.updateCharacteristic(this.platform.Characteristic.LockTargetState, this.getHmKitLockTargetState()); + this.updateHmKitLockTargetState(); + this.service.updateCharacteristic(this.platform.Characteristic.LockTargetState, this.targetLockState); } } } } - private getLockTargetState(lockTargetState: CharacteristicValue): string { + private getLockTargetStateString(lockTargetState: CharacteristicValue): string { switch (lockTargetState) { case this.platform.Characteristic.LockTargetState.UNSECURED: return 'UNSECURED'; @@ -128,7 +135,11 @@ export class HmIPDoorLockDrive extends HmIPGenericDevice implements Updateable { private getHmIPTargetLockState(lockTargetState: CharacteristicValue): string { switch (lockTargetState) { case this.platform.Characteristic.LockTargetState.UNSECURED: - return LockState.UNLOCKED; + if (this.openLatch) { + return LockState.OPEN; + } else { + return LockState.UNLOCKED; + } case this.platform.Characteristic.LockTargetState.SECURED: return LockState.LOCKED; default: @@ -149,22 +160,25 @@ export class HmIPDoorLockDrive extends HmIPGenericDevice implements Updateable { } } - private getHmKitLockTargetState(): number { + private updateHmKitLockTargetState() { switch (this.lockState) { case LockState.LOCKED: if (this.motorState === MotorState.STOPPED) { - return this.platform.Characteristic.LockTargetState.SECURED; + this.targetLockState = this.platform.Characteristic.LockTargetState.SECURED; + } else { + this.targetLockState = this.platform.Characteristic.LockTargetState.UNSECURED; } - - return this.platform.Characteristic.LockTargetState.UNSECURED; + break; case LockState.UNLOCKED: if (this.motorState === MotorState.CLOSING) { - return this.platform.Characteristic.LockTargetState.SECURED; + this.targetLockState = this.platform.Characteristic.LockTargetState.SECURED; + } else { + this.targetLockState = this.platform.Characteristic.LockTargetState.UNSECURED; } - - return this.platform.Characteristic.LockTargetState.UNSECURED; + break; case LockState.OPEN: - return this.platform.Characteristic.LockTargetState.UNSECURED; + this.targetLockState = this.platform.Characteristic.LockTargetState.UNSECURED; + break; } } } diff --git a/src/devices/HmIPGenericDevice.ts b/src/devices/HmIPGenericDevice.ts index 2d26c13..d896bc0 100644 --- a/src/devices/HmIPGenericDevice.ts +++ b/src/devices/HmIPGenericDevice.ts @@ -43,6 +43,7 @@ interface DeviceBaseChannel { */ export abstract class HmIPGenericDevice { + public hidden = false; protected unreach = false; protected lowBat = false; protected rssiDeviceValue = 0; @@ -50,12 +51,17 @@ export abstract class HmIPGenericDevice { protected dutyCycle = false; protected configPending = false; protected featureSabotage = false; + protected accessoryConfig; private readonly batteryService: Service | undefined; protected constructor( protected readonly platform: HmIPPlatform, public readonly accessory: PlatformAccessory, ) { + + this.accessoryConfig = platform.config['devices']?.[accessory.context.device.id]; + this.hidden = this.accessoryConfig?.['hide'] === true; + this.accessory.getService(this.platform.Service.AccessoryInformation)! .setCharacteristic(this.platform.Characteristic.Manufacturer, accessory.context.device.oem) .setCharacteristic(this.platform.Characteristic.Model, accessory.context.device.modelType) diff --git a/src/settings.ts b/src/settings.ts index abbb102..182b7b7 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -11,4 +11,4 @@ export const PLUGIN_NAME = 'homebridge-homematicip'; /** * Version to be used in protocol communication */ -export const PLUGIN_VERSION = '0.7.0'; +export const PLUGIN_VERSION = '0.7.1';