This commit is contained in:
parent
728d3a64a2
commit
829e45b329
469
package-lock.json
generated
469
package-lock.json
generated
@ -4,6 +4,11 @@
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@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=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "13.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.11.1.tgz",
|
||||
@ -43,6 +48,11 @@
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz",
|
||||
"integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ=="
|
||||
},
|
||||
"available-typed-arrays": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
|
||||
"integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
|
||||
@ -52,15 +62,14 @@
|
||||
}
|
||||
},
|
||||
"bonjour-hap": {
|
||||
"version": "3.5.4",
|
||||
"resolved": "https://registry.npmjs.org/bonjour-hap/-/bonjour-hap-3.5.4.tgz",
|
||||
"integrity": "sha512-MgU27SEZYQ09Skm71Xa7SZoAg259V4IlAJNWaloFVMlYDn1OjJy3nkwSixRHnDzrcLWocVI84f9exI1ObZChBw==",
|
||||
"version": "3.6.3",
|
||||
"resolved": "https://registry.npmjs.org/bonjour-hap/-/bonjour-hap-3.6.3.tgz",
|
||||
"integrity": "sha512-qyLU96ICCYbpOFiMCjA3aNYH5Jc83XH1YX6+EXWukyyiNXzXH2LZv8AVmGW33FceF3gfUM4jYoKX2xChtNDUnA==",
|
||||
"requires": {
|
||||
"array-flatten": "^2.1.0",
|
||||
"deep-equal": "^1.0.1",
|
||||
"dns-equal": "^1.0.0",
|
||||
"dns-txt": "^2.0.2",
|
||||
"multicast-dns": "^7.2.0",
|
||||
"array-flatten": "^2.1.2",
|
||||
"deep-equal": "^2.0.5",
|
||||
"ip": "^1.1.5",
|
||||
"multicast-dns": "^7.2.3",
|
||||
"multicast-dns-service-types": "^1.1.0"
|
||||
}
|
||||
},
|
||||
@ -69,16 +78,20 @@
|
||||
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
|
||||
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="
|
||||
},
|
||||
"buffer-indexof": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz",
|
||||
"integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g=="
|
||||
},
|
||||
"buffer-shims": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz",
|
||||
"integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E="
|
||||
},
|
||||
"call-bind": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"get-intrinsic": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
@ -113,16 +126,25 @@
|
||||
"integrity": "sha512-1K5Y6MykxQYfHBcFfAj2uBaLmwreq4MsjsvrlgcEOvg+X82IeeXlIVIVkBMiypksu+yo9vcYP6lfU3qTedofSQ=="
|
||||
},
|
||||
"deep-equal": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz",
|
||||
"integrity": "sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==",
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.0.5.tgz",
|
||||
"integrity": "sha512-nPiRgmbAtm1a3JsnLCf6/SLfXcjyN5v8L1TXzdCmHrXJ4hx+gW/w1YCcn7z8gJtSiDArZCgYtbao3QqLm/N1Sw==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.0",
|
||||
"es-get-iterator": "^1.1.1",
|
||||
"get-intrinsic": "^1.0.1",
|
||||
"is-arguments": "^1.0.4",
|
||||
"is-date-object": "^1.0.1",
|
||||
"is-regex": "^1.0.4",
|
||||
"object-is": "^1.0.1",
|
||||
"is-date-object": "^1.0.2",
|
||||
"is-regex": "^1.1.1",
|
||||
"isarray": "^2.0.5",
|
||||
"object-is": "^1.1.4",
|
||||
"object-keys": "^1.1.1",
|
||||
"regexp.prototype.flags": "^1.2.0"
|
||||
"object.assign": "^4.1.2",
|
||||
"regexp.prototype.flags": "^1.3.0",
|
||||
"side-channel": "^1.0.3",
|
||||
"which-boxed-primitive": "^1.0.1",
|
||||
"which-collection": "^1.0.1",
|
||||
"which-typed-array": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"define-properties": {
|
||||
@ -133,44 +155,54 @@
|
||||
"object-keys": "^1.0.12"
|
||||
}
|
||||
},
|
||||
"dns-equal": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz",
|
||||
"integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0="
|
||||
},
|
||||
"dns-packet": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-4.2.0.tgz",
|
||||
"integrity": "sha512-bn1AKpfkFbm0MIioOMHZ5qJzl2uypdBwI4nYNsqvhjsegBhcKJUlCrMPWLx6JEezRjxZmxhtIz/FkBEur2l8Cw==",
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.3.1.tgz",
|
||||
"integrity": "sha512-spBwIj0TK0Ey3666GwIdWVfUpLyubpU53BTCu8iPn4r4oXd9O14Hjg3EHw3ts2oed77/SeckunUYCyRlSngqHw==",
|
||||
"requires": {
|
||||
"ip": "^1.1.5",
|
||||
"safe-buffer": "^5.1.1"
|
||||
}
|
||||
},
|
||||
"dns-txt": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz",
|
||||
"integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=",
|
||||
"requires": {
|
||||
"buffer-indexof": "^1.0.0"
|
||||
"@leichtgewicht/ip-codec": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"es-abstract": {
|
||||
"version": "1.17.5",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz",
|
||||
"integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==",
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz",
|
||||
"integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"es-to-primitive": "^1.2.1",
|
||||
"function-bind": "^1.1.1",
|
||||
"get-intrinsic": "^1.1.1",
|
||||
"get-symbol-description": "^1.0.0",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.1",
|
||||
"is-callable": "^1.1.5",
|
||||
"is-regex": "^1.0.5",
|
||||
"object-inspect": "^1.7.0",
|
||||
"has-symbols": "^1.0.2",
|
||||
"internal-slot": "^1.0.3",
|
||||
"is-callable": "^1.2.4",
|
||||
"is-negative-zero": "^2.0.1",
|
||||
"is-regex": "^1.1.4",
|
||||
"is-shared-array-buffer": "^1.0.1",
|
||||
"is-string": "^1.0.7",
|
||||
"is-weakref": "^1.0.1",
|
||||
"object-inspect": "^1.11.0",
|
||||
"object-keys": "^1.1.1",
|
||||
"object.assign": "^4.1.0",
|
||||
"string.prototype.trimleft": "^2.1.1",
|
||||
"string.prototype.trimright": "^2.1.1"
|
||||
"object.assign": "^4.1.2",
|
||||
"string.prototype.trimend": "^1.0.4",
|
||||
"string.prototype.trimstart": "^1.0.4",
|
||||
"unbox-primitive": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"es-get-iterator": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.2.tgz",
|
||||
"integrity": "sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"get-intrinsic": "^1.1.0",
|
||||
"has-symbols": "^1.0.1",
|
||||
"is-arguments": "^1.1.0",
|
||||
"is-map": "^2.0.2",
|
||||
"is-set": "^2.0.2",
|
||||
"is-string": "^1.0.5",
|
||||
"isarray": "^2.0.5"
|
||||
}
|
||||
},
|
||||
"es-to-primitive": {
|
||||
@ -189,9 +221,9 @@
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
||||
},
|
||||
"fast-srp-hap": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-srp-hap/-/fast-srp-hap-1.0.1.tgz",
|
||||
"integrity": "sha1-N3Ek0Za8alFXquWze/X6NbtK0tk="
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-srp-hap/-/fast-srp-hap-1.2.0.tgz",
|
||||
"integrity": "sha512-WgC3eJEaQo94pq6Ua+l4zdceMLkDXvhZ4OpyQsFdlTFDH7GwJ6fikr+C/mkKzaIxbnODkqee8cOd0KjuW2ebKQ=="
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.5.10",
|
||||
@ -201,16 +233,40 @@
|
||||
"debug": "=3.1.0"
|
||||
}
|
||||
},
|
||||
"foreach": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
|
||||
"integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k="
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
|
||||
},
|
||||
"get-intrinsic": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
|
||||
"integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"get-ssl-certificate": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/get-ssl-certificate/-/get-ssl-certificate-2.3.3.tgz",
|
||||
"integrity": "sha512-aKYXS1S5+2IYw4W5+lKC/M+lvaNYPe0PhnQ144NWARcBg35H3ZvyVZ6y0LNGtiAxggFBHeO7LaVGO4bgHK4g1Q=="
|
||||
},
|
||||
"get-symbol-description": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz",
|
||||
"integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"get-intrinsic": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"graceful-readlink": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
|
||||
@ -266,10 +322,23 @@
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"has-symbols": {
|
||||
"has-bigints": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
|
||||
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg=="
|
||||
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz",
|
||||
"integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA=="
|
||||
},
|
||||
"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=="
|
||||
},
|
||||
"has-tostringtag": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz",
|
||||
"integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==",
|
||||
"requires": {
|
||||
"has-symbols": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"homebridge": {
|
||||
"version": "0.4.53",
|
||||
@ -284,42 +353,152 @@
|
||||
"semver": "5.0.3"
|
||||
}
|
||||
},
|
||||
"internal-slot": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz",
|
||||
"integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==",
|
||||
"requires": {
|
||||
"get-intrinsic": "^1.1.0",
|
||||
"has": "^1.0.3",
|
||||
"side-channel": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"ip": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
|
||||
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
|
||||
},
|
||||
"is-arguments": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz",
|
||||
"integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-bigint": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz",
|
||||
"integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA=="
|
||||
"resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz",
|
||||
"integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==",
|
||||
"requires": {
|
||||
"has-bigints": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"is-boolean-object": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz",
|
||||
"integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-callable": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz",
|
||||
"integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q=="
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz",
|
||||
"integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w=="
|
||||
},
|
||||
"is-date-object": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz",
|
||||
"integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g=="
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz",
|
||||
"integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==",
|
||||
"requires": {
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-map": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz",
|
||||
"integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg=="
|
||||
},
|
||||
"is-negative-zero": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz",
|
||||
"integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA=="
|
||||
},
|
||||
"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==",
|
||||
"requires": {
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-regex": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz",
|
||||
"integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==",
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
|
||||
"integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==",
|
||||
"requires": {
|
||||
"has": "^1.0.3"
|
||||
"call-bind": "^1.0.2",
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-set": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz",
|
||||
"integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g=="
|
||||
},
|
||||
"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=="
|
||||
},
|
||||
"is-string": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz",
|
||||
"integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==",
|
||||
"requires": {
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-symbol": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
|
||||
"integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==",
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz",
|
||||
"integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==",
|
||||
"requires": {
|
||||
"has-symbols": "^1.0.1"
|
||||
"has-symbols": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"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==",
|
||||
"requires": {
|
||||
"available-typed-arrays": "^1.0.5",
|
||||
"call-bind": "^1.0.2",
|
||||
"es-abstract": "^1.18.5",
|
||||
"foreach": "^2.0.5",
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-weakmap": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz",
|
||||
"integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA=="
|
||||
},
|
||||
"is-weakref": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz",
|
||||
"integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"is-weakset": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz",
|
||||
"integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"get-intrinsic": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"isarray": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
|
||||
"integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
@ -339,11 +518,11 @@
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"multicast-dns": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.2.tgz",
|
||||
"integrity": "sha512-XqSMeO8EWV/nOXOpPV8ztIpNweVfE1dSpz6SQvDPp71HD74lMXjt4m/mWB1YBMG0kHtOodxRWc5WOb/UNN1A5g==",
|
||||
"version": "7.2.4",
|
||||
"resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.4.tgz",
|
||||
"integrity": "sha512-XkCYOU+rr2Ft3LI6w4ye51M3VK31qJXFIxu0XLw169PtKG0Zx47OrXeVW/GCYOfpC9s1yyyf1S+L8/4LY0J9Zw==",
|
||||
"requires": {
|
||||
"dns-packet": "^4.0.0",
|
||||
"dns-packet": "^5.2.2",
|
||||
"thunky": "^1.0.2"
|
||||
}
|
||||
},
|
||||
@ -388,14 +567,18 @@
|
||||
}
|
||||
},
|
||||
"object-inspect": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
|
||||
"integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw=="
|
||||
"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=="
|
||||
},
|
||||
"object-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.0.2.tgz",
|
||||
"integrity": "sha512-Epah+btZd5wrrfjkJZq1AOB9O6OxUQto45hzFd7lXGrpHPGE0W1k+426yrZV+k6NJOzLNNW/nVsmZdIWsAqoOQ=="
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz",
|
||||
"integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"object-keys": {
|
||||
"version": "1.1.1",
|
||||
@ -403,14 +586,14 @@
|
||||
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
|
||||
},
|
||||
"object.assign": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz",
|
||||
"integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==",
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz",
|
||||
"integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==",
|
||||
"requires": {
|
||||
"define-properties": "^1.1.2",
|
||||
"function-bind": "^1.1.1",
|
||||
"has-symbols": "^1.0.0",
|
||||
"object-keys": "^1.0.11"
|
||||
"call-bind": "^1.0.0",
|
||||
"define-properties": "^1.1.3",
|
||||
"has-symbols": "^1.0.1",
|
||||
"object-keys": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"opencollective-postinstall": {
|
||||
@ -429,60 +612,45 @@
|
||||
"integrity": "sha1-/8bCii/Av7RwUrR+I/T0RqX7254="
|
||||
},
|
||||
"regexp.prototype.flags": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz",
|
||||
"integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==",
|
||||
"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==",
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.0-next.1"
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
|
||||
"integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz",
|
||||
"integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no="
|
||||
},
|
||||
"side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.0",
|
||||
"get-intrinsic": "^1.0.2",
|
||||
"object-inspect": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"string.prototype.trimend": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.0.tgz",
|
||||
"integrity": "sha512-EEJnGqa/xNfIg05SxiPSqRS7S9qwDhYts1TSLR1BQfYUfPe1stofgGKvwERK9+9yf+PpfBMlpBaCHucXGPQfUA==",
|
||||
"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==",
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.5"
|
||||
}
|
||||
},
|
||||
"string.prototype.trimleft": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz",
|
||||
"integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==",
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.5",
|
||||
"string.prototype.trimstart": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"string.prototype.trimright": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz",
|
||||
"integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==",
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.5",
|
||||
"string.prototype.trimend": "^1.0.0"
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"string.prototype.trimstart": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.0.tgz",
|
||||
"integrity": "sha512-iCP8g01NFYiiBOnwG1Xc3WZLyoo+RuBymwIlWncShXDDJYWN6DbnM3odslBJdgCdRlq94B5s63NWAZlcn2CS4w==",
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz",
|
||||
"integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==",
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.5"
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
@ -523,6 +691,53 @@
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tz-offset/-/tz-offset-0.0.1.tgz",
|
||||
"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==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has-bigints": "^1.0.1",
|
||||
"has-symbols": "^1.0.2",
|
||||
"which-boxed-primitive": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"which-boxed-primitive": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz",
|
||||
"integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==",
|
||||
"requires": {
|
||||
"is-bigint": "^1.0.1",
|
||||
"is-boolean-object": "^1.1.0",
|
||||
"is-number-object": "^1.0.4",
|
||||
"is-string": "^1.0.5",
|
||||
"is-symbol": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"which-collection": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz",
|
||||
"integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==",
|
||||
"requires": {
|
||||
"is-map": "^2.0.1",
|
||||
"is-set": "^2.0.1",
|
||||
"is-weakmap": "^2.0.1",
|
||||
"is-weakset": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"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==",
|
||||
"requires": {
|
||||
"available-typed-arrays": "^1.0.5",
|
||||
"call-bind": "^1.0.2",
|
||||
"es-abstract": "^1.18.5",
|
||||
"foreach": "^2.0.5",
|
||||
"has-tostringtag": "^1.0.0",
|
||||
"is-typed-array": "^1.1.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import { IConfig } from "./models/iConfig";
|
||||
import { GetTimesResult, getTimes } from "suncalc";
|
||||
import HueError = require("node-hue-api/lib/HueError");
|
||||
import cron from "node-cron";
|
||||
import { callbackify } from "util";
|
||||
|
||||
let Service: HAPNodeJS.Service;
|
||||
let Characteristic: HAPNodeJS.Characteristic;
|
||||
@ -16,255 +17,335 @@ const MINUTES_IN_MILLISECOND = 60000;
|
||||
const SECONDS_IN_HOUR = 3600;
|
||||
|
||||
export interface IFluxProps {
|
||||
api: any;
|
||||
log: any;
|
||||
homebridge: any;
|
||||
hue: Api,
|
||||
config: IConfig;
|
||||
api: any;
|
||||
log: any;
|
||||
homebridge: any;
|
||||
hue: Api;
|
||||
config: IConfig;
|
||||
}
|
||||
|
||||
export class FluxAccessory implements IAccessory {
|
||||
private _api: any;
|
||||
private _homebridge: any;
|
||||
private _log: any = {};
|
||||
private _config: IConfig;
|
||||
private _isActive: boolean;
|
||||
private _api: any;
|
||||
private _homebridge: any;
|
||||
private _log: any = {};
|
||||
private _config: IConfig;
|
||||
private _isActive: boolean;
|
||||
|
||||
//Service fields
|
||||
private _switchService: HAPNodeJS.Service;
|
||||
private _infoService: HAPNodeJS.Service;
|
||||
//Service fields
|
||||
private _switchService: HAPNodeJS.Service;
|
||||
private _infoService: HAPNodeJS.Service;
|
||||
|
||||
private _hue: Api;
|
||||
private _hue: Api;
|
||||
|
||||
private _lights: Array<Light> = [];
|
||||
private _lights: Array<Light> = [];
|
||||
|
||||
private _times: GetTimesResult;
|
||||
private _times: GetTimesResult;
|
||||
|
||||
constructor(props: IFluxProps) {
|
||||
//Assign class variables
|
||||
this._log = props.log;
|
||||
this._api = props.api;
|
||||
this._config = props.config;
|
||||
Service = props.api.hap.Service;
|
||||
Characteristic = props.api.hap.Characteristic;
|
||||
this._homebridge = props.homebridge;
|
||||
this._isActive = false;
|
||||
constructor(props: IFluxProps) {
|
||||
//Assign class variables
|
||||
this._log = props.log;
|
||||
this._api = props.api;
|
||||
this._config = props.config;
|
||||
Service = props.api.hap.Service;
|
||||
Characteristic = props.api.hap.Characteristic;
|
||||
this._homebridge = props.homebridge;
|
||||
this._isActive = false;
|
||||
|
||||
this._times = getTimes(new Date(), this._config.latitude, this._config.longitude);
|
||||
this._times = getTimes(
|
||||
new Date(),
|
||||
this._config.latitude,
|
||||
this._config.longitude
|
||||
);
|
||||
|
||||
//Schedule job to refresh times
|
||||
cron.schedule("0 12 * * *", () => {
|
||||
this._times = getTimes(new Date(), this._config.latitude, this._config.longitude);
|
||||
this._log("Updated sunset times");
|
||||
}, {
|
||||
scheduled: true
|
||||
}).start();
|
||||
//Schedule job to refresh times
|
||||
cron
|
||||
.schedule(
|
||||
"0 12 * * *",
|
||||
() => {
|
||||
this._times = getTimes(
|
||||
new Date(),
|
||||
this._config.latitude,
|
||||
this._config.longitude
|
||||
);
|
||||
this._log("Updated sunset times");
|
||||
},
|
||||
{
|
||||
scheduled: true,
|
||||
}
|
||||
)
|
||||
.start();
|
||||
|
||||
this._hue = props.hue;
|
||||
this.name = this._config.name;
|
||||
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.platformAccessory = new this._homebridge.platformAccessory(
|
||||
this.name,
|
||||
this.generateUUID(),
|
||||
this._homebridge.hap.Accessory.Categories.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");
|
||||
//@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 = new Service.Switch(this.name, "fluxService");
|
||||
|
||||
this._switchService.getCharacteristic(Characteristic.On)
|
||||
//@ts-ignore
|
||||
.on("set", this.onSetEnabled)
|
||||
.on("get", this.onGetEnabled);
|
||||
this._switchService
|
||||
.getCharacteristic(Characteristic.On)
|
||||
//@ts-ignore
|
||||
.on("set", this.onSetEnabled)
|
||||
.on("get", this.onGetEnabled);
|
||||
}
|
||||
|
||||
public name: string = "Flux";
|
||||
|
||||
public platformAccessory: any;
|
||||
|
||||
/**
|
||||
* Handler for switch set event
|
||||
* @param callback The callback function to call when complete
|
||||
*/
|
||||
private onSetEnabled = async (
|
||||
activeState: boolean,
|
||||
callback: (error?: Error | null | undefined) => void
|
||||
) => {
|
||||
if (activeState) {
|
||||
this._times = getTimes(
|
||||
new Date(),
|
||||
this._config.latitude,
|
||||
this._config.longitude
|
||||
);
|
||||
this.update();
|
||||
} else {
|
||||
this._isActive = false;
|
||||
}
|
||||
return callback();
|
||||
};
|
||||
|
||||
public name: string = "Flux";
|
||||
/**
|
||||
* Handler for switch get event
|
||||
* @param callback The callback function to call when complete
|
||||
*/
|
||||
private onGetEnabled = (): boolean => {
|
||||
return this._isActive;
|
||||
};
|
||||
|
||||
public platformAccessory: any;
|
||||
/**
|
||||
* Called by homebridge to gather services.
|
||||
*/
|
||||
public getServices = (): Array<HAPNodeJS.Service> => {
|
||||
return [this._infoService, this._switchService!];
|
||||
};
|
||||
|
||||
/**
|
||||
* Handler for switch set event
|
||||
* @param callback The callback function to call when complete
|
||||
*/
|
||||
private onSetEnabled = async (activeState: boolean, callback: (error?: Error | null | undefined) => void) => {
|
||||
if (activeState) {
|
||||
this._times = getTimes(new Date(), this._config.latitude, this._config.longitude);
|
||||
this.update();
|
||||
/**
|
||||
* Popuplates internal lights array using the configuration values
|
||||
*/
|
||||
private getLights = async (): Promise<void> => {
|
||||
for (const value of this._config.lights) {
|
||||
//@ts-ignore
|
||||
const light: Light = await this._hue.lights.getLightByName(value);
|
||||
this._lights.push(light);
|
||||
}
|
||||
};
|
||||
|
||||
private colorTempToRgb = (
|
||||
kelvin: number
|
||||
): { red: number; green: number; blue: number } => {
|
||||
var temp = kelvin / 100;
|
||||
var red, green, blue;
|
||||
if (temp <= 66) {
|
||||
red = 255;
|
||||
green = temp;
|
||||
green = 99.4708025861 * Math.log(green) - 161.1195681661;
|
||||
|
||||
if (temp <= 19) {
|
||||
blue = 0;
|
||||
} else {
|
||||
blue = temp - 10;
|
||||
blue = 138.5177312231 * Math.log(blue) - 305.0447927307;
|
||||
}
|
||||
} else {
|
||||
red = temp - 60;
|
||||
red = 329.698727446 * Math.pow(red, -0.1332047592);
|
||||
|
||||
green = temp - 60;
|
||||
green = 288.1221695283 * Math.pow(green, -0.0755148492);
|
||||
|
||||
blue = 255;
|
||||
}
|
||||
return {
|
||||
red: this.clamp(red, 0, 255),
|
||||
green: this.clamp(green, 0, 255),
|
||||
blue: this.clamp(blue, 0, 255),
|
||||
};
|
||||
};
|
||||
|
||||
private clamp(x: number, min: number, max: number) {
|
||||
if (x < min) {
|
||||
return min;
|
||||
}
|
||||
if (x > max) {
|
||||
return max;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
private isHueError = (object: any): object is HueError => {
|
||||
return "_hueError" in object;
|
||||
};
|
||||
|
||||
private setLights = async (state: LightState) => {
|
||||
const promises: Array<Promise<unknown> | PromiseLike<unknown>> = [];
|
||||
this._lights.map(async (light: Light) => {
|
||||
try {
|
||||
await this._hue.lights.setLightState(light.id, state);
|
||||
} catch (err) {
|
||||
if (
|
||||
this.isHueError(err) &&
|
||||
err.message ===
|
||||
"parameter, xy, is not modifiable. Device is set to off."
|
||||
) {
|
||||
//Eat this
|
||||
} else {
|
||||
this._isActive = false;
|
||||
this._log(`Error while setting lights: ${err}`);
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
});
|
||||
|
||||
await Promise.all(promises);
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function to generate a UUID
|
||||
*/
|
||||
private generateUUID(): string {
|
||||
// Public Domain/MIT
|
||||
var d = new Date().getTime();
|
||||
if (
|
||||
typeof performance !== "undefined" &&
|
||||
typeof performance.now === "function"
|
||||
) {
|
||||
d += performance.now(); //use high-precision timer if available
|
||||
}
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
|
||||
/[xy]/g,
|
||||
function (c) {
|
||||
var r = (d + Math.random() * 16) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for switch get event
|
||||
* @param callback The callback function to call when complete
|
||||
*/
|
||||
private onGetEnabled = (callback: (error: Error | null, value: boolean) => void) => {
|
||||
return callback(null, this._isActive);
|
||||
/**
|
||||
* Gets adjusted color temperature.
|
||||
*/
|
||||
private getTempOffset = (
|
||||
startTemp: number,
|
||||
endTemp: number,
|
||||
startTime: Date,
|
||||
endTime: Date
|
||||
) => {
|
||||
const now = this.getNow().getTime();
|
||||
const percentComplete =
|
||||
(now - startTime.getTime()) / (endTime.getTime() - startTime.getTime());
|
||||
const tempRange = Math.abs(startTemp - endTemp);
|
||||
const tempOffset = tempRange * percentComplete;
|
||||
return startTemp - tempOffset;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the current time. Use test time if present.
|
||||
*/
|
||||
private getNow() {
|
||||
if (this._config.testNowDateString) {
|
||||
return new Date(this._config.testNowDateString);
|
||||
} else {
|
||||
return new Date();
|
||||
}
|
||||
}
|
||||
|
||||
private update = async (): Promise<void> => {
|
||||
this._isActive = true;
|
||||
while (this._isActive) {
|
||||
if (this._lights.length === 0) {
|
||||
await this.getLights();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by homebridge to gather services.
|
||||
*/
|
||||
public getServices = (): Array<HAPNodeJS.Service> => {
|
||||
return [this._infoService, this._switchService!];
|
||||
const now = this.getNow();
|
||||
//Pad start time by an hour before sunset
|
||||
const start = new Date(
|
||||
this._times.sunset.getTime() - 60 * MINUTES_IN_MILLISECOND
|
||||
);
|
||||
const sunsetStart = this._times.sunsetStart;
|
||||
const sunsetEnd = new Date(
|
||||
this._times.sunset.getTime() + this._config.sunsetDuration
|
||||
);
|
||||
const nightStart = new Date(
|
||||
sunsetEnd.getTime() + 60 * MINUTES_IN_MILLISECOND
|
||||
);
|
||||
const sunrise = new Date(
|
||||
this._times.sunrise.getTime() + 1 * SECONDS_IN_DAY
|
||||
);
|
||||
|
||||
const startColorTemp = this._config.ceilingColorTemp
|
||||
? this._config.ceilingColorTemp
|
||||
: 4000;
|
||||
const sunsetColorTemp = this._config.sunsetColorTemp
|
||||
? this._config.sunsetColorTemp
|
||||
: 2800;
|
||||
const floorColorTemp = this._config.floorColorTemp
|
||||
? this._config.floorColorTemp
|
||||
: 1900;
|
||||
|
||||
let newTemp = 0;
|
||||
|
||||
if (start < now && now < sunsetStart) {
|
||||
newTemp = this.getTempOffset(
|
||||
startColorTemp,
|
||||
sunsetColorTemp,
|
||||
start,
|
||||
sunsetStart
|
||||
);
|
||||
} else if (sunsetStart < now && now < sunsetEnd) {
|
||||
newTemp = this._config.sunsetColorTemp;
|
||||
} else if (sunsetEnd < now && now < nightStart) {
|
||||
newTemp = this.getTempOffset(
|
||||
sunsetColorTemp,
|
||||
floorColorTemp,
|
||||
sunsetEnd,
|
||||
nightStart
|
||||
);
|
||||
} else if (nightStart < now && now < sunrise) {
|
||||
newTemp = this._config.floorColorTemp;
|
||||
}
|
||||
|
||||
//Set lights
|
||||
const rgb = this.colorTempToRgb(newTemp);
|
||||
if (rgb && newTemp !== 0) {
|
||||
const lightState = new LightState();
|
||||
lightState
|
||||
.transitionInMillis(
|
||||
this._config.transition ? this._config.transition : 5000
|
||||
)
|
||||
.rgb(
|
||||
rgb.red ? rgb.red : 0,
|
||||
rgb.green ? rgb.green : 0,
|
||||
rgb.blue ? rgb.blue : 0
|
||||
);
|
||||
await this.setLights(lightState);
|
||||
this._log(`Adjusting light temp to ${newTemp}, ${JSON.stringify(rgb)}`);
|
||||
}
|
||||
|
||||
await Sleep(this._config.delay ? this._config.delay : 60000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Popuplates internal lights array using the configuration values
|
||||
*/
|
||||
private getLights = async (): Promise<void> => {
|
||||
for (const value of this._config.lights) {
|
||||
//@ts-ignore
|
||||
const light: Light = await this._hue.lights.getLightByName(value)
|
||||
this._lights.push(light);
|
||||
}
|
||||
}
|
||||
|
||||
private colorTempToRgb = (kelvin: number): { red: number, green: number, blue: number } => {
|
||||
var temp = kelvin / 100;
|
||||
var red, green, blue;
|
||||
if (temp <= 66) {
|
||||
red = 255;
|
||||
green = temp;
|
||||
green = 99.4708025861 * Math.log(green) - 161.1195681661;
|
||||
|
||||
if (temp <= 19) {
|
||||
blue = 0;
|
||||
} else {
|
||||
blue = temp - 10;
|
||||
blue = 138.5177312231 * Math.log(blue) - 305.0447927307;
|
||||
}
|
||||
} else {
|
||||
red = temp - 60;
|
||||
red = 329.698727446 * Math.pow(red, -0.1332047592);
|
||||
|
||||
green = temp - 60;
|
||||
green = 288.1221695283 * Math.pow(green, -0.0755148492);
|
||||
|
||||
blue = 255;
|
||||
}
|
||||
return {
|
||||
red: this.clamp(red, 0, 255),
|
||||
green: this.clamp(green, 0, 255),
|
||||
blue: this.clamp(blue, 0, 255)
|
||||
}
|
||||
}
|
||||
|
||||
private clamp(x: number, min: number, max: number) {
|
||||
if (x < min) { return min; }
|
||||
if (x > max) { return max; }
|
||||
return x;
|
||||
}
|
||||
|
||||
private isHueError = (object: any): object is HueError => {
|
||||
return '_hueError' in object;
|
||||
}
|
||||
|
||||
private setLights = async (state: LightState) => {
|
||||
const promises: Array<Promise<unknown> | PromiseLike<unknown>> = [];
|
||||
this._lights.map(async (light: Light) => {
|
||||
try {
|
||||
await this._hue.lights.setLightState(light.id, state);
|
||||
} catch (err) {
|
||||
if (this.isHueError(err) && err.message === "parameter, xy, is not modifiable. Device is set to off.") {
|
||||
//Eat this
|
||||
} else {
|
||||
this._log(`Error while setting lights: ${err}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to generate a UUID
|
||||
*/
|
||||
private generateUUID(): string { // Public Domain/MIT
|
||||
var d = new Date().getTime();
|
||||
if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
|
||||
d += performance.now(); //use high-precision timer if available
|
||||
}
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = (d + Math.random() * 16) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets adjusted color temperature.
|
||||
*/
|
||||
private getTempOffset = (startTemp: number, endTemp: number, startTime: Date, endTime: Date) => {
|
||||
const now = this.getNow().getTime()
|
||||
const percentComplete = ((now - startTime.getTime()) / (endTime.getTime() - startTime.getTime()));
|
||||
const tempRange = Math.abs(startTemp - endTemp);
|
||||
const tempOffset = tempRange * percentComplete
|
||||
return startTemp - tempOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current time. Use test time if present.
|
||||
*/
|
||||
private getNow() {
|
||||
if (this._config.testNowDateString) {
|
||||
return new Date(this._config.testNowDateString);
|
||||
} else {
|
||||
return new Date();
|
||||
}
|
||||
}
|
||||
|
||||
private update = async (): Promise<void> => {
|
||||
this._isActive = true;
|
||||
while (this._isActive) {
|
||||
if (this._lights.length === 0) {
|
||||
await this.getLights();
|
||||
}
|
||||
|
||||
const now = this.getNow();
|
||||
//Pad start time by an hour before sunset
|
||||
const start = new Date(this._times.sunset.getTime() - (60 * MINUTES_IN_MILLISECOND));
|
||||
const sunsetStart = this._times.sunsetStart;
|
||||
const sunsetEnd = new Date(this._times.sunset.getTime() + this._config.sunsetDuration);
|
||||
const nightStart = new Date(sunsetEnd.getTime() + 60 * MINUTES_IN_MILLISECOND);
|
||||
const sunrise = new Date(this._times.sunrise.getTime() + 1 * SECONDS_IN_DAY);
|
||||
|
||||
const startColorTemp = this._config.ceilingColorTemp ? this._config.ceilingColorTemp : 4000;
|
||||
const sunsetColorTemp = this._config.sunsetColorTemp ? this._config.sunsetColorTemp : 2800;
|
||||
const floorColorTemp = this._config.floorColorTemp ? this._config.floorColorTemp : 1900;
|
||||
|
||||
let newTemp = 0;
|
||||
|
||||
if ((start < now) && (now < sunsetStart)) {
|
||||
newTemp = this.getTempOffset(startColorTemp, sunsetColorTemp, start, sunsetStart);
|
||||
} else if ((sunsetStart < now) && (now < sunsetEnd)) {
|
||||
newTemp = this._config.sunsetColorTemp;
|
||||
} else if ((sunsetEnd < now) && (now < nightStart)) {
|
||||
newTemp = this.getTempOffset(sunsetColorTemp, floorColorTemp, sunsetEnd, nightStart);
|
||||
} else if ((nightStart < now) && (now < sunrise)) {
|
||||
newTemp = this._config.floorColorTemp;
|
||||
}
|
||||
|
||||
//Set lights
|
||||
const rgb = this.colorTempToRgb(newTemp);
|
||||
if (rgb && newTemp !== 0) {
|
||||
const lightState = new LightState();
|
||||
lightState
|
||||
.transitionInMillis(this._config.transition ? this._config.transition : 5000)
|
||||
.rgb(rgb.red ? rgb.red : 0, rgb.green ? rgb.green : 0, rgb.blue ? rgb.blue : 0);
|
||||
await this.setLights(lightState)
|
||||
this._log(`Adjusting light temp to ${newTemp}, ${JSON.stringify(rgb)}`)
|
||||
}
|
||||
|
||||
await Sleep(this._config.delay ? this._config.delay : 60000);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class FluxPlatform {
|
||||
this.log(`UserName: ${createdUser.username}, ClientKey: ${createdUser.clientkey}`)
|
||||
connected = true;
|
||||
|
||||
} catch (err) {
|
||||
} 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);
|
||||
|
Loading…
Reference in New Issue
Block a user