From 440a4d62a19a80917cc0fc2afea755640d2954d0 Mon Sep 17 00:00:00 2001 From: Brandon Watson Date: Tue, 6 Sep 2022 20:23:31 -0500 Subject: [PATCH] Fixing issue where button becomes unresponsive | Updating homebridge --- package-lock.json | 986 +++++++++++++++++++++++++++----------- package.json | 4 +- src/fluxAccessory.ts | 93 ++-- src/index.ts | 250 +++++----- src/models/hapNodeJS.d.ts | 456 ------------------ src/models/iAccessory.ts | 14 - src/platform.ts | 137 ++++++ src/settings.ts | 9 + tsconfig.json | 23 +- 9 files changed, 1044 insertions(+), 928 deletions(-) delete mode 100644 src/models/hapNodeJS.d.ts delete mode 100644 src/models/iAccessory.ts create mode 100644 src/platform.ts create mode 100644 src/settings.ts diff --git a/package-lock.json b/package-lock.json index bd9b85a..a880c17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,33 +18,33 @@ }, "devDependencies": { "@types/node": "^13.11.1", - "homebridge": "^1.3.9", + "homebridge": "^1.5.0", "typescript": "^4.5.4" }, "engines": { - "homebridge": ">=0.4.21", + "homebridge": ">=1.1.6", "node": ">=7.6.0" } }, "node_modules/@homebridge/ciao": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.1.3.tgz", - "integrity": "sha512-p9WgcSYUj3rtC1g3ywJpKxvIZXPkkv88JxbuW6idMHrUOqDMJlWIsWF0yXynQf8Z28gA0j6AJN9EnAr+hg5gNA==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.1.5.tgz", + "integrity": "sha512-ZI9tcbPfX2d8oP1PNeLzrZLXISAIDUtJQWk4JVVJKCxktC6tQ3JyWXT9t1FbB5xtl82M1jdCgyAbWbjhUtRWcA==", "dev": true, "dependencies": { - "debug": "^4.3.2", + "debug": "^4.3.4", "fast-deep-equal": "^3.1.3", - "source-map-support": "^0.5.20", - "tslib": "^2.3.1" + "source-map-support": "^0.5.21", + "tslib": "^2.4.0" }, "bin": { "ciao-bcs": "lib/bonjour-conformance-testing.js" } }, "node_modules/@homebridge/ciao/node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -64,10 +64,34 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/@homebridge/dbus-native": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@homebridge/dbus-native/-/dbus-native-0.4.1.tgz", + "integrity": "sha512-8h6MkoJykY37THOyRXWCIKpzbhIn4WWKZBunlXTH75Cb6vBcmhyIhZ3SvzqJAjJCEdhLg7wawfn7/Mpko7eREQ==", + "dev": true, + "dependencies": { + "@homebridge/long": "^5.2.1", + "event-stream": "^4.0.0", + "hexy": "^0.2.10", + "optimist": "^0.6.1", + "put": "0.0.6", + "safe-buffer": "^5.1.1", + "xml2js": "^0.4.17" + }, + "bin": { + "dbus2js": "bin/dbus2js.js" + } + }, + "node_modules/@homebridge/long": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@homebridge/long/-/long-5.2.1.tgz", + "integrity": "sha512-i5Df8R63XNPCn+Nj1OgAoRdw9e+jHUQb3CNUbvJneI2iu3j4+OtzQj+5PA1Ce+747NR1SPqZSvyvD483dOT3AA==", + "dev": true + }, "node_modules/@leichtgewicht/ip-codec": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.3.tgz", - "integrity": "sha512-nkalE/f1RvRGChwBnEIoBfSEYOXnCRdleKuv6+lePbMDrMZXeDQnqak5XDOeBgrPPyPfAdcCu/B5z+v3VhplGg==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", + "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==", "dev": true }, "node_modules/@types/node": { @@ -305,15 +329,19 @@ } }, "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", "dev": true, "dependencies": { - "object-keys": "^1.0.12" + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/dgram": { @@ -323,9 +351,9 @@ "deprecated": "npm is holding this package for security reasons. As it's a core Node module, we will not transfer it over to other users. You may safely remove the package from your dependencies." }, "node_modules/dns-packet": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.3.1.tgz", - "integrity": "sha512-spBwIj0TK0Ey3666GwIdWVfUpLyubpU53BTCu8iPn4r4oXd9O14Hjg3EHw3ts2oed77/SeckunUYCyRlSngqHw==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.4.0.tgz", + "integrity": "sha512-EgqGeaBB8hLiHLZtp/IbaDQTL8pZ0+IvwzSHA6d7VyMDM+B9hgddEMa9xjK5oYnw0ci0JQ6g2XCD7/f6cafU6g==", "dev": true, "dependencies": { "@leichtgewicht/ip-codec": "^2.0.1" @@ -334,32 +362,41 @@ "node": ">=6" } }, + "node_modules/duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "dev": true + }, "node_modules/es-abstract": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", - "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.2.tgz", + "integrity": "sha512-XxXQuVNrySBNlEkTYJoDNFe5+s2yIOpzq80sUHEdPdQr0S5nTLz4ZPPPswNIpKseDDUS5yghX1gfLIHQZ1iNuQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.2", "get-symbol-description": "^1.0.0", "has": "^1.0.3", - "has-symbols": "^1.0.2", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", + "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", + "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.2", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -404,6 +441,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/event-stream": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-4.0.1.tgz", + "integrity": "sha512-qACXdu/9VHPBzcyhdOWR5/IahhGMf0roTeZJfzz077GwylcDd90yOHLouhmv7GJ5XzPi6ekaQWd8AvPP2nOvpA==", + "dev": true, + "dependencies": { + "duplexer": "^0.1.1", + "from": "^0.1.7", + "map-stream": "0.0.7", + "pause-stream": "^0.0.11", + "split": "^1.0.1", + "stream-combiner": "^0.2.2", + "through": "^2.3.8" + } + }, "node_modules/event-target-shim": { "version": "5.0.1", "resolved": "http://10.44.1.6:4873/event-target-shim/-/event-target-shim-5.0.1.tgz", @@ -468,16 +520,25 @@ "node": ">=4.0" } }, - "node_modules/foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==", "dev": true }, "node_modules/fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "dev": true, "dependencies": { "graceful-fs": "^4.2.0", @@ -494,6 +555,33 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/futoin-hkdf": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/futoin-hkdf/-/futoin-hkdf-1.4.3.tgz", @@ -504,14 +592,14 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", + "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -569,26 +657,26 @@ "integrity": "sha512-diBb5AE2V8h9Fs9zEDtBwSeLvIACng/aAkdZ3ujMV+cGuIQ9Nc/V+wQqurk9HJp8ni5roBxQHW21z/ZYbGDivg==" }, "node_modules/graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, "node_modules/hap-nodejs": { - "version": "0.9.8", - "resolved": "https://registry.npmjs.org/hap-nodejs/-/hap-nodejs-0.9.8.tgz", - "integrity": "sha512-+IENi8nFh/yOvVZEEIgY+nVppoXgY3mN8CfRh/I9tlhDbp3rXlsjdvHFVOgk7qJNa6cwzKu0KzNUs+n3XpO1Iw==", + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/hap-nodejs/-/hap-nodejs-0.10.2.tgz", + "integrity": "sha512-rmCKoNoBqpcOz/wG5iTtS7JIkLjobEZj+oXGW/Z4I4eJGk14VfKjITA8plaAm6gWIZEAajASzzUdEZnIKEvzdg==", "dev": true, "dependencies": { - "@homebridge/ciao": "~1.1.3", + "@homebridge/ciao": "^1.1.4", + "@homebridge/dbus-native": "^0.4.1", "bonjour-hap": "~3.6.3", - "debug": "^4.3.2", + "debug": "^4.3.4", "fast-srp-hap": "2.0.4", - "futoin-hkdf": "~1.4.2", - "ip": "^1.1.5", + "futoin-hkdf": "~1.4.3", "node-persist": "^0.0.11", - "source-map-support": "^0.5.20", - "tslib": "^2.3.1", + "source-map-support": "^0.5.21", + "tslib": "^2.4.0", "tweetnacl": "^1.0.3" }, "engines": { @@ -596,9 +684,9 @@ } }, "node_modules/hap-nodejs/node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -631,9 +719,9 @@ } }, "node_modules/has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -648,10 +736,22 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, "engines": { "node": ">= 0.4" @@ -675,19 +775,28 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hexy": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/hexy/-/hexy-0.2.11.tgz", + "integrity": "sha512-ciq6hFsSG/Bpt2DmrZJtv+56zpPdnq+NQ4ijEFrveKN0ZG1mhl/LdT1NQZ9se6ty1fACcI4d4vYqC9v8EYpH2A==", + "dev": true, + "bin": { + "hexy": "bin/hexy_cmd.js" + } + }, "node_modules/homebridge": { - "version": "1.3.9", - "resolved": "https://registry.npmjs.org/homebridge/-/homebridge-1.3.9.tgz", - "integrity": "sha512-/QYosrEmxao6EekPMU3la3j3qx0UWLcYQN01qbZ7s1ZrKp8aC+aShgNx1borFrY/0fHsZauGcbuNqFh+XSKNXw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/homebridge/-/homebridge-1.5.0.tgz", + "integrity": "sha512-0t8WNBKz9NFCab5obBfJMnxFgkg4uJZqON+iM/uZpIyiMRWH9ycCHd1pYAPMk9vDdfDu8/VpxYafWsYx6luHtg==", "dev": true, "dependencies": { "chalk": "^4.1.2", "commander": "5.1.0", - "fs-extra": "^10.0.0", - "hap-nodejs": "0.9.8", + "fs-extra": "^10.1.0", + "hap-nodejs": "^0.10.2", "qrcode-terminal": "^0.12.0", - "semver": "^7.3.5", - "source-map-support": "^0.5.20" + "semver": "^7.3.7", + "source-map-support": "^0.5.21" }, "bin": { "homebridge": "bin/homebridge" @@ -736,9 +845,9 @@ } }, "node_modules/ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", + "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==", "dev": true }, "node_modules/ip-regex": { @@ -861,9 +970,9 @@ } }, "node_modules/is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" @@ -901,10 +1010,13 @@ } }, "node_modules/is-shared-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", - "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -951,15 +1063,15 @@ } }, "node_modules/is-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", - "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", "has-tostringtag": "^1.0.0" }, "engines": { @@ -1038,6 +1150,12 @@ "node": ">=10" } }, + "node_modules/map-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", + "integrity": "sha512-C0X0KQmGm3N2ftbTGBhSyuydQ+vV1LC3f3zPvT3RXHXNZrvfPZcoXp/N5DOa8vedX/rTMm2CjTtivFg2STJMRQ==", + "dev": true + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "http://10.44.1.6:4873/merge-stream/-/merge-stream-2.0.0.tgz", @@ -1052,18 +1170,18 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "node_modules/mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "dependencies": { - "minimist": "^1.2.5" + "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" @@ -1075,9 +1193,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "node_modules/multicast-dns": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.4.tgz", - "integrity": "sha512-XkCYOU+rr2Ft3LI6w4ye51M3VK31qJXFIxu0XLw169PtKG0Zx47OrXeVW/GCYOfpC9s1yyyf1S+L8/4LY0J9Zw==", + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz", + "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", "dev": true, "dependencies": { "dns-packet": "^5.2.2", @@ -1090,7 +1208,7 @@ "node_modules/multicast-dns-service-types": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", - "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", + "integrity": "sha512-cnAsSVxIDsYt0v7HmC0hWZFwwXSh+E6PgCrREDuN/EsjgLwA5XRmlMHhSiDPrt6HxY1gTivEa/Zh7GtODoLevQ==", "dev": true }, "node_modules/node-cron": { @@ -1121,7 +1239,7 @@ "node_modules/node-persist": { "version": "0.0.11", "resolved": "https://registry.npmjs.org/node-persist/-/node-persist-0.0.11.tgz", - "integrity": "sha1-1m66Pr72IPB5Uw+nsTB2qQZmWHQ=", + "integrity": "sha512-J3EPzQDgPxPBID7TqHSd5KkpTULFqJUvYDoISfOWg9EihpeVCH3b6YQeDeubzVuc4e6+aiVmkz2sdkWI4K+ghA==", "dev": true, "dependencies": { "mkdirp": "~0.5.1", @@ -1140,9 +1258,9 @@ } }, "node_modules/object-inspect": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1174,14 +1292,14 @@ } }, "node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", "object-keys": "^1.1.1" }, "engines": { @@ -1218,6 +1336,22 @@ "opencollective-postinstall": "index.js" } }, + "node_modules/optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==", + "dev": true, + "dependencies": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + } + }, + "node_modules/optimist/node_modules/minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw==", + "dev": true + }, "node_modules/p-event": { "version": "4.2.0", "resolved": "http://10.44.1.6:4873/p-event/-/p-event-4.2.0.tgz", @@ -1259,6 +1393,15 @@ "node": ">=8" } }, + "node_modules/pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==", + "dev": true, + "dependencies": { + "through": "~2.3" + } + }, "node_modules/pino": { "version": "8.5.0", "resolved": "http://10.44.1.6:4873/pino/-/pino-8.5.0.tgz", @@ -1299,10 +1442,19 @@ "resolved": "http://10.44.1.6:4873/process-warning/-/process-warning-2.0.0.tgz", "integrity": "sha512-+MmoAXoUX+VTHAlwns0h+kFUWFs/3FZy+ZuchkgjyOu3oioLAo2LB5aCfKPh2+P9O18i3m43tUEv3YqttSy0Ww==" }, + "node_modules/put": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/put/-/put-0.0.6.tgz", + "integrity": "sha512-w0szIZ2NkqznMFqxYPRETCIi+q/S8UKis9F4yOl6/N9NDCZmbjZZT85aI4FgJf3vIPrzMPX60+odCLOaYxNWWw==", + "dev": true, + "engines": { + "node": ">=0.3.0" + } + }, "node_modules/q": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/q/-/q-1.1.2.tgz", - "integrity": "sha1-Y1fikSBnAdmfGXq4TlforRlvKok=", + "integrity": "sha512-ROtylwux7Vkc4C07oKE/ReigUmb33kVoLtcR4SJ1QVqwaZkBEDL3vX4/kwFzIERQ5PfCl0XafbU8u2YUhyGgVA==", "dev": true, "engines": { "node": ">=0.6.0", @@ -1343,13 +1495,14 @@ } }, "node_modules/regexp.prototype.flags": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz", - "integrity": "sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" }, "engines": { "node": ">= 0.4" @@ -1358,6 +1511,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/safe-stable-stringify": { "version": "2.3.1", "resolved": "http://10.44.1.6:4873/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz", @@ -1366,10 +1539,16 @@ "node": ">=10" } }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, "node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -1446,6 +1625,18 @@ "source-map": "^0.6.0" } }, + "node_modules/split": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "dev": true, + "dependencies": { + "through": "2" + }, + "engines": { + "node": "*" + } + }, "node_modules/split2": { "version": "4.1.0", "resolved": "http://10.44.1.6:4873/split2/-/split2-4.1.0.tgz", @@ -1454,27 +1645,39 @@ "node": ">= 10.x" } }, + "node_modules/stream-combiner": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", + "integrity": "sha512-6yHMqgLYDzQDcAkL+tjJDC5nSNuNIx0vZtRZeiPh7Saef7VHX9H5Ijn9l2VIol2zaNYlYEX6KyuT/237A58qEQ==", + "dev": true, + "dependencies": { + "duplexer": "~0.1.1", + "through": "~2.3.4" + } + }, "node_modules/string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1513,6 +1716,12 @@ "real-require": "^0.2.0" } }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, "node_modules/thunky": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", @@ -1520,9 +1729,9 @@ "dev": true }, "node_modules/tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", "dev": true }, "node_modules/tweetnacl": { @@ -1550,14 +1759,14 @@ "integrity": "sha512-kMBmblijHJXyOpKzgDhKx9INYU4u4E1RPMB0HqmKSgWG8vEcf3exEfLh4FFfzd3xdQOw9EuIy/cP0akY6rHopQ==" }, "node_modules/unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", "which-boxed-primitive": "^1.0.2" }, "funding": { @@ -1619,17 +1828,17 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", - "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.7" + "is-typed-array": "^1.1.9" }, "engines": { "node": ">= 0.4" @@ -1638,6 +1847,37 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/xml2js": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "dev": true, + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -1647,21 +1887,21 @@ }, "dependencies": { "@homebridge/ciao": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.1.3.tgz", - "integrity": "sha512-p9WgcSYUj3rtC1g3ywJpKxvIZXPkkv88JxbuW6idMHrUOqDMJlWIsWF0yXynQf8Z28gA0j6AJN9EnAr+hg5gNA==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.1.5.tgz", + "integrity": "sha512-ZI9tcbPfX2d8oP1PNeLzrZLXISAIDUtJQWk4JVVJKCxktC6tQ3JyWXT9t1FbB5xtl82M1jdCgyAbWbjhUtRWcA==", "dev": true, "requires": { - "debug": "^4.3.2", + "debug": "^4.3.4", "fast-deep-equal": "^3.1.3", - "source-map-support": "^0.5.20", - "tslib": "^2.3.1" + "source-map-support": "^0.5.21", + "tslib": "^2.4.0" }, "dependencies": { "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -1675,10 +1915,31 @@ } } }, + "@homebridge/dbus-native": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@homebridge/dbus-native/-/dbus-native-0.4.1.tgz", + "integrity": "sha512-8h6MkoJykY37THOyRXWCIKpzbhIn4WWKZBunlXTH75Cb6vBcmhyIhZ3SvzqJAjJCEdhLg7wawfn7/Mpko7eREQ==", + "dev": true, + "requires": { + "@homebridge/long": "^5.2.1", + "event-stream": "^4.0.0", + "hexy": "^0.2.10", + "optimist": "^0.6.1", + "put": "0.0.6", + "safe-buffer": "^5.1.1", + "xml2js": "^0.4.17" + } + }, + "@homebridge/long": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@homebridge/long/-/long-5.2.1.tgz", + "integrity": "sha512-i5Df8R63XNPCn+Nj1OgAoRdw9e+jHUQb3CNUbvJneI2iu3j4+OtzQj+5PA1Ce+747NR1SPqZSvyvD483dOT3AA==", + "dev": true + }, "@leichtgewicht/ip-codec": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.3.tgz", - "integrity": "sha512-nkalE/f1RvRGChwBnEIoBfSEYOXnCRdleKuv6+lePbMDrMZXeDQnqak5XDOeBgrPPyPfAdcCu/B5z+v3VhplGg==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", + "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==", "dev": true }, "@types/node": { @@ -1873,12 +2134,13 @@ } }, "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", "dev": true, "requires": { - "object-keys": "^1.0.12" + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" } }, "dgram": { @@ -1887,40 +2149,49 @@ "integrity": "sha512-zJVFL1EWfKtE0z2VN6qfpn/a+qG1viEzcwJA0EjtzS76ONSE3sEyWBwEbo32hS4IFw/EWVuWN+8b89aPW6It2A==" }, "dns-packet": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.3.1.tgz", - "integrity": "sha512-spBwIj0TK0Ey3666GwIdWVfUpLyubpU53BTCu8iPn4r4oXd9O14Hjg3EHw3ts2oed77/SeckunUYCyRlSngqHw==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.4.0.tgz", + "integrity": "sha512-EgqGeaBB8hLiHLZtp/IbaDQTL8pZ0+IvwzSHA6d7VyMDM+B9hgddEMa9xjK5oYnw0ci0JQ6g2XCD7/f6cafU6g==", "dev": true, "requires": { "@leichtgewicht/ip-codec": "^2.0.1" } }, + "duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "dev": true + }, "es-abstract": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", - "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.2.tgz", + "integrity": "sha512-XxXQuVNrySBNlEkTYJoDNFe5+s2yIOpzq80sUHEdPdQr0S5nTLz4ZPPPswNIpKseDDUS5yghX1gfLIHQZ1iNuQ==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.2", "get-symbol-description": "^1.0.0", "has": "^1.0.3", - "has-symbols": "^1.0.2", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", + "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", + "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.2", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" } }, "es-get-iterator": { @@ -1950,6 +2221,21 @@ "is-symbol": "^1.0.2" } }, + "event-stream": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-4.0.1.tgz", + "integrity": "sha512-qACXdu/9VHPBzcyhdOWR5/IahhGMf0roTeZJfzz077GwylcDd90yOHLouhmv7GJ5XzPi6ekaQWd8AvPP2nOvpA==", + "dev": true, + "requires": { + "duplexer": "^0.1.1", + "from": "^0.1.7", + "map-stream": "0.0.7", + "pause-stream": "^0.0.11", + "split": "^1.0.1", + "stream-combiner": "^0.2.2", + "through": "^2.3.8" + } + }, "event-target-shim": { "version": "5.0.1", "resolved": "http://10.44.1.6:4873/event-target-shim/-/event-target-shim-5.0.1.tgz", @@ -1996,16 +2282,25 @@ "debug": "=3.1.0" } }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==", "dev": true }, "fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "dev": true, "requires": { "graceful-fs": "^4.2.0", @@ -2019,6 +2314,24 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + } + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, "futoin-hkdf": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/futoin-hkdf/-/futoin-hkdf-1.4.3.tgz", @@ -2026,14 +2339,14 @@ "dev": true }, "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", + "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.3" } }, "get-ssl-certificate": { @@ -2072,33 +2385,33 @@ } }, "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, "hap-nodejs": { - "version": "0.9.8", - "resolved": "https://registry.npmjs.org/hap-nodejs/-/hap-nodejs-0.9.8.tgz", - "integrity": "sha512-+IENi8nFh/yOvVZEEIgY+nVppoXgY3mN8CfRh/I9tlhDbp3rXlsjdvHFVOgk7qJNa6cwzKu0KzNUs+n3XpO1Iw==", + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/hap-nodejs/-/hap-nodejs-0.10.2.tgz", + "integrity": "sha512-rmCKoNoBqpcOz/wG5iTtS7JIkLjobEZj+oXGW/Z4I4eJGk14VfKjITA8plaAm6gWIZEAajASzzUdEZnIKEvzdg==", "dev": true, "requires": { - "@homebridge/ciao": "~1.1.3", + "@homebridge/ciao": "^1.1.4", + "@homebridge/dbus-native": "^0.4.1", "bonjour-hap": "~3.6.3", - "debug": "^4.3.2", + "debug": "^4.3.4", "fast-srp-hap": "2.0.4", - "futoin-hkdf": "~1.4.2", - "ip": "^1.1.5", + "futoin-hkdf": "~1.4.3", "node-persist": "^0.0.11", - "source-map-support": "^0.5.20", - "tslib": "^2.3.1", + "source-map-support": "^0.5.21", + "tslib": "^2.4.0", "tweetnacl": "^1.0.3" }, "dependencies": { "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -2122,9 +2435,9 @@ } }, "has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", "dev": true }, "has-flag": { @@ -2133,10 +2446,19 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.1" + } + }, "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true }, "has-tostringtag": { @@ -2148,19 +2470,25 @@ "has-symbols": "^1.0.2" } }, + "hexy": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/hexy/-/hexy-0.2.11.tgz", + "integrity": "sha512-ciq6hFsSG/Bpt2DmrZJtv+56zpPdnq+NQ4ijEFrveKN0ZG1mhl/LdT1NQZ9se6ty1fACcI4d4vYqC9v8EYpH2A==", + "dev": true + }, "homebridge": { - "version": "1.3.9", - "resolved": "https://registry.npmjs.org/homebridge/-/homebridge-1.3.9.tgz", - "integrity": "sha512-/QYosrEmxao6EekPMU3la3j3qx0UWLcYQN01qbZ7s1ZrKp8aC+aShgNx1borFrY/0fHsZauGcbuNqFh+XSKNXw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/homebridge/-/homebridge-1.5.0.tgz", + "integrity": "sha512-0t8WNBKz9NFCab5obBfJMnxFgkg4uJZqON+iM/uZpIyiMRWH9ycCHd1pYAPMk9vDdfDu8/VpxYafWsYx6luHtg==", "dev": true, "requires": { "chalk": "^4.1.2", "commander": "5.1.0", - "fs-extra": "^10.0.0", - "hap-nodejs": "0.9.8", + "fs-extra": "^10.1.0", + "hap-nodejs": "^0.10.2", "qrcode-terminal": "^0.12.0", - "semver": "^7.3.5", - "source-map-support": "^0.5.20" + "semver": "^7.3.7", + "source-map-support": "^0.5.21" } }, "human-signals": { @@ -2191,9 +2519,9 @@ } }, "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", + "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==", "dev": true }, "ip-regex": { @@ -2271,9 +2599,9 @@ "dev": true }, "is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", "dev": true, "requires": { "has-tostringtag": "^1.0.0" @@ -2296,10 +2624,13 @@ "dev": true }, "is-shared-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", - "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", - "dev": true + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } }, "is-stream": { "version": "2.0.1", @@ -2325,15 +2656,15 @@ } }, "is-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", - "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", "dev": true, "requires": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", "has-tostringtag": "^1.0.0" } }, @@ -2392,6 +2723,12 @@ "yallist": "^4.0.0" } }, + "map-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", + "integrity": "sha512-C0X0KQmGm3N2ftbTGBhSyuydQ+vV1LC3f3zPvT3RXHXNZrvfPZcoXp/N5DOa8vedX/rTMm2CjTtivFg2STJMRQ==", + "dev": true + }, "merge-stream": { "version": "2.0.0", "resolved": "http://10.44.1.6:4873/merge-stream/-/merge-stream-2.0.0.tgz", @@ -2403,18 +2740,18 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "requires": { - "minimist": "^1.2.5" + "minimist": "^1.2.6" } }, "ms": { @@ -2423,9 +2760,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "multicast-dns": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.4.tgz", - "integrity": "sha512-XkCYOU+rr2Ft3LI6w4ye51M3VK31qJXFIxu0XLw169PtKG0Zx47OrXeVW/GCYOfpC9s1yyyf1S+L8/4LY0J9Zw==", + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz", + "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", "dev": true, "requires": { "dns-packet": "^5.2.2", @@ -2435,7 +2772,7 @@ "multicast-dns-service-types": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", - "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", + "integrity": "sha512-cnAsSVxIDsYt0v7HmC0hWZFwwXSh+E6PgCrREDuN/EsjgLwA5XRmlMHhSiDPrt6HxY1gTivEa/Zh7GtODoLevQ==", "dev": true }, "node-cron": { @@ -2460,7 +2797,7 @@ "node-persist": { "version": "0.0.11", "resolved": "https://registry.npmjs.org/node-persist/-/node-persist-0.0.11.tgz", - "integrity": "sha1-1m66Pr72IPB5Uw+nsTB2qQZmWHQ=", + "integrity": "sha512-J3EPzQDgPxPBID7TqHSd5KkpTULFqJUvYDoISfOWg9EihpeVCH3b6YQeDeubzVuc4e6+aiVmkz2sdkWI4K+ghA==", "dev": true, "requires": { "mkdirp": "~0.5.1", @@ -2476,9 +2813,9 @@ } }, "object-inspect": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", "dev": true }, "object-is": { @@ -2498,14 +2835,14 @@ "dev": true }, "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", "object-keys": "^1.1.1" } }, @@ -2527,6 +2864,24 @@ "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==" }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw==", + "dev": true + } + } + }, "p-event": { "version": "4.2.0", "resolved": "http://10.44.1.6:4873/p-event/-/p-event-4.2.0.tgz", @@ -2553,6 +2908,15 @@ "resolved": "http://10.44.1.6:4873/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, + "pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==", + "dev": true, + "requires": { + "through": "~2.3" + } + }, "pino": { "version": "8.5.0", "resolved": "http://10.44.1.6:4873/pino/-/pino-8.5.0.tgz", @@ -2590,10 +2954,16 @@ "resolved": "http://10.44.1.6:4873/process-warning/-/process-warning-2.0.0.tgz", "integrity": "sha512-+MmoAXoUX+VTHAlwns0h+kFUWFs/3FZy+ZuchkgjyOu3oioLAo2LB5aCfKPh2+P9O18i3m43tUEv3YqttSy0Ww==" }, + "put": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/put/-/put-0.0.6.tgz", + "integrity": "sha512-w0szIZ2NkqznMFqxYPRETCIi+q/S8UKis9F4yOl6/N9NDCZmbjZZT85aI4FgJf3vIPrzMPX60+odCLOaYxNWWw==", + "dev": true + }, "q": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/q/-/q-1.1.2.tgz", - "integrity": "sha1-Y1fikSBnAdmfGXq4TlforRlvKok=", + "integrity": "sha512-ROtylwux7Vkc4C07oKE/ReigUmb33kVoLtcR4SJ1QVqwaZkBEDL3vX4/kwFzIERQ5PfCl0XafbU8u2YUhyGgVA==", "dev": true }, "qrcode-terminal": { @@ -2621,24 +2991,37 @@ "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==" }, "regexp.prototype.flags": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz", - "integrity": "sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" } }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, "safe-stable-stringify": { "version": "2.3.1", "resolved": "http://10.44.1.6:4873/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz", "integrity": "sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg==" }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -2697,29 +3080,50 @@ "source-map": "^0.6.0" } }, + "split": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "dev": true, + "requires": { + "through": "2" + } + }, "split2": { "version": "4.1.0", "resolved": "http://10.44.1.6:4873/split2/-/split2-4.1.0.tgz", "integrity": "sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ==" }, + "stream-combiner": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", + "integrity": "sha512-6yHMqgLYDzQDcAkL+tjJDC5nSNuNIx0vZtRZeiPh7Saef7VHX9H5Ijn9l2VIol2zaNYlYEX6KyuT/237A58qEQ==", + "dev": true, + "requires": { + "duplexer": "~0.1.1", + "through": "~2.3.4" + } + }, "string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" } }, "string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" } }, "strip-final-newline": { @@ -2749,6 +3153,12 @@ "real-require": "^0.2.0" } }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, "thunky": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", @@ -2756,9 +3166,9 @@ "dev": true }, "tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", "dev": true }, "tweetnacl": { @@ -2779,14 +3189,14 @@ "integrity": "sha512-kMBmblijHJXyOpKzgDhKx9INYU4u4E1RPMB0HqmKSgWG8vEcf3exEfLh4FFfzd3xdQOw9EuIy/cP0akY6rHopQ==" }, "unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", "which-boxed-primitive": "^1.0.2" } }, @@ -2830,19 +3240,41 @@ } }, "which-typed-array": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", - "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", "dev": true, "requires": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.7" + "is-typed-array": "^1.1.9" } }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==", + "dev": true + }, + "xml2js": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "dev": true, + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + } + }, + "xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "dev": true + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", diff --git a/package.json b/package.json index 44f2c5c..1b30b27 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "typescript" ], "engines": { - "homebridge": ">=0.4.21", + "homebridge": ">=1.1.6", "node": ">=7.6.0" }, "author": "Brandon Watson", @@ -36,7 +36,7 @@ }, "devDependencies": { "@types/node": "^13.11.1", - "homebridge": "^1.3.9", + "homebridge": "^1.5.0", "typescript": "^4.5.4" } } diff --git a/src/fluxAccessory.ts b/src/fluxAccessory.ts index 964b97e..329c87a 100644 --- a/src/fluxAccessory.ts +++ b/src/fluxAccessory.ts @@ -1,4 +1,3 @@ -import { IAccessory } from "./models/iAccessory"; import Api = require("node-hue-api/lib/api/Api"); import Light = require("node-hue-api/lib/model/Light"); import LightState = require("node-hue-api/lib/model/lightstate/LightState"); @@ -9,33 +8,30 @@ import { GetTimesResult, getTimes } from "suncalc"; import HueError = require("node-hue-api/lib/HueError"); import cron from "node-cron"; import { WizBulb } from "@watsonb8/wiz-lib/build/wizBulb"; -import { colorTemperature2rgb, Pilot, RGB } from "@watsonb8/wiz-lib"; +import { colorTemperature2rgb, RGB } from "@watsonb8/wiz-lib"; +import { PlatformAccessory } from "homebridge"; +import { Platform } from "./platform"; -let Service: HAPNodeJS.Service; -let Characteristic: HAPNodeJS.Characteristic; const SECONDS_IN_DAY = 86400000; const MINUTES_IN_MILLISECOND = 60000; const SECONDS_IN_HOUR = 3600; export interface IFluxProps { - api: any; - log: any; - homebridge: any; + platform: Platform; + accessory: PlatformAccessory; hue: Api; wizBulbs: Array; config: IConfig; } -export class FluxAccessory implements IAccessory { - private _api: any; - private _homebridge: any; - private _log: any = {}; +export class FluxAccessory { + private readonly _platform: Platform; + private readonly _accessory: PlatformAccessory; private _config: IConfig; private _isActive: boolean; //Service fields - private _switchService: HAPNodeJS.Service; - private _infoService: HAPNodeJS.Service; + private _switchService; private _hue: Api; @@ -46,12 +42,9 @@ export class FluxAccessory implements IAccessory { constructor(props: IFluxProps) { //Assign class variables - this._log = props.log; - this._api = props.api; + this._platform = props.platform; + this._accessory = props.accessory; this._config = props.config; - Service = props.api.hap.Service; - Characteristic = props.api.hap.Characteristic; - this._homebridge = props.homebridge; this._isActive = false; this._wizLights = props.wizBulbs; @@ -70,7 +63,7 @@ export class FluxAccessory implements IAccessory { this._config.latitude, this._config.longitude ); - this._log("Updated sunset times"); + this._platform.log.info("Updated sunset times"); }, { scheduled: true, @@ -80,28 +73,35 @@ export class FluxAccessory implements IAccessory { this._hue = props.hue; this.name = this._config.name; - this.platformAccessory = new this._homebridge.platformAccessory( - this.name, - this.generateUUID(), - this._homebridge.hap.Accessory.Categories.SWITCH + this._accessory + .getService(this._platform.api.hap.Service.AccessoryInformation)! + .setCharacteristic( + this._platform.api.hap.Characteristic.Manufacturer, + "Brandon Watson" + ) + .setCharacteristic( + this._platform.api.hap.Characteristic.Model, + "F.lux" + ) + .setCharacteristic( + this._platform.api.hap.Characteristic.SerialNumber, + "123-456-789" + ); + + const switchUUID = this._platform.api.hap.uuid.generate( + `${this._accessory.displayName} Switch` ); - //@ts-ignore - this._infoService = new Service.AccessoryInformation(); - this._infoService.setCharacteristic( - Characteristic.Manufacturer, - "Brandon Watson" - ); - this._infoService.setCharacteristic(Characteristic.Model, "F.lux"); - this._infoService.setCharacteristic( - Characteristic.SerialNumber, - "123-456-789" - ); - - this._switchService = new Service.Switch(this.name, "fluxService"); + this._switchService = + this._accessory.getService(this._platform.api.hap.Service.Switch) || + this._accessory.addService( + this._platform.api.hap.Service.Switch, + this._accessory.displayName, + switchUUID + ); this._switchService - .getCharacteristic(Characteristic.On) + .getCharacteristic(this._platform.api.hap.Characteristic.On) //@ts-ignore .on("set", this.onSetEnabled) //@ts-ignore @@ -137,22 +137,15 @@ export class FluxAccessory implements IAccessory { * Handler for switch get event * @param callback The callback function to call when complete */ - private onGetEnabled( + private onGetEnabled = ( callback: (error: Error | null, value: boolean) => void - ): void { + ): void => { callback(null, this._isActive); // return this._isActive; - } - - /** - * Called by homebridge to gather services. - */ - public getServices = (): Array => { - return [this._infoService, this._switchService!]; }; /** - * Popuplates internal lights array using the configuration values + * Populates internal lights array using the configuration values */ private getLights = async (): Promise => { for (const value of this._config.lights) { @@ -219,7 +212,9 @@ export class FluxAccessory implements IAccessory { ) { //Eat this } else { - this._log(`Error while setting lights: ${err}`); + this._platform.log.info( + `Error while setting lights: ${err}` + ); } } }); @@ -358,7 +353,7 @@ export class FluxAccessory implements IAccessory { wizRGB, this._config.transition ? this._config.transition / 1000 : 5 ); - this._log( + this._platform.log.info( `Adjusting light temp to ${newTemp}, ${JSON.stringify( hueRGB )}` diff --git a/src/index.ts b/src/index.ts index 0c07114..07df7aa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,134 +1,146 @@ -import { IConfig } from "./models/iConfig"; -import { v3 } from "node-hue-api"; -import LocalBootstrap = require("node-hue-api/lib/api/http/LocalBootstrap"); -import Api = require("node-hue-api/lib/api/Api"); -import { Sleep } from "./sleep"; -import { IAccessory } from "./models/iAccessory"; -import { FluxAccessory } from "./fluxAccessory"; -import { WizBulb } from "@watsonb8/wiz-lib/build/wizBulb"; -import discover from "@watsonb8/wiz-lib/build/discovery"; +import { API } from "homebridge"; -let Accessory: any; -let Homebridge: any; +import { PLATFORM_NAME } from "./settings"; +import { Platform } from "./platform"; /** - * Main entry. - * @param homebridge + * This method registers the platform with Homebridge */ -export default function (homebridge: any) { - Homebridge = homebridge; - Accessory = homebridge.platformAccessory; - homebridge.registerPlatform("homebridge-flux", "Flux", FluxPlatform, true); -} +export = (api: API) => { + api.registerPlatform(PLATFORM_NAME, Platform); +}; -class FluxPlatform { - log: any = {}; - api: any; - accessoryList: Array = []; - config: IConfig; - hue: Api | undefined; +// import { IConfig } from "./models/iConfig"; +// import { v3 } from "node-hue-api"; +// import LocalBootstrap = require("node-hue-api/lib/api/http/LocalBootstrap"); +// import Api = require("node-hue-api/lib/api/Api"); +// import { Sleep } from "./sleep"; +// import { IAccessory } from "./models/iAccessory"; +// import { FluxAccessory } from "./fluxAccessory"; +// import { WizBulb } from "@watsonb8/wiz-lib/build/wizBulb"; +// import discover from "@watsonb8/wiz-lib/build/discovery"; - constructor(log: any, config: any, api: any) { - this.log = log; - this.api = api; - this.config = config; - this.log("INFO - Registering Flux platform"); - this.api.on("didFinishLaunching", this.didFinishLaunching.bind(this)); - } +// let Accessory: any; +// let Homebridge: any; - private connectWiz = async () => { - if (!this.config) { - return; - } +// /** +// * Main entry. +// * @param homebridge +// */ +// export default function (homebridge: any) { +// Homebridge = homebridge; +// Accessory = homebridge.platformAccessory; +// homebridge.registerPlatform("homebridge-flux", "Flux", FluxPlatform, true); +// } - return await discover(); - }; +// class FluxPlatform { +// log: any = {}; +// api: any; +// accessoryList: Array = []; +// config: IConfig; +// hue: Api | undefined; - private connectHue = async () => { - if (!this.config) { - return; - } +// constructor(log: any, config: any, api: any) { +// this.log = log; +// this.api = api; +// this.config = config; +// this.log("INFO - Registering Flux platform"); +// this.api.on("didFinishLaunching", this.didFinishLaunching.bind(this)); +// } - if (this.config.userName && this.config.clientKey) { - this.hue = await v3.api - .createLocal(this.config.ipAddress) - .connect( - this.config.userName, - this.config.clientKey, - undefined - ); - this.log("Using existing connection info"); - } else { - const unauthenticatedApi = await v3.api - .createLocal(this.config.ipAddress) - .connect(undefined, undefined, undefined); - let createdUser; - let connected = false; - while (!connected) { - try { - this.log("Creating hue user. Push link button"); - createdUser = await unauthenticatedApi.users.createUser( - "homebridge", - "HueChase" - ); +// private connectWiz = async () => { +// if (!this.config) { +// return; +// } - this.hue = await v3.api - .createLocal(this.config.ipAddress) - .connect( - createdUser.username, - createdUser.clientKey, - undefined - ); - this.log("Connected to Hue Bridge"); - this.log( - `UserName: ${createdUser.username}, ClientKey: ${createdUser.clientkey}` - ); - connected = true; - } catch (err: any) { - if (err.getHueErrorType() === 101) { - this.log( - "The Link button on the bridge was not pressed. Please press the Link button and try again." - ); - Sleep(5000); - } else { - this.log(`Unexpected Error: ${err.message}`); - break; - } - } - } - } - }; +// return await discover(); +// }; - /** - * Handler for didFinishLaunching - * Happens after constructor - */ - private didFinishLaunching() { - this.log(`INFO - Done registering Flux platform`); - } +// private connectHue = async () => { +// if (!this.config) { +// return; +// } - /** - * Called by homebridge to gather accessories. - * @param callback - */ - public accessories = async ( - callback: (accessories: Array) => void - ) => { - //Connect to hue bridge - await this.connectHue(); - const wizBulbs = await this.connectWiz(); +// if (this.config.userName && this.config.clientKey) { +// this.hue = await v3.api +// .createLocal(this.config.ipAddress) +// .connect( +// this.config.userName, +// this.config.clientKey, +// undefined +// ); +// this.log("Using existing connection info"); +// } else { +// const unauthenticatedApi = await v3.api +// .createLocal(this.config.ipAddress) +// .connect(undefined, undefined, undefined); +// let createdUser; +// let connected = false; +// while (!connected) { +// try { +// this.log("Creating hue user. Push link button"); +// createdUser = await unauthenticatedApi.users.createUser( +// "homebridge", +// "HueChase" +// ); - this.accessoryList.push( - new FluxAccessory({ - api: this.api, - log: this.log, - homebridge: Homebridge, - hue: this.hue!, - wizBulbs: wizBulbs ?? [], - config: this.config, - }) - ); +// this.hue = await v3.api +// .createLocal(this.config.ipAddress) +// .connect( +// createdUser.username, +// createdUser.clientKey, +// undefined +// ); +// this.log("Connected to Hue Bridge"); +// this.log( +// `UserName: ${createdUser.username}, ClientKey: ${createdUser.clientkey}` +// ); +// connected = true; +// } catch (err: any) { +// if (err.getHueErrorType() === 101) { +// this.log( +// "The Link button on the bridge was not pressed. Please press the Link button and try again." +// ); +// Sleep(5000); +// } else { +// this.log(`Unexpected Error: ${err.message}`); +// break; +// } +// } +// } +// } +// }; - callback(this.accessoryList); - }; -} +// /** +// * Handler for didFinishLaunching +// * Happens after constructor +// */ +// private didFinishLaunching() { +// this.log(`INFO - Done registering Flux platform`); +// } + +// /** +// * Called by homebridge to gather accessories. +// * @param callback +// */ +// public accessories = async ( +// callback: (accessories: Array) => void +// ) => { +// //Connect to hue bridge +// await this.connectHue(); +// const wizBulbs = await this.connectWiz(); + +// this.accessoryList.push( +// new FluxAccessory({ +// api: this.api, +// log: this.log, +// homebridge: Homebridge, +// hue: this.hue!, +// wizBulbs: wizBulbs ?? [], +// config: this.config, +// }) +// ); + +// callback(this.accessoryList); +// }; +// } diff --git a/src/models/hapNodeJS.d.ts b/src/models/hapNodeJS.d.ts deleted file mode 100644 index ac9620e..0000000 --- a/src/models/hapNodeJS.d.ts +++ /dev/null @@ -1,456 +0,0 @@ -declare namespace HAPNodeJS { - - export interface uuid { - generate(data: string): string; - isValid(UUID: string): boolean; - unparse(bug: string, offset: number): string; - } - - type EventService = "characteristic-change" | "service-configurationChange" - - export interface IEventEmitterAccessory { - addListener(event: EventService, listener: Function): this; - on(event: EventService, listener: Function): this; - once(event: EventService, listener: Function): this; - removeListener(event: EventService, listener: Function): this; - removeAllListeners(event?: EventService): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: EventService): Function[]; - emit(event: EventService, ...args: any[]): boolean; - listenerCount(type: string): number; - } - - export interface Service extends IEventEmitterAccessory { - new(displayName: string, UUID: string, subtype: string): Service; - - displayName: string; - UUID: string; - subtype: string; - iid: string; - characteristics: Characteristic[]; - optionalCharacteristics: Characteristic[]; - - addCharacteristic(characteristic: Characteristic | Function): Characteristic; - removeCharacteristic(characteristic: Characteristic): void; - getCharacteristic(name: string | Function): Characteristic; - testCharacteristic(name: string | Function): boolean; - setCharacteristic(name: string | Function, value: CharacteristicValue): Service; - updateCharacteristic(name: string | Function, value: CharacteristicValue): Service; - addOptionalCharacteristic(characteristic: Characteristic | Function): void; - getCharacteristicByIID(iid: string): Characteristic; - - toHAP(opt: any): JSON; - - AccessoryInformation: PredefinedService; - AirPurifier: PredefinedService; - AirQualitySensor: PredefinedService; - BatteryService: PredefinedService; - BridgeConfiguration: PredefinedService; - BridgingState: PredefinedService; - CameraControl: PredefinedService; - CameraRTPStreamManagement: PredefinedService; - CarbonDioxideSensor: PredefinedService; - CarbonMonoxideSensor: PredefinedService; - ContactSensor: PredefinedService; - Door: PredefinedService; - Doorbell: PredefinedService; - Fan: PredefinedService; - Fanv2: PredefinedService; - Faucet: PredefinedService; - FilterMaintenance: PredefinedService; - GarageDoorOpener: PredefinedService; - HeaterCooler: PredefinedService; - HumidifierDehumidifier: PredefinedService; - HumiditySensor: PredefinedService; - InputSource: PredefinedService; - IrrigationSystem: PredefinedService; - LeakSensor: PredefinedService; - LightSensor: PredefinedService; - Lightbulb: PredefinedService; - LockManagement: PredefinedService; - LockMechanism: PredefinedService; - Microphone: PredefinedService; - MotionSensor: PredefinedService; - OccupancySensor: PredefinedService; - Outlet: PredefinedService; - Pairing: PredefinedService; - ProtocolInformation: PredefinedService; - Relay: PredefinedService; - SecuritySystem: PredefinedService; - ServiceLabel: PredefinedService; - Slat: PredefinedService; - SmokeSensor: PredefinedService; - Speaker: PredefinedService; - StatefulProgrammableSwitch: PredefinedService; - StatelessProgrammableSwitch: PredefinedService; - Switch: PredefinedService; - Television: PredefinedService; - TelevisionSpeaker: PredefinedService; - TemperatureSensor: PredefinedService; - Thermostat: PredefinedService; - TimeInformation: PredefinedService; - TunneledBTLEAccessoryService: PredefinedService; - Valve: PredefinedService; - Window: PredefinedService; - WindowCovering: PredefinedService; - } - - export interface PredefinedService { - new(displayName: string, subtype: string): Service; - } - - export interface CameraSource { - - } - - type EventAccessory = "service-configurationChange" | "service-characteristic-change" | "identify" - - export interface IEventEmitterAccessory { - addListener(event: EventAccessory, listener: Function): this; - on(event: EventAccessory, listener: Function): this; - once(event: EventAccessory, listener: Function): this; - removeListener(event: EventAccessory, listener: Function): this; - removeAllListeners(event?: EventAccessory): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: EventAccessory): Function[]; - emit(event: EventAccessory, ...args: any[]): boolean; - listenerCount(type: string): number; - } - - export interface CharacteristicProps { - format: Characteristic.Formats; - unit: Characteristic.Units, - minValue: number, - maxValue: number, - minStep: number, - perms: Characteristic.Perms[] - } - - type EventCharacteristic = "get" | "set" - type CharacteristicValue = boolean | string | number - - export type CharacteristicGetCallback = (error: Error | null, value: T) => void - export type CharacteristicSetCallback = (error?: Error | null) => void - export type CharacteristicCallback = CharacteristicGetCallback | CharacteristicSetCallback - - export interface IEventEmitterCharacteristic { - addListener(event: EventCharacteristic, listener: CharacteristicCallback): this; - on(event: EventCharacteristic, listener: CharacteristicCallback): this; - once(event: EventCharacteristic, listener: CharacteristicCallback): this; - removeListener(event: EventCharacteristic, listener: CharacteristicCallback): this; - removeAllListeners(event?: EventCharacteristic): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: EventCharacteristic): CharacteristicCallback[]; - emit(event: EventCharacteristic, ...args: any[]): boolean; - listenerCount(type: string): number; - } - - export interface Characteristic extends IEventEmitterCharacteristic { - new(displayName: string, UUID: string, props?: CharacteristicProps): Characteristic; - - Formats: typeof Characteristic.Formats; - Units: typeof Characteristic.Units; - Perms: typeof Characteristic.Perms; - - setProps(props: CharacteristicProps): Characteristic - getValue(callback?: CharacteristicGetCallback, context?: any, connectionID?: string): void; - setValue(newValue: CharacteristicValue, callback?: CharacteristicSetCallback, context?: any, connectionID?: string): Characteristic; - updateValue(newValue: CharacteristicValue, callback?: () => void, context?: any): Characteristic; - getDefaultValue(): CharacteristicValue; - toHAP(opt: any): JSON; - - AccessoryFlags: Characteristic; - AccessoryIdentifier: Characteristic; - Active: Characteristic; - ActiveIdentifier: Characteristic; - AdministratorOnlyAccess: Characteristic; - AirParticulateDensity: Characteristic; - AirParticulateSize: Characteristic; - AirQuality: Characteristic; - AppMatchingIdentifier: Characteristic; - AudioFeedback: Characteristic; - BatteryLevel: Characteristic; - Brightness: Characteristic; - CarbonDioxideDetected: Characteristic; - CarbonDioxideLevel: Characteristic; - CarbonDioxidePeakLevel: Characteristic; - CarbonMonoxideDetected: Characteristic; - CarbonMonoxideLevel: Characteristic; - CarbonMonoxidePeakLevel: Characteristic; - Category: Characteristic; - ChargingState: Characteristic; - ClosedCaptions: Characteristic; - ColorTemperature: Characteristic; - ConfigureBridgedAccessory: Characteristic; - ConfigureBridgedAccessoryStatus: Characteristic; - ConfiguredName: Characteristic; - ContactSensorState: Characteristic; - CoolingThresholdTemperature: Characteristic; - CurrentAirPurifierState: Characteristic; - CurrentAmbientLightLevel: Characteristic; - CurrentDoorState: Characteristic; - CurrentFanState: Characteristic; - CurrentHeaterCoolerState: Characteristic; - CurrentHeatingCoolingState: Characteristic; - CurrentHorizontalTiltAngle: Characteristic; - CurrentHumidifierDehumidifierState: Characteristic; - CurrentMediaState: Characteristic; - CurrentPosition: Characteristic; - CurrentRelativeHumidity: Characteristic; - CurrentSlatState: Characteristic; - CurrentTemperature: Characteristic; - CurrentTiltAngle: Characteristic; - CurrentTime: Characteristic; - CurrentVerticalTiltAngle: Characteristic; - CurrentVisibilityState: Characteristic; - DayoftheWeek: Characteristic; - DigitalZoom: Characteristic; - DiscoverBridgedAccessories: Characteristic; - DiscoveredBridgedAccessories: Characteristic; - DisplayOrder: Characteristic; - FilterChangeIndication: Characteristic; - FilterLifeLevel: Characteristic; - FirmwareRevision: Characteristic; - HardwareRevision: Characteristic; - HeatingThresholdTemperature: Characteristic; - HoldPosition: Characteristic; - Hue: Characteristic; - Identifier: Characteristic; - Identify: Characteristic; - ImageMirroring: Characteristic; - ImageRotation: Characteristic; - InUse: Characteristic; - InputDeviceType: Characteristic; - InputSourceType: Characteristic; - IsConfigured: Characteristic; - LeakDetected: Characteristic; - LinkQuality: Characteristic; - LockControlPoint: Characteristic; - LockCurrentState: Characteristic; - LockLastKnownAction: Characteristic; - LockManagementAutoSecurityTimeout: Characteristic; - LockPhysicalControls: Characteristic; - LockTargetState: Characteristic; - Logs: Characteristic; - Manufacturer: Characteristic; - Model: Characteristic; - MotionDetected: Characteristic; - Mute: Characteristic; - Name: Characteristic; - NightVision: Characteristic; - NitrogenDioxideDensity: Characteristic; - ObstructionDetected: Characteristic; - OccupancyDetected: Characteristic; - On: Characteristic; - OpticalZoom: Characteristic; - OutletInUse: Characteristic; - OzoneDensity: Characteristic; - PM10Density: Characteristic; - PM2_5Density: Characteristic; - PairSetup: Characteristic; - PairVerify: Characteristic; - PairingFeatures: Characteristic; - PairingPairings: Characteristic; - PictureMode: Characteristic; - PositionState: Characteristic; - PowerModeSelection: Characteristic; - ProgramMode: Characteristic; - ProgrammableSwitchEvent: Characteristic; - ProgrammableSwitchOutputState: Characteristic; - Reachable: Characteristic; - RelativeHumidityDehumidifierThreshold: Characteristic; - RelativeHumidityHumidifierThreshold: Characteristic; - RelayControlPoint: Characteristic; - RelayEnabled: Characteristic; - RelayState: Characteristic; - RemainingDuration: Characteristic; - RemoteKey: Characteristic; - ResetFilterIndication: Characteristic; - RotationDirection: Characteristic; - RotationSpeed: Characteristic; - Saturation: Characteristic; - SecuritySystemAlarmType: Characteristic; - SecuritySystemCurrentState: Characteristic; - SecuritySystemTargetState: Characteristic; - SelectedRTPStreamConfiguration: Characteristic; - SerialNumber: Characteristic; - ServiceLabelIndex: Characteristic; - ServiceLabelNamespace: Characteristic; - SetDuration: Characteristic; - SetupEndpoints: Characteristic; - SlatType: Characteristic; - SleepDiscoveryMode: Characteristic; - SmokeDetected: Characteristic; - SoftwareRevision: Characteristic; - StatusActive: Characteristic; - StatusFault: Characteristic; - StatusJammed: Characteristic; - StatusLowBattery: Characteristic; - StatusTampered: Characteristic; - StreamingStatus: Characteristic; - SulphurDioxideDensity: Characteristic; - SupportedAudioStreamConfiguration: Characteristic; - SupportedRTPConfiguration: Characteristic; - SupportedVideoStreamConfiguration: Characteristic; - SwingMode: Characteristic; - TargetAirPurifierState: Characteristic; - TargetAirQuality: Characteristic; - TargetDoorState: Characteristic; - TargetFanState: Characteristic; - TargetHeaterCoolerState: Characteristic; - TargetHeatingCoolingState: Characteristic; - TargetHorizontalTiltAngle: Characteristic; - TargetHumidifierDehumidifierState: Characteristic; - TargetMediaState: Characteristic; - TargetPosition: Characteristic; - TargetRelativeHumidity: Characteristic; - TargetSlatState: Characteristic; - TargetTemperature: Characteristic; - TargetTiltAngle: Characteristic; - TargetVerticalTiltAngle: Characteristic; - TargetVisibilityState: Characteristic; - TemperatureDisplayUnits: Characteristic; - TimeUpdate: Characteristic; - TunnelConnectionTimeout: Characteristic; - TunneledAccessoryAdvertising: Characteristic; - TunneledAccessoryConnected: Characteristic; - TunneledAccessoryStateNumber: Characteristic; - VOCDensity: Characteristic; - ValveType: Characteristic; - Version: Characteristic; - Volume: Characteristic; - VolumeControlType: Characteristic; - VolumeSelector: Characteristic; - WaterLevel: Characteristic; - } - - - module Characteristic { - export enum Formats { - BOOL, - INT, - FLOAT, - STRING, - ARRAY, // unconfirmed - DICTIONARY, // unconfirmed - UINT8, - UINT16, - UINT32, - UINT64, - DATA, // unconfirmed - TLV8 - } - - export enum Units { - // HomeKit only defines Celsius, for Fahrenheit, it requires iOS app to do the conversion. - CELSIUS, - PERCENTAGE, - ARC_DEGREE, - LUX, - SECONDS - } - - export enum Perms { - READ, - WRITE, - NOTIFY, - HIDDEN - } - } - - export interface PublishInfo { - port: number; - username: string; - pincode: string; - category: number; - } - - export interface Accessory extends IEventEmitterAccessory { - new(displayName: string, UUID: string): Accessory; - displayName: string; - username: string; - pincode: string; - UUID: string; - aid: string; - bridged: boolean; - bridgedAccessories: Accessory[]; - reachable: boolean; - category: Accessory.Categories; - services: Service[]; - cameraSource: CameraSource; - Categories: typeof Accessory.Categories - addService(service: Service | Function): Service; - removeService(service: Service): void; - getService(name: string | Function): Service; - updateReachability(reachable: boolean): void; - addBridgedAccessory(accessory: Accessory, deferUpdate: boolean): Accessory; - addBridgedAccessories(accessories: Accessory[]): void - removeBridgedAccessory(accessory: Accessory, deferUpdate: boolean): void; - removeBridgedAccessories(accessories: Accessory[]): void; - getCharacteristicByIID(iid: string): Characteristic; - getBridgedAccessoryByAID(aid: string): Accessory; - findCharacteristic(aid: string, iid: string): Accessory; - configureCameraSource(cameraSource: CameraSource): void; - toHAP(opt: any): JSON; - publish(info: PublishInfo, allowInsecureRequest: boolean): void; - destroy(): void; - setupURI(): string; - } - - module Accessory { - export enum Categories { - OTHER = 1, - BRIDGE = 2, - FAN = 3, - GARAGE_DOOR_OPENER = 4, - LIGHTBULB = 5, - DOOR_LOCK = 6, - OUTLET = 7, - SWITCH = 8, - THERMOSTAT = 9, - SENSOR = 10, - ALARM_SYSTEM = 11, - SECURITY_SYSTEM = 11, - DOOR = 12, - WINDOW = 13, - WINDOW_COVERING = 14, - PROGRAMMABLE_SWITCH = 15, - RANGE_EXTENDER = 16, - CAMERA = 17, - IP_CAMERA = 17, - VIDEO_DOORBELL = 18, - AIR_PURIFIER = 19, - AIR_HEATER = 20, - AIR_CONDITIONER = 21, - AIR_HUMIDIFIER = 22, - AIR_DEHUMIDIFIER = 23, - APPLE_TV = 24, - SPEAKER = 26, - AIRPORT = 27, - SPRINKLER = 28, - FAUCET = 29, - SHOWER_HEAD = 30, - TELEVISION = 31, - TARGET_CONTROLLER = 32 - } - } - - export interface HAPNodeJS { - init(storagePath?: string): void, - uuid: uuid, - Accessory: Accessory, - Service: Service, - Characteristic: Characteristic - } - - -} - -declare var hapNodeJS: HAPNodeJS.HAPNodeJS; - -declare module "hap-nodejs" { - export = hapNodeJS; -} \ No newline at end of file diff --git a/src/models/iAccessory.ts b/src/models/iAccessory.ts deleted file mode 100644 index 681a8b9..0000000 --- a/src/models/iAccessory.ts +++ /dev/null @@ -1,14 +0,0 @@ - -/** - * Interface to describe homebridge required elements. - */ -export interface IAccessory { - /** - * Required by homebridge. - */ - name: string, - /** - * Called by homebridge to gather services. - */ - getServices(): Array, -} \ No newline at end of file diff --git a/src/platform.ts b/src/platform.ts new file mode 100644 index 0000000..ac33283 --- /dev/null +++ b/src/platform.ts @@ -0,0 +1,137 @@ +import discover from "@watsonb8/wiz-lib/build/discovery"; +import { + API, + Characteristic, + DynamicPlatformPlugin, + Logger, + Logging, + PlatformAccessory, + PlatformConfig, + Service, + UnknownContext, +} from "homebridge"; +import { v3 } from "node-hue-api"; +import Api from "node-hue-api/lib/api/Api"; +import { FluxAccessory } from "./fluxAccessory"; +import { IConfig } from "./models/iConfig"; +import { PLATFORM_NAME, PLUGIN_NAME } from "./settings"; +import { Sleep } from "./sleep"; + +export class Platform implements DynamicPlatformPlugin { + private hue: Api | undefined; + private accessory: PlatformAccessory | undefined = undefined; + private config: IConfig; + constructor( + public readonly log: Logger, + config: PlatformConfig, + public readonly api: API + ) { + this.config = config as unknown as IConfig; + this.log.info("INFO - Registering Flux platform"); + this.api.on("didFinishLaunching", this.didFinishLaunching.bind(this)); + } + + async configureAccessory(accessory: PlatformAccessory) { + this.log.info("Loading accessory from cache:", accessory.displayName); + + this.accessory = accessory; + } + + /** + * Handler for didFinishLaunching + * Happens after constructor + */ + private async didFinishLaunching() { + this.log.info(`INFO - Done registering Flux platform`); + + await this.connectHue(); + const wizBulbs = await this.connectWiz(); + + this.log.info("Registering accessory: " + this.config.name); + const uuid = this.api.hap.uuid.generate(this.config.name); + + // Load accessory if not cached + if (!this.accessory) { + this.accessory = new this.api.platformAccessory( + this.config.name, + uuid + ); + this.accessory.context["DeviceName"] = this.config.name; + this.accessory.context["Type"] = typeof "Flux"; + this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [ + this.accessory, + ]); + } + + new FluxAccessory({ + platform: this, + accessory: this.accessory, + hue: this.hue!, + wizBulbs: wizBulbs ?? [], + config: this.config, + }); + } + + private connectWiz = async () => { + if (!this.config) { + return; + } + + return await discover(); + }; + + private connectHue = async () => { + if (!this.config) { + return; + } + + if (this.config.userName && this.config.clientKey) { + this.hue = await v3.api + .createLocal(this.config.ipAddress) + .connect( + this.config.userName, + this.config.clientKey, + undefined + ); + this.log.info("Using existing connection info"); + } else { + const unauthenticatedApi = await v3.api + .createLocal(this.config.ipAddress) + .connect(undefined, undefined, undefined); + let createdUser; + let connected = false; + while (!connected) { + try { + this.log.info("Creating hue user. Push link button"); + createdUser = await unauthenticatedApi.users.createUser( + "homebridge", + "HueChase" + ); + + this.hue = await v3.api + .createLocal(this.config.ipAddress) + .connect( + createdUser.username, + createdUser.clientKey, + undefined + ); + this.log.info("Connected to Hue Bridge"); + this.log.info( + `UserName: ${createdUser.username}, ClientKey: ${createdUser.clientkey}` + ); + connected = true; + } catch (err: any) { + if (err.getHueErrorType() === 101) { + this.log.info( + "The Link button on the bridge was not pressed. Please press the Link button and try again." + ); + Sleep(5000); + } else { + this.log.info(`Unexpected Error: ${err.message}`); + break; + } + } + } + } + }; +} diff --git a/src/settings.ts b/src/settings.ts new file mode 100644 index 0000000..71ccaaa --- /dev/null +++ b/src/settings.ts @@ -0,0 +1,9 @@ +/** + * This is the name of the platform that users will use to register the plugin in the Homebridge config.json + */ +export const PLATFORM_NAME = "Flux"; + +/** + * This must match the name of your plugin as defined the package.json + */ +export const PLUGIN_NAME = "@watsonb8/homebridge-flux"; diff --git a/tsconfig.json b/tsconfig.json index fce8d3c..66c10ad 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,18 +2,18 @@ "compilerOptions": { /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, + "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ + "sourceMap": true /* Generates corresponding '.map' file. */, // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./bin", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + "outDir": "./bin" /* Redirect output structure to the directory. */, + "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ @@ -22,7 +22,7 @@ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ + "strict": true /* Enable all strict type-checking options. */, // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ @@ -36,14 +36,14 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ + "types": [] /* Type declaration files to be included in compilation. */, // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ /* Source Map Options */ @@ -55,6 +55,7 @@ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ /* Advanced Options */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, + "skipLibCheck": false } -} \ No newline at end of file +}