diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cc7bc7..e0bfb89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/) +## [Version 1.5.0](https://github.com/donavanbecker/homebridge-rainbird/compare/v1.4.0...v1.5.0) (2021-11-06) + +### Changes + +- Added enableZone to find Enabled Zones +- Added Command Logging for plugin +- Updated dependencies + ## [Version 1.4.0](https://github.com/donavanbecker/homebridge-rainbird/compare/v1.3.0...v1.4.0) (2021-10-28) ### Changes diff --git a/config.schema.json b/config.schema.json index 6f6433a..7ebae9e 100644 --- a/config.schema.json +++ b/config.schema.json @@ -69,7 +69,7 @@ "debug": { "title": "Logging Settings", "type": "string", - "description": "Enable 'Device' or 'Debug' logging.", + "description": "Enable 'Device', 'Debug' or 'Command' logging.", "oneOf": [ { "title": "Enable Debug Logging", @@ -82,6 +82,12 @@ "enum": [ "device" ] + }, + { + "title": "Enable Command Logging", + "enum": [ + "command" + ] } ], "required": false diff --git a/package-lock.json b/package-lock.json index a8331c8..8ff298f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "homebridge-rainbird", - "version": "1.4.0", + "version": "1.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "homebridge-rainbird", - "version": "1.4.0", + "version": "1.5.0", "funding": [ { "type": "Paypal", @@ -32,12 +32,12 @@ "@types/better-queue": "^3.8.3", "@types/node": "^16.11.6", "@types/node-fetch": "^3.0.3", - "@typescript-eslint/eslint-plugin": "^5.2.0", - "@typescript-eslint/parser": "^5.2.0", - "eslint": "^8.1.0", + "@typescript-eslint/eslint-plugin": "^5.3.0", + "@typescript-eslint/parser": "^5.3.0", + "eslint": "^8.2.0", "homebridge": "^1.3.5", "nodemon": "^2.0.14", - "npm-check-updates": "^11.8.5", + "npm-check-updates": "^12.0.0", "rimraf": "^3.0.2", "ts-node": "^10.4.0", "typescript": "^4.4.4", @@ -70,9 +70,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.3.tgz", - "integrity": "sha512-DHI1wDPoKCBPoLZA3qDR91+3te/wDSc1YhKg3jR8NxKKRJq2hwHwcWv31cSwSYvIBrmbENoYMWcenW8uproQqg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.4.tgz", + "integrity": "sha512-h8Vx6MdxwWI2WM8/zREHMoqdgLNXEL4QX3MWSVMdyNJGvXVOs+6lp+m2hc3FnuMHDc4poxFNI20vCk0OmI4G0Q==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -81,7 +81,7 @@ "globals": "^13.9.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", + "js-yaml": "^4.1.0", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" }, @@ -89,15 +89,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@eslint/eslintrc/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, "node_modules/@eslint/eslintrc/node_modules/ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -107,19 +98,6 @@ "node": ">= 4" } }, - "node_modules/@eslint/eslintrc/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/@gar/promisify": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.2.tgz", @@ -161,9 +139,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz", - "integrity": "sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, "node_modules/@leichtgewicht/ip-codec": { @@ -405,13 +383,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.2.0.tgz", - "integrity": "sha512-qQwg7sqYkBF4CIQSyRQyqsYvP+g/J0To9ZPVNJpfxfekl5RmdvQnFFTVVwpRtaUDFNvjfe/34TgY/dpc3MgNTw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.3.0.tgz", + "integrity": "sha512-ARUEJHJrq85aaiCqez7SANeahDsJTD3AEua34EoQN9pHS6S5Bq9emcIaGGySt/4X2zSi+vF5hAH52sEen7IO7g==", "dev": true, "dependencies": { - "@typescript-eslint/experimental-utils": "5.2.0", - "@typescript-eslint/scope-manager": "5.2.0", + "@typescript-eslint/experimental-utils": "5.3.0", + "@typescript-eslint/scope-manager": "5.3.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -437,15 +415,15 @@ } }, "node_modules/@typescript-eslint/experimental-utils": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.2.0.tgz", - "integrity": "sha512-fWyT3Agf7n7HuZZRpvUYdFYbPk3iDCq6fgu3ulia4c7yxmPnwVBovdSOX7RL+k8u6hLbrXcdAehlWUVpGh6IEw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.3.0.tgz", + "integrity": "sha512-NFVxYTjKj69qB0FM+piah1x3G/63WB8vCBMnlnEHUsiLzXSTWb9FmFn36FD9Zb4APKBLY3xRArOGSMQkuzTF1w==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.2.0", - "@typescript-eslint/types": "5.2.0", - "@typescript-eslint/typescript-estree": "5.2.0", + "@typescript-eslint/scope-manager": "5.3.0", + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/typescript-estree": "5.3.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -461,14 +439,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.2.0.tgz", - "integrity": "sha512-Uyy4TjJBlh3NuA8/4yIQptyJb95Qz5PX//6p8n7zG0QnN4o3NF9Je3JHbVU7fxf5ncSXTmnvMtd/LDQWDk0YqA==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.3.0.tgz", + "integrity": "sha512-rKu/yAReip7ovx8UwOAszJVO5MgBquo8WjIQcp1gx4pYQCwYzag+I5nVNHO4MqyMkAo0gWt2gWUi+36gWAVKcw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.2.0", - "@typescript-eslint/types": "5.2.0", - "@typescript-eslint/typescript-estree": "5.2.0", + "@typescript-eslint/scope-manager": "5.3.0", + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/typescript-estree": "5.3.0", "debug": "^4.3.2" }, "engines": { @@ -488,13 +466,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.2.0.tgz", - "integrity": "sha512-RW+wowZqPzQw8MUFltfKYZfKXqA2qgyi6oi/31J1zfXJRpOn6tCaZtd9b5u9ubnDG2n/EMvQLeZrsLNPpaUiFQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.3.0.tgz", + "integrity": "sha512-22Uic9oRlTsPppy5Tcwfj+QET5RWEnZ5414Prby465XxQrQFZ6nnm5KnXgnsAJefG4hEgMnaxTB3kNEyjdjj6A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.2.0", - "@typescript-eslint/visitor-keys": "5.2.0" + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/visitor-keys": "5.3.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -505,9 +483,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.2.0.tgz", - "integrity": "sha512-cTk6x08qqosps6sPyP2j7NxyFPlCNsJwSDasqPNjEQ8JMD5xxj2NHxcLin5AJQ8pAVwpQ8BMI3bTxR0zxmK9qQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.3.0.tgz", + "integrity": "sha512-fce5pG41/w8O6ahQEhXmMV+xuh4+GayzqEogN24EK+vECA3I6pUwKuLi5QbXO721EMitpQne5VKXofPonYlAQg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -518,13 +496,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.2.0.tgz", - "integrity": "sha512-RsdXq2XmVgKbm9nLsE3mjNUM7BTr/K4DYR9WfFVMUuozHWtH5gMpiNZmtrMG8GR385EOSQ3kC9HiEMJWimxd/g==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.3.0.tgz", + "integrity": "sha512-FJ0nqcaUOpn/6Z4Jwbtf+o0valjBLkqc3MWkMvrhA2TvzFXtcclIM8F4MBEmYa2kgcI8EZeSAzwoSrIC8JYkug==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.2.0", - "@typescript-eslint/visitor-keys": "5.2.0", + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/visitor-keys": "5.3.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -545,12 +523,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.2.0.tgz", - "integrity": "sha512-Nk7HizaXWWCUBfLA/rPNKMzXzWS8Wg9qHMuGtT+v2/YpPij4nVXrVJc24N/r5WrrmqK31jCrZxeHqIgqRzs0Xg==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.3.0.tgz", + "integrity": "sha512-oVIAfIQuq0x2TFDNLVavUn548WL+7hdhxYn+9j3YdJJXB7mH9dAmZNJsPDa7Jc+B9WGqoiex7GUDbyMxV0a/aw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/types": "5.3.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -787,9 +765,9 @@ } }, "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "dependencies": { "safer-buffer": "~2.1.0" @@ -1712,12 +1690,12 @@ } }, "node_modules/eslint": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.1.0.tgz", - "integrity": "sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.2.0.tgz", + "integrity": "sha512-erw7XmM+CLxTOickrimJ1SiF55jiNlVSp2qqm0NuBWPtHYQCegD5ZMaW0c3i5ytPqL+SSLaCxdvQXFPLJn+ABw==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.0.3", + "@eslint/eslintrc": "^1.0.4", "@humanwhocodes/config-array": "^0.6.0", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -1751,7 +1729,7 @@ "progress": "^2.0.0", "regexpp": "^3.2.0", "semver": "^7.2.1", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" @@ -1860,19 +1838,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/esquery": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", @@ -2037,9 +2002,9 @@ } }, "node_modules/fetch-blob": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.2.tgz", - "integrity": "sha512-hunJbvy/6OLjCD0uuhLdp0mMPzP/yd2ssd1t2FCJsaA7wkWhpbp9xfuNVpv7Ll4jFhzp6T4LAupSiV9uOeg0VQ==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.3.tgz", + "integrity": "sha512-ax1Y5I9w+9+JiM+wdHkhBoxew+zG4AJ2SvAD1v1szpddUIiPERVGBxrMcB2ZqW0Y3PP8bOWYv2zqQq1Jp2kqUQ==", "dev": true, "funding": [ { @@ -2124,9 +2089,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.14.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", - "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==", + "version": "1.14.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", + "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==", "funding": [ { "type": "individual", @@ -2695,9 +2660,9 @@ } }, "node_modules/ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", "dev": true, "engines": { "node": ">= 4" @@ -3906,9 +3871,9 @@ } }, "node_modules/npm-check-updates": { - "version": "11.8.5", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-11.8.5.tgz", - "integrity": "sha512-IYSHjlWe8UEugDy7X0qjBeJwcni4DlcWdBK4QQEbwgkNlEDlXyd4yQJYWFumKaJzrp/n5/EcvaboXsBD1Er/pw==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-12.0.0.tgz", + "integrity": "sha512-KkUu9W5BWE4JmNeuPEwDz5a5yBOoWSrWl4DbT1/jBm+ytpVzjO9NN2jAD0GydhHZV/Brgh4xgWtBiMZJi5dUxQ==", "dev": true, "dependencies": { "chalk": "^4.1.2", @@ -3930,21 +3895,22 @@ "pacote": "^11.3.5", "parse-github-url": "^1.0.2", "progress": "^2.0.3", - "prompts": "^2.4.1", + "prompts": "^2.4.2", "rc-config-loader": "^4.0.0", "remote-git-tags": "^3.0.0", "rimraf": "^3.0.2", "semver": "^7.3.5", "semver-utils": "^1.1.4", + "source-map-support": "^0.5.19", "spawn-please": "^1.0.0", "update-notifier": "^5.1.0" }, "bin": { - "ncu": "bin/cli.js", - "npm-check-updates": "bin/cli.js" + "ncu": "build/src/bin/cli.js", + "npm-check-updates": "build/src/bin/cli.js" }, "engines": { - "node": ">=10.17" + "node": ">=12" } }, "node_modules/npm-check-updates/node_modules/commander": { @@ -4993,12 +4959,6 @@ "node": ">=10" } }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, "node_modules/sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", @@ -5795,9 +5755,9 @@ } }, "@eslint/eslintrc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.3.tgz", - "integrity": "sha512-DHI1wDPoKCBPoLZA3qDR91+3te/wDSc1YhKg3jR8NxKKRJq2hwHwcWv31cSwSYvIBrmbENoYMWcenW8uproQqg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.4.tgz", + "integrity": "sha512-h8Vx6MdxwWI2WM8/zREHMoqdgLNXEL4QX3MWSVMdyNJGvXVOs+6lp+m2hc3FnuMHDc4poxFNI20vCk0OmI4G0Q==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -5806,35 +5766,16 @@ "globals": "^13.9.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", + "js-yaml": "^4.1.0", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" }, "dependencies": { - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } } } }, @@ -5873,9 +5814,9 @@ } }, "@humanwhocodes/object-schema": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz", - "integrity": "sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, "@leichtgewicht/ip-codec": { @@ -6081,13 +6022,13 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.2.0.tgz", - "integrity": "sha512-qQwg7sqYkBF4CIQSyRQyqsYvP+g/J0To9ZPVNJpfxfekl5RmdvQnFFTVVwpRtaUDFNvjfe/34TgY/dpc3MgNTw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.3.0.tgz", + "integrity": "sha512-ARUEJHJrq85aaiCqez7SANeahDsJTD3AEua34EoQN9pHS6S5Bq9emcIaGGySt/4X2zSi+vF5hAH52sEen7IO7g==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "5.2.0", - "@typescript-eslint/scope-manager": "5.2.0", + "@typescript-eslint/experimental-utils": "5.3.0", + "@typescript-eslint/scope-manager": "5.3.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -6097,55 +6038,55 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.2.0.tgz", - "integrity": "sha512-fWyT3Agf7n7HuZZRpvUYdFYbPk3iDCq6fgu3ulia4c7yxmPnwVBovdSOX7RL+k8u6hLbrXcdAehlWUVpGh6IEw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.3.0.tgz", + "integrity": "sha512-NFVxYTjKj69qB0FM+piah1x3G/63WB8vCBMnlnEHUsiLzXSTWb9FmFn36FD9Zb4APKBLY3xRArOGSMQkuzTF1w==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.2.0", - "@typescript-eslint/types": "5.2.0", - "@typescript-eslint/typescript-estree": "5.2.0", + "@typescript-eslint/scope-manager": "5.3.0", + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/typescript-estree": "5.3.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/parser": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.2.0.tgz", - "integrity": "sha512-Uyy4TjJBlh3NuA8/4yIQptyJb95Qz5PX//6p8n7zG0QnN4o3NF9Je3JHbVU7fxf5ncSXTmnvMtd/LDQWDk0YqA==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.3.0.tgz", + "integrity": "sha512-rKu/yAReip7ovx8UwOAszJVO5MgBquo8WjIQcp1gx4pYQCwYzag+I5nVNHO4MqyMkAo0gWt2gWUi+36gWAVKcw==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.2.0", - "@typescript-eslint/types": "5.2.0", - "@typescript-eslint/typescript-estree": "5.2.0", + "@typescript-eslint/scope-manager": "5.3.0", + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/typescript-estree": "5.3.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.2.0.tgz", - "integrity": "sha512-RW+wowZqPzQw8MUFltfKYZfKXqA2qgyi6oi/31J1zfXJRpOn6tCaZtd9b5u9ubnDG2n/EMvQLeZrsLNPpaUiFQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.3.0.tgz", + "integrity": "sha512-22Uic9oRlTsPppy5Tcwfj+QET5RWEnZ5414Prby465XxQrQFZ6nnm5KnXgnsAJefG4hEgMnaxTB3kNEyjdjj6A==", "dev": true, "requires": { - "@typescript-eslint/types": "5.2.0", - "@typescript-eslint/visitor-keys": "5.2.0" + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/visitor-keys": "5.3.0" } }, "@typescript-eslint/types": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.2.0.tgz", - "integrity": "sha512-cTk6x08qqosps6sPyP2j7NxyFPlCNsJwSDasqPNjEQ8JMD5xxj2NHxcLin5AJQ8pAVwpQ8BMI3bTxR0zxmK9qQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.3.0.tgz", + "integrity": "sha512-fce5pG41/w8O6ahQEhXmMV+xuh4+GayzqEogN24EK+vECA3I6pUwKuLi5QbXO721EMitpQne5VKXofPonYlAQg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.2.0.tgz", - "integrity": "sha512-RsdXq2XmVgKbm9nLsE3mjNUM7BTr/K4DYR9WfFVMUuozHWtH5gMpiNZmtrMG8GR385EOSQ3kC9HiEMJWimxd/g==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.3.0.tgz", + "integrity": "sha512-FJ0nqcaUOpn/6Z4Jwbtf+o0valjBLkqc3MWkMvrhA2TvzFXtcclIM8F4MBEmYa2kgcI8EZeSAzwoSrIC8JYkug==", "dev": true, "requires": { - "@typescript-eslint/types": "5.2.0", - "@typescript-eslint/visitor-keys": "5.2.0", + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/visitor-keys": "5.3.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -6154,12 +6095,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.2.0.tgz", - "integrity": "sha512-Nk7HizaXWWCUBfLA/rPNKMzXzWS8Wg9qHMuGtT+v2/YpPij4nVXrVJc24N/r5WrrmqK31jCrZxeHqIgqRzs0Xg==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.3.0.tgz", + "integrity": "sha512-oVIAfIQuq0x2TFDNLVavUn548WL+7hdhxYn+9j3YdJJXB7mH9dAmZNJsPDa7Jc+B9WGqoiex7GUDbyMxV0a/aw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/types": "5.3.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -6343,9 +6284,9 @@ "dev": true }, "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "requires": { "safer-buffer": "~2.1.0" @@ -7084,12 +7025,12 @@ "dev": true }, "eslint": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.1.0.tgz", - "integrity": "sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.2.0.tgz", + "integrity": "sha512-erw7XmM+CLxTOickrimJ1SiF55jiNlVSp2qqm0NuBWPtHYQCegD5ZMaW0c3i5ytPqL+SSLaCxdvQXFPLJn+ABw==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.0.3", + "@eslint/eslintrc": "^1.0.4", "@humanwhocodes/config-array": "^0.6.0", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -7123,7 +7064,7 @@ "progress": "^2.0.0", "regexpp": "^3.2.0", "semver": "^7.2.1", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" @@ -7197,12 +7138,6 @@ "eslint-visitor-keys": "^3.0.0" } }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, "esquery": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", @@ -7342,9 +7277,9 @@ } }, "fetch-blob": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.2.tgz", - "integrity": "sha512-hunJbvy/6OLjCD0uuhLdp0mMPzP/yd2ssd1t2FCJsaA7wkWhpbp9xfuNVpv7Ll4jFhzp6T4LAupSiV9uOeg0VQ==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.3.tgz", + "integrity": "sha512-ax1Y5I9w+9+JiM+wdHkhBoxew+zG4AJ2SvAD1v1szpddUIiPERVGBxrMcB2ZqW0Y3PP8bOWYv2zqQq1Jp2kqUQ==", "dev": true, "requires": { "web-streams-polyfill": "^3.0.3" @@ -7401,9 +7336,9 @@ "dev": true }, "follow-redirects": { - "version": "1.14.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", - "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==" + "version": "1.14.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", + "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==" }, "foreach": { "version": "2.0.5", @@ -7821,9 +7756,9 @@ } }, "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", "dev": true }, "ignore-by-default": { @@ -8737,9 +8672,9 @@ } }, "npm-check-updates": { - "version": "11.8.5", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-11.8.5.tgz", - "integrity": "sha512-IYSHjlWe8UEugDy7X0qjBeJwcni4DlcWdBK4QQEbwgkNlEDlXyd4yQJYWFumKaJzrp/n5/EcvaboXsBD1Er/pw==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-12.0.0.tgz", + "integrity": "sha512-KkUu9W5BWE4JmNeuPEwDz5a5yBOoWSrWl4DbT1/jBm+ytpVzjO9NN2jAD0GydhHZV/Brgh4xgWtBiMZJi5dUxQ==", "dev": true, "requires": { "chalk": "^4.1.2", @@ -8761,12 +8696,13 @@ "pacote": "^11.3.5", "parse-github-url": "^1.0.2", "progress": "^2.0.3", - "prompts": "^2.4.1", + "prompts": "^2.4.2", "rc-config-loader": "^4.0.0", "remote-git-tags": "^3.0.0", "rimraf": "^3.0.2", "semver": "^7.3.5", "semver-utils": "^1.1.4", + "source-map-support": "^0.5.19", "spawn-please": "^1.0.0", "update-notifier": "^5.1.0" }, @@ -9558,12 +9494,6 @@ "integrity": "sha512-Kz33ip6NRNKuyTRo3aDWyWxeGeM0ORDO552Fs6E1nj4pLWPkl37SrRtTnq+MEopVaqgmaO6bAvVS+v64BJ5M/A==", "dev": true }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, "sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", diff --git a/package.json b/package.json index e1e21a3..949b8ee 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "displayName": "Homebridge Rainbird", "name": "homebridge-rainbird", - "version": "1.4.0", + "version": "1.5.0", "description": "The [Homebridge](https://homebridge.io) Rainbird plugin allows you to access your [Rainbird](https://rainbird.com) device(s) from HomeKit.", "author": "donavanbecker", "license": "Apache-2.0", @@ -55,15 +55,15 @@ "@types/better-queue": "^3.8.3", "@types/node": "^16.11.6", "@types/node-fetch": "^3.0.3", - "@typescript-eslint/eslint-plugin": "^5.2.0", - "@typescript-eslint/parser": "^5.2.0", - "eslint": "^8.1.0", + "@typescript-eslint/eslint-plugin": "^5.3.0", + "@typescript-eslint/parser": "^5.3.0", + "eslint": "^8.2.0", "homebridge": "^1.3.5", "nodemon": "^2.0.14", "rimraf": "^3.0.2", "ts-node": "^10.4.0", "typescript": "^4.4.4", "typescript-axios-wb": "^1.0.3", - "npm-check-updates": "^11.8.5" + "npm-check-updates": "^12.0.0" } } diff --git a/src/RainBird/RainBirdClient.ts b/src/RainBird/RainBirdClient.ts index 36b365b..3a79af8 100644 --- a/src/RainBird/RainBirdClient.ts +++ b/src/RainBird/RainBirdClient.ts @@ -44,7 +44,8 @@ export class RainBirdClient { constructor( private readonly address: string, private readonly password: string, - private readonly log: Logger) { + private readonly log: Logger, + private readonly logCommands: boolean) { } public async getModelAndVersion(): Promise { @@ -130,7 +131,7 @@ export class RainBirdClient { } private async sendRequest(request: Request, retry = true): Promise { - this.log.debug(`Request: ${request}`); + this.logCommand(`Request: ${request}`); // eslint-disable-next-line no-constant-condition while (true) { @@ -217,7 +218,7 @@ export class RainBirdClient { break; } - this.log.debug(`Response: ${response ?? 'Unknown'}`); + this.logCommand(`Response: ${response ?? 'Unknown'}`); return response; } @@ -289,4 +290,12 @@ export class RainBirdClient { }, sec * 1000); }); } + + logCommand(...log: any[]) { + if (this.logCommands) { + this.log.warn('[COMMAND]', String(...log)); + } else { + this.log.debug(String(...log)); + } + } } \ No newline at end of file diff --git a/src/RainBird/RainBirdService.ts b/src/RainBird/RainBirdService.ts index 572721a..58bab91 100644 --- a/src/RainBird/RainBirdService.ts +++ b/src/RainBird/RainBirdService.ts @@ -57,12 +57,12 @@ export class RainBirdService extends events.EventEmitter { address: string, password: string, refreshRate?: number, - log: Logger + log: Logger, + logCommands: boolean, }) { - super(); this.log = options.log; - this._client = new RainBirdClient(options.address, options.password, options.log); + this._client = new RainBirdClient(options.address, options.password, options.log, options.logCommands); this._statusRefreshSubject .pipe( @@ -197,6 +197,10 @@ export class RainBirdService extends events.EventEmitter { } } + enableZone(zone: number, enabled: boolean): void { + this.emit('zone_enable', zone, enabled); + } + private async startZone(zone: number, duration: number): Promise { this.log.debug(`Zone ${zone}: Start for ${duration} seconds`); diff --git a/src/devices/IrrigationSystem.ts b/src/devices/IrrigationSystem.ts index 1a16d58..cc700ef 100644 --- a/src/devices/IrrigationSystem.ts +++ b/src/devices/IrrigationSystem.ts @@ -337,6 +337,7 @@ export class IrrigationSystem { this.platform.device(`Irrigation System ${this.accessory.displayName}, Valve: ${zone}, Set IsConfigured: ${value}`); this.valves.get(zone)!.IsConfigured = value; this.accessory.context.configured[zone] = value; + this.rainbird!.enableZone(zone, value === this.platform.Characteristic.IsConfigured.CONFIGURED); } private setValveSetDuration(zone: number, value: CharacteristicValue) { diff --git a/src/platform.ts b/src/platform.ts index a530e22..c8eb935 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -126,6 +126,7 @@ export class RainbirdPlatform implements DynamicPlatformPlugin { password: device.password!, refreshRate: this.config.options!.refreshRate, log: this.log, + logCommands: this.config.options?.debug === 'command', }); const metaData = await rainbird!.init(); this.debug(JSON.stringify(metaData)); @@ -133,15 +134,33 @@ export class RainbirdPlatform implements DynamicPlatformPlugin { // Display device details this.log.info(`Model: ${metaData.model}, [Version: ${metaData.version}, Serial Number: ${metaData.serialNumber},` + ` Zones: ${JSON.stringify(metaData.zones)}]`); - this.createIrrigationSystem(device, rainbird); + const irrigationAccessory = this.createIrrigationSystem(device, rainbird); this.createLeakSensor(device, rainbird); for(const zoneId of metaData.zones) { - this.createContactSensor(device, rainbird, zoneId); + const configured = irrigationAccessory!.context.configured[zoneId] ?? this.Characteristic.IsConfigured.CONFIGURED; + if (configured === this.Characteristic.IsConfigured.CONFIGURED) { + this.createContactSensor(device, rainbird, zoneId); + } } + + // Handle zone enable/disable + rainbird.on('zone_enable', (zoneId, enabled) => { + if (enabled) { + this.createContactSensor(device, rainbird, zoneId); + } else { + const model = `${rainbird!.model}-${zoneId}`; + const uuid = this.api.hap.uuid.generate(`${device.ipaddress}-${model}-${rainbird!.serialNumber}`); + const index = this.accessories.findIndex((accessory) => accessory.UUID === uuid); + if (index >= 0) { + this.unregisterPlatformAccessories(this.accessories[index]); + this.accessories.splice(index, 1); + } + } + }); } } - private createIrrigationSystem(device: DevicesConfig, rainbird: RainBirdService): void { + private createIrrigationSystem(device: DevicesConfig, rainbird: RainBirdService): PlatformAccessory | undefined { const uuid = this.api.hap.uuid.generate(`${device.ipaddress}-${rainbird!.model}-${rainbird!.serialNumber}`); // see if an accessory with the same uuid has already been registered and restored from // the cached devices we stored in the `configureAccessory` method above @@ -163,6 +182,7 @@ export class RainbirdPlatform implements DynamicPlatformPlugin { // this is imported from `platformAccessory.ts` new IrrigationSystem(this, existingAccessory, device, rainbird); this.device(`Irrigation System uuid: ${device.ipaddress}-${rainbird!.model}-${rainbird!.serialNumber}, (${existingAccessory.UUID})`); + return existingAccessory; } else { this.unregisterPlatformAccessories(existingAccessory); } @@ -187,6 +207,7 @@ export class RainbirdPlatform implements DynamicPlatformPlugin { // link the accessory to your platform this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]); this.accessories.push(accessory); + return accessory; } else { if (this.config.options?.debug === 'debug') { this.log.error(`Unable to Register new device: ${rainbird!.model}`); @@ -318,7 +339,7 @@ export class RainbirdPlatform implements DynamicPlatformPlugin { * this.debugMode = process.argv.includes('-D') || process.argv.includes('--debug'); */ debug(...log: any[]) { - if (this.config.options!.debug === 'debug') { + if (this.config.options?.debug === 'debug') { this.log.info('[DEBUG]', String(...log)); } else { this.log.debug(String(...log)); @@ -330,7 +351,7 @@ export class RainbirdPlatform implements DynamicPlatformPlugin { * Otherwise send debug logs to log.debug */ device(...log: any[]) { - if (this.config.options!.debug === 'device') { + if (this.config.options?.debug === 'device') { this.log.warn('[DEVICE]', String(...log)); } else { this.log.debug(String(...log));