diff --git a/.eslintrc b/.eslintrc index bff07489..78428c3e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -9,9 +9,15 @@ "ecmaVersion": 2021, "sourceType": "module" }, - "ignorePatterns": ["dist", "server"], + "ignorePatterns": [ + "dist", + "server" + ], "rules": { - "quotes": ["warn", "single"], + "quotes": [ + "warn", + "single" + ], "indent": [ "warn", 2, @@ -19,25 +25,52 @@ "SwitchCase": 1 } ], - "linebreak-style": ["warn", "unix"], - "semi": ["warn", "always"], - "comma-dangle": ["warn", "always-multiline"], + "linebreak-style": [ + "warn", + "unix" + ], + "semi": [ + "warn", + "always" + ], + "comma-dangle": [ + "warn", + "always-multiline" + ], "dot-notation": "off", "eqeqeq": "warn", - "curly": ["warn", "all"], - "brace-style": ["warn"], - "prefer-arrow-callback": ["warn"], - "max-len": ["warn", 150], - "no-console": ["warn"], // use the provided Homebridge log method instead - "no-non-null-assertion": ["off"], - "comma-spacing": ["error"], + "curly": [ + "warn", + "all" + ], + "brace-style": [ + "warn" + ], + "prefer-arrow-callback": [ + "warn" + ], + "max-len": [ + "warn", + 150 + ], + "no-console": [ + "warn" + ], // use the provided Homebridge log method instead + "no-non-null-assertion": [ + "off" + ], + "comma-spacing": [ + "error" + ], "no-multi-spaces": [ "warn", { "ignoreEOLComments": true } ], - "no-trailing-spaces": ["warn"], + "no-trailing-spaces": [ + "warn" + ], "lines-between-class-members": [ "warn", "always", @@ -50,4 +83,4 @@ "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-explicit-any": "off" } -} +} \ No newline at end of file diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 39f15e5a..00000000 --- a/.prettierrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "semi": true, - "singleQuote": true, - "bracketSameLine": true, - "printWidth": 150, - "tabWidth": 2, - "trailingComma": "all", - "useTabs": false -} diff --git a/.vscode/settings.json b/.vscode/settings.json index cfce933b..ebbc997a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,6 +22,12 @@ } ], "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "vscode.json-language-features" + }, + "[markdown]": { + "editor.defaultFormatter": "DavidAnson.vscode-markdownlint" + }, + "[jsonc]": { + "editor.defaultFormatter": "vscode.json-language-features" } } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c1f73490..601bf477 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/) +## [Version 2.9.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.9.1) (2023-10-14) + +## What's Changed + +- Fix issue with `FirmwareRevision` causing Homebridge Crash. Fixes [#839](https://github.com/OpenWonderLabs/homebridge-switchbot/discussions/839), [#832](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/832), [#829](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/829), & [#828](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/828) +- Housekeeping and updated dependencies. + +**Full Changelog**: + ## [Version 2.9.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.9.0) (2023-09-16) ## What's Changed @@ -9,7 +18,7 @@ All notable changes to this project will be documented in this file. This projec - Add other `deviceTypes` for IR Type `Other`. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.8.2....v2.9.0 +**Full Changelog**: ## [Version 2.8.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.8.2) (2023-08-27) @@ -19,7 +28,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed config issue where Eve History was not showing for WoIOSensor. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.8.1....v2.8.2 +**Full Changelog**: ## [Version 2.8.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.8.1) (2023-08-22) @@ -28,7 +37,7 @@ All notable changes to this project will be documented in this file. This projec - Added additional logging to catch statusCodes like 190 (Requests reached the daily limit). - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.8.0....v2.8.1 +**Full Changelog**: ## [Version 2.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.8.0) (2023-08-19) @@ -40,7 +49,7 @@ All notable changes to this project will be documented in this file. This projec - Enable Battery Level and Version for OpenAPI for BlindTilt, Bot, Ceiling Lights, Color Bulb, Contact, Curtain, Hub, Humidifier, Indoor/Outdoor Sensor, Light Strip, Lock, Meter, Meter Plus, Motion , Plug, Plug Mini, & Robot Vacuum Cleaner - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.7.1....v2.8.0 +**Full Changelog**: ## [Version 2.7.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.7.1) (2023-07-29) @@ -50,7 +59,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed TargetTemperature not being updated in the HomeKit, Thanks [@mrlt8](https://github.com/mrlt8) [#7779](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/779) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.7.0....v2.7.1 +**Full Changelog**: ## [Version 2.7.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.7.0) (2023-07-25) @@ -61,7 +70,7 @@ All notable changes to this project will be documented in this file. This projec - Adds the ability to enable EVE history SwitchBot Curtains, Thanks [@banboobee](https://github.com/banboobee) [#766](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/766) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.6.2....v2.7.0 +**Full Changelog**: ## [Version 2.6.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.6.2) (2023-04-17) @@ -70,7 +79,7 @@ All notable changes to this project will be documented in this file. This projec - Fix for Commands not being sent, [#721](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/721) - Housekeeping. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.6.1....v2.6.2 +**Full Changelog**: ## [Version 2.6.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.6.1) (2023-04-15) @@ -78,7 +87,7 @@ All notable changes to this project will be documented in this file. This projec - Add Support for [SwitchBot Meter Plus (JP)](https://www.switchbot.jp/products/switchbot-meter-plus), Thanks [@tikuwas](https://github.com/tikuwas) [#642](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/642) -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.6.0....v2.6.1 +**Full Changelog**: ## [Version 2.6.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.6.0) (2023-04-15) @@ -87,7 +96,7 @@ All notable changes to this project will be documented in this file. This projec - Add Support for [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Humidity and Temperature Sensor, Thanks [@alvie](https://github.com/alvie). [#716](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/716) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.5.3....v2.6.0 +**Full Changelog**: ## [Version 2.5.3](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.5.3) (2023-04-08) @@ -101,7 +110,7 @@ All notable changes to this project will be documented in this file. This projec - Housekeeping and updated dependencies. - This release will end support for Node v14. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.5.2....v2.5.3 +**Full Changelog**: ## [Version 2.5.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.5.2) (2023-02-10) @@ -112,10 +121,10 @@ All notable changes to this project will be documented in this file. This projec - Removes runStatus check, fixes some logic, Thanks [@AndreasVerhoeven](https://github.com/AndreasVerhoeven). [#672](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/672) - Remove unneeded async, Thanks [@dnicolson](https://github.com/dnicolson). [#675](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/675) - Replace switchbot wait with utility function, Thanks [@dnicolson](https://github.com/dnicolson). [#674](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/674) -- Remove incorrect warning message, Thanks [@dnicolson](https://github.com/dnicolson). [#673](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/673) +- Remove incorrect warning message, Thanks [@dnicolson](https://github.com/dnicolson). [#673](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/673) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.5.1....v2.5.2 +**Full Changelog**: ## [Version 2.5.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.5.1) (2023-01-28) @@ -123,7 +132,7 @@ All notable changes to this project will be documented in this file. This projec - Fix Blind Tilt Config. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.5.0....v2.5.1 +**Full Changelog**: ## [Version 2.5.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.5.0) (2023-01-28) @@ -135,7 +144,7 @@ All notable changes to this project will be documented in this file. This projec - Enhancements to BLE functionality. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.4.0....v2.5.0 +**Full Changelog**: ## [Version 2.4.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.4.0) (2022-12-27) @@ -148,7 +157,7 @@ All notable changes to this project will be documented in this file. This projec - **If you had this set for your `Bot` you will have to update this config.** - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.3.2....v2.4.0 +**Full Changelog**: ## [Version 2.3.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.3.2) (2022-12-16) @@ -156,7 +165,7 @@ All notable changes to this project will be documented in this file. This projec - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.3.1....v2.3.2 +**Full Changelog**: ## [Version 2.3.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.3.1) (2022-12-11) @@ -165,7 +174,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed TypeError: Cannot read properties of undefined (reading 'setCharacteristic'). [#610](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/610) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.3.0....v2.3.1 +**Full Changelog**: ## [Version 2.3.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.3.0) (2022-12-08) @@ -177,7 +186,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed issue where Meter did not parsing temperature. [#571](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/571) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.2.2....v2.3.0 +**Full Changelog**: ## [Version 2.2.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.2.2) (2022-10-22) @@ -190,7 +199,7 @@ All notable changes to this project will be documented in this file. This projec - Fix for node-switchbot showing not installed. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.2.1....v2.2.2 +**Full Changelog**: ## [Version 2.2.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.2.1) (2022-10-18) @@ -198,7 +207,7 @@ All notable changes to this project will be documented in this file. This projec - Fix for node-switchbot showing not installed. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.2.0...v2.2.1 +**Full Changelog**: ## [Version 2.2.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.2.0) (2022-10-18) @@ -209,7 +218,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed Issue where IR TVs would not default to External Device. [#520](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/518) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.1.2...v2.2.0 +**Full Changelog**: ## [Version 2.1.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.1.2) (2022-10-14) @@ -218,7 +227,7 @@ All notable changes to this project will be documented in this file. This projec - Fix issue with IR Devices not having a default `ConnectionType`. [#527](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/527) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.1.1...v2.1.2 +**Full Changelog**: ## [Version 2.1.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.1.1) (2022-10-14) @@ -230,7 +239,7 @@ All notable changes to this project will be documented in this file. This projec - Fix issue with IR Devices not having a default `ConnectionType`. [#527](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/527) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.1.0...v2.1.1 +**Full Changelog**: ## [Version 2.1.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.1.0) (2022-10-13) @@ -246,7 +255,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed issue were Plugin was waiting 15 seconds before sending command to SwitchBot API. [#509](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/509) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.0.0...v2.1.0 +**Full Changelog**: ## [Version 2.0.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.0.0) (2022-10-12) @@ -262,10 +271,10 @@ All notable changes to this project will be documented in this file. This projec - `Disable` will disable all connections. This will also allow you to disable commands and refreshes for a specific device but leave it in HomeKit. - Added Support for Ceiling Light & Ceiling Light Pro - Fixes Smart Lock Issues fixed in v1.1 of OpenAPI. [#462](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/462) -= Fixes excesive logging from node-switchbot. [#435](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/435), [#444](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/444), [#446](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/446) += Fixes excesive logging from node-switchbot. [#435](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/435), [#444](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/444), [#446](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/446) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.15.0...v2.0.0 +**Full Changelog**: ## [Version 1.15.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.15.0) (2022-08-27) @@ -274,7 +283,7 @@ All notable changes to this project will be documented in this file. This projec - Added BLE support for PlugMini (US) & PlugMini (JP) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.14.2...v1.15.0 +**Full Changelog**: ## [Version 1.14.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.14.2) (2022-08-20) @@ -282,7 +291,7 @@ All notable changes to this project will be documented in this file. This projec - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.14.1...v1.14.2 +**Full Changelog**: ## [Version 1.14.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.14.1) (2022-06-28) @@ -291,7 +300,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed some logging. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.14.0...v1.14.1 +**Full Changelog**: ## [Version 1.14.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.14.0) (2022-06-25) @@ -300,7 +309,7 @@ All notable changes to this project will be documented in this file. This projec - Added support for Smart Lock commands over OpenAPI. Thanks [tom-todd](https://github.com/tom-todd) [#382](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/337) & [#387](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/337) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.13.0...v1.14.0 +**Full Changelog**: ## [Version 1.13.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.13.0) (2022-05-04) @@ -314,7 +323,7 @@ All notable changes to this project will be documented in this file. This projec - Still unable to control Locks because of API limitations. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.8...v1.13.0 +**Full Changelog**: ## [Version 1.12.8](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.12.8) (2022-03-19) @@ -322,7 +331,7 @@ All notable changes to this project will be documented in this file. This projec - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.7...v1.12.8 +**Full Changelog**: ## [Version 1.12.7](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.12.7) (2022-03-07) @@ -334,7 +343,7 @@ All notable changes to this project will be documented in this file. This projec - Seperated Meter and Meter Plus for BLE purposes. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.6...v1.12.7 +**Full Changelog**: ## [Version 1.12.6](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.12.6) (2022-03-04) @@ -343,7 +352,7 @@ All notable changes to this project will be documented in this file. This projec - Fix for Curtain v3.3 and above, from v1.2.0 node-switchbot update. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.5...v1.12.6 +**Full Changelog**: ## [Version 1.12.5](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.12.5) (2022-02-15) @@ -351,7 +360,7 @@ All notable changes to this project will be documented in this file. This projec - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.4...v1.12.5 +**Full Changelog**: ## [Version 1.12.4](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.12.4) (2022-02-12) @@ -360,7 +369,7 @@ All notable changes to this project will be documented in this file. This projec - Fix support for Meter Plus - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.3...v1.12.4 +**Full Changelog**: ## [Version 1.12.3](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.12.3) (2022-02-05) @@ -368,7 +377,7 @@ All notable changes to this project will be documented in this file. This projec - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.2...v1.12.3 +**Full Changelog**: ## [Version 1.12.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.12.2) (2022-02-02) @@ -376,7 +385,7 @@ All notable changes to this project will be documented in this file. This projec - Fix: Issue where `PositionState` was not being sent back to Home App. Fixes [#123](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/123) Thanks [@dnicolson](https://github.com/dnicolson)! -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.1...v1.12.2 +**Full Changelog**: ## [Version 1.12.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.12.1) (2022-02-01) @@ -384,7 +393,7 @@ All notable changes to this project will be documented in this file. This projec - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.0...v1.12.1 +**Full Changelog**: ## [Version 1.12.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.12.0) (2022-01-29) @@ -392,7 +401,7 @@ All notable changes to this project will be documented in this file. This projec - Add option `maxRetry` for bots so you can set the number of retries for sending on or off for Bot. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.11.2...v1.12.0 +**Full Changelog**: ## [Version 1.11.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.11.2) (2022-01-29) @@ -400,7 +409,7 @@ All notable changes to this project will be documented in this file. This projec - Fix: Use `updateRate` instead of `refreshRate` when overriding `scanDuration`. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.11.1...v1.11.2 +**Full Changelog**: ## [Version 1.11.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.11.1) (2022-01-29) @@ -411,7 +420,7 @@ All notable changes to this project will be documented in this file. This projec - Fix: `This plugin generated a warning from the characteristic 'Hue': characteristic value expected valid finite number and received "undefined" (undefined)`. - Fix: `This plugin generated a warning from the characteristic 'Saturation': characteristic value expected valid finite number and received "undefined" (undefined)`. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.11.0...v1.11.1 +**Full Changelog**: ## [Version 1.11.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.11.0) (2022-01-29) @@ -426,7 +435,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed: Curtain `set_min` and `set_max` options not work correctly with minimum and maximum curtain state. [#123](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/123) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.10.1...v1.11.0 +**Full Changelog**: ## [Version 1.10.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.10.1) (2022-01-26) @@ -435,7 +444,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed: Option `pushOn` was not push `On` commands. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.10.0...v1.10.1 +**Full Changelog**: ## [Version 1.10.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.10.0) (2022-01-21) @@ -444,7 +453,7 @@ All notable changes to this project will be documented in this file. This projec - Add option `pushOn`, this will allow the `On` commands to be sent along side `Status` change commands. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.9.0...v1.10.0 +**Full Changelog**: ## [Version 1.9.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.9.0) (2022-01-20) @@ -453,7 +462,7 @@ All notable changes to this project will be documented in this file. This projec - Add option `allowPush`, this will allow commands to be sent even if device state is already in state that is being pushed. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.8.2...v1.9.0 +**Full Changelog**: ## [Version 1.8.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.8.2) (2022-01-15) @@ -461,7 +470,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed Bug: Only log config if it is set. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.8.1...v1.8.2 +**Full Changelog**: ## [Version 1.8.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.8.1) (2022-01-15) @@ -469,7 +478,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed Bug: Cannot set properties of undefined (setting 'logging') -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.8.0...v1.8.1 +**Full Changelog**: ## [Version 1.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.8.0) (2022-01-14) @@ -489,7 +498,7 @@ All notable changes to this project will be documented in this file. This projec - You will have to update your config for it to pickup the new `updateRate`. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.7.0...v1.8.0 +**Full Changelog**: ## [Version 1.7.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.7.0) (2022-01-05) @@ -503,7 +512,7 @@ All notable changes to this project will be documented in this file. This projec - Added option to display Bot a WindowCovering. - Added option to display Bot a Garage Door Opener. [#179](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/179) -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.6.3...v1.7.0 +**Full Changelog**: ## [Version 1.6.3](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.6.3) (2022-01-03) @@ -511,7 +520,7 @@ All notable changes to this project will be documented in this file. This projec - Quick Fix for for issue not tested in `v1.6.2`. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.6.2...v1.6.3 +**Full Changelog**: ## [Version 1.6.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.6.2) (2022-01-03) @@ -522,7 +531,7 @@ All notable changes to this project will be documented in this file. This projec - So If `node-switchbot` doesn't get installed successfully then BLE will not work. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.6.1...v1.6.2 +**Full Changelog**: ## [Version 1.6.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.6.1) (2022-01-02) @@ -535,7 +544,7 @@ All notable changes to this project will be documented in this file. This projec - So If `node-switchbot` doesn't get installed successfully then BLE will not work. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.6.0...v1.6.1 +**Full Changelog**: ## [Version 1.6.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.6.0) (2021-12-31) @@ -548,13 +557,13 @@ All notable changes to this project will be documented in this file. This projec - Fixed Bug: Bot Status not working Correction with Switch and Press. [#105](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/105), [#130](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/130), [#132](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/132), [#165](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/165), [#174](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/174) - Fixed some issues with the New Logging Options release with v1.5.0, now logging when configured. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.5.0...v1.6.0 +**Full Changelog**: ## [Version 1.5.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.5.0) (2021-12-27) ## What's Changed -### Major Change To `Logging`: +### Major Change To `Logging` - Added the following Logging Options: - `Standard` @@ -563,7 +572,7 @@ All notable changes to this project will be documented in this file. This projec - Removed Device Logging Option, which was pushed into new logging under debug. - Added Device Logging Override for each Device, by using the Device Config. -### Major Changes to `refreshRate`: +### Major Changes to `refreshRate` - Added an option to override `refreshRate` for each Device, by using the Device Config. @@ -572,7 +581,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed Bug: Air conditioner temperature not able to change. [#43](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/43) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.4.0...v1.5.0 +**Full Changelog**: ## [Version 1.4.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.4.0) (2021-12-15) @@ -584,7 +593,7 @@ All notable changes to this project will be documented in this file. This projec - Removed Meter Unit Config Option as it was confusing and probably never used. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.3.0...v1.4.0 +**Full Changelog**: ## [Version 1.3.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.3.0) (2021-12-02) @@ -594,7 +603,7 @@ All notable changes to this project will be documented in this file. This projec - Added Option `Adaptive Lighting Shift` to be able us this value to increase the mired for the Adaptive Lighting update, making the light appear warmer. - Fixed Bug: Color Bulb can't change color and is not dimmable. [#97](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/97) -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.5...v1.3.0 +**Full Changelog**: ## [Version 1.2.5](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.2.5) (2021-11-25) @@ -602,7 +611,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed Bug: Where `set_minLux` & `set_maxLux` config settings not effecting OpenAPI Lux. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.4...v1.2.5 +**Full Changelog**: ## [Version 1.2.4](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.2.4) (2021-11-24) @@ -610,7 +619,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed Bug: Cannot read properties of undefined (reading 'updateCharacteristic'). -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.3...v1.2.4 +**Full Changelog**: ## [Version 1.2.3](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.2.3) (2021-11-24) @@ -618,7 +627,7 @@ All notable changes to this project will be documented in this file. This projec - When BLE Connection isn't established, allow for OpenAPI to kick in if `openToken` is supplied. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.2...v1.2.3 +**Full Changelog**: ## [Version 1.2.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.2.2) (2021-11-24) @@ -627,7 +636,7 @@ All notable changes to this project will be documented in this file. This projec - Allow the `configDeviceName` to override `deviceName`. - Added Logging when BLE Connection wasn't established. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.1...v1.2.2 +**Full Changelog**: ## [Version 1.2.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.2.1) (2021-11-24) @@ -637,7 +646,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed Bug: Meter not working with BLE. [#110](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/110) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.0...v1.2.1 +**Full Changelog**: ## [Version 1.2.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.2.0) (2021-11-19) @@ -652,7 +661,7 @@ All notable changes to this project will be documented in this file. This projec - Add `Saturation` and `Hue` to Colorbulb. - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.1.0...v1.2.0 +**Full Changelog**: ## [Version 1.1.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.1.0) (2021-11-16) @@ -664,7 +673,7 @@ All notable changes to this project will be documented in this file. This projec - Add option to Hide Curtain's Light Sensor. [#91](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/91) - Add option to Hide Contact Sensor's Motion Sensor or Light Sensor. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.0.2...v1.1.0 +**Full Changelog**: ## [Version 1.0.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.0.2) (2021-11-15) @@ -673,7 +682,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed Bug: `failed to discover devices. cannot read property 'touppercase' of undefined`. [#84](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/84) - Housekeeping and updated dependencies. -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.0.1...v1.0.2 +**Full Changelog**: ## [Version 1.0.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.0.1) (2021-11-14) @@ -682,7 +691,7 @@ All notable changes to this project will be documented in this file. This projec - Fixed `Cannot read properties of undefined (reading 'updateCharacteristic')` on Bots. [#77](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/77) - Fixed Temperature not being retrieved for Switchbot Meter. [#78](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/78) -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.0.0...v1.0.1 +**Full Changelog**: ## [Version 1.0.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.0.0) (2021-11-13) @@ -694,7 +703,7 @@ All notable changes to this project will be documented in this file. This projec - Adds Motion Sensor to Contact Sensors - Adds Support Color Bulbs -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v0.1.1...v1.0.0 +**Full Changelog**: ## [Version 0.1.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v0.1.1) (2021-09-11) @@ -702,7 +711,7 @@ All notable changes to this project will be documented in this file. This projec - Fix Contact Sensor adding as Motion Sensor instead of Contact Sensor -**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v0.1.0...v0.1.1 +**Full Changelog**: ## [Version 0.1.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v0.1.0) (2021-09-10) diff --git a/SECURITY.md b/SECURITY.md index 2959ba83..42053b73 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -7,8 +7,8 @@ currently being supported with security updates. | Version | Supported | | ------- | ------------------ | -| 1.9.x | :white_check_mark: | -| < 1.8.2 | :x: | +| 2.9.1 | :white_check_mark: | +| < 2.9.0 | :x: | ## Reporting a Vulnerability diff --git a/config.schema.json b/config.schema.json index 2fb8e257..7e483ea4 100644 --- a/config.schema.json +++ b/config.schema.json @@ -36,7 +36,11 @@ "default": "Keep your Token & Secret a secret!" } }, - "required": ["token", "secret", "notice"] + "required": [ + "token", + "secret", + "notice" + ] }, "options": { "type": "object", @@ -74,92 +78,135 @@ "oneOf": [ { "title": "Bot", - "enum": ["Bot"] + "enum": [ + "Bot" + ] }, { "title": "Curtain", - "enum": ["Curtain"] + "enum": [ + "Curtain" + ] }, { "title": "Blind Tilt", - "enum": ["Blind Tilt"] + "enum": [ + "Blind Tilt" + ] }, { "title": "Plug", - "enum": ["Plug"] + "enum": [ + "Plug" + ] }, { "title": "Meter", - "enum": ["Meter"] + "enum": [ + "Meter" + ] }, { "title": "Motion Sensor", - "enum": ["Motion Sensor"] + "enum": [ + "Motion Sensor" + ] }, - { "title": "Hub 2", - "enum": ["Hub 2"] + "enum": [ + "Hub 2" + ] }, { "title": "Contact Sensor", - "enum": ["Contact Sensor"] + "enum": [ + "Contact Sensor" + ] }, { "title": "Color Bulb", - "enum": ["Color Bulb"] + "enum": [ + "Color Bulb" + ] }, { "title": "Ceiling Light", - "enum": ["Ceiling Light"] + "enum": [ + "Ceiling Light" + ] }, { "title": "Ceiling Light Pro", - "enum": ["Ceiling Light Pro"] + "enum": [ + "Ceiling Light Pro" + ] }, { "title": "Humidifier", - "enum": ["Humidifier"] + "enum": [ + "Humidifier" + ] }, { "title": "Smart Fan", - "enum": ["Smart Fan"] + "enum": [ + "Smart Fan" + ] }, { "title": "Smart Lock", - "enum": ["Smart Lock"] + "enum": [ + "Smart Lock" + ] }, { "title": "Strip Light", - "enum": ["Strip Light"] + "enum": [ + "Strip Light" + ] }, { "title": "Meter Plus (US)", - "enum": ["MeterPlus"] + "enum": [ + "MeterPlus" + ] }, { "title": "Meter Plus (JP)", - "enum": ["Meter Plus (JP)"] + "enum": [ + "Meter Plus (JP)" + ] }, { "title": "Indoor/Outdoor Sensor", - "enum": ["WoIOSensor"] + "enum": [ + "WoIOSensor" + ] }, { "title": "Plug Mini (US)", - "enum": ["Plug Mini (US)"] + "enum": [ + "Plug Mini (US)" + ] }, { "title": "Plug Mini (JP)", - "enum": ["Plug Mini (JP)"] + "enum": [ + "Plug Mini (JP)" + ] }, { "title": "Robot Vacuum Cleaner S1", - "enum": ["Robot Vacuum Cleaner S1"] + "enum": [ + "Robot Vacuum Cleaner S1" + ] }, { "title": "Robot Vacuum Cleaner S1 Plus", - "enum": ["Robot Vacuum Cleaner S1 Plus"] + "enum": [ + "Robot Vacuum Cleaner S1 Plus" + ] } ], "condition": { @@ -172,19 +219,27 @@ "oneOf": [ { "title": "BLE/OpenAPI", - "enum": ["BLE/OpenAPI"] + "enum": [ + "BLE/OpenAPI" + ] }, { "title": "OpenAPI", - "enum": ["OpenAPI"] + "enum": [ + "OpenAPI" + ] }, { "title": "BLE", - "enum": ["BLE"] + "enum": [ + "BLE" + ] }, { "title": "Disable", - "enum": ["Disabled"] + "enum": [ + "Disabled" + ] } ], "description": "Bluetooth (BLE) API is only available for the following Device Types: Humidifier, Meter, MeterPlus, Curtain, Bot, Motion Sensor, Contact Sensor, Plug Mini (US), Plug Mini (JP), & Color Bulb", @@ -245,19 +300,27 @@ "oneOf": [ { "title": "Default", - "enum": [""] + "enum": [ + "" + ] }, { "title": "Press", - "enum": ["press"] + "enum": [ + "press" + ] }, { "title": "Switch", - "enum": ["switch"] + "enum": [ + "switch" + ] }, { "title": "Multi-Press", - "enum": ["multipress"] + "enum": [ + "multipress" + ] } ], "description": "Press Mode presses one time per 'On' state in the Home App/API. Switch Mode allows you to set how many presses occur when the device is set to 'On'. Multi-Press allows you to queue up multiple button presses. It creates a queue by counting each time the device is set to 'On'. It is most useful for scripting with cURL requests or other API calls. Multi-Press only works when using OpenAPI.", @@ -273,47 +336,69 @@ "oneOf": [ { "title": "Default", - "enum": [""] + "enum": [ + "" + ] }, { "title": "Outlet", - "enum": ["outlet"] + "enum": [ + "outlet" + ] }, { "title": "Garage Door", - "enum": ["garagedoor"] + "enum": [ + "garagedoor" + ] }, { "title": "Door", - "enum": ["door"] + "enum": [ + "door" + ] }, { "title": "Lock", - "enum": ["lock"] + "enum": [ + "lock" + ] }, { "title": "Faucet", - "enum": ["faucet"] + "enum": [ + "faucet" + ] }, { "title": "Fan", - "enum": ["fan"] + "enum": [ + "fan" + ] }, { "title": "Window", - "enum": ["window"] + "enum": [ + "window" + ] }, { "title": "Window Covering", - "enum": ["windowcovering"] + "enum": [ + "windowcovering" + ] }, { "title": "Stateful Programmable Switch (Only Works in 3rd Party Home Apps)", - "enum": ["stateful"] + "enum": [ + "stateful" + ] }, { "title": "Switch", - "enum": ["switch"] + "enum": [ + "switch" + ] } ], "placeholder": "outlet", @@ -440,11 +525,15 @@ "oneOf": [ { "title": "Performance Mode", - "enum": ["0"] + "enum": [ + "0" + ] }, { "title": "Silent Mode", - "enum": ["1"] + "enum": [ + "1" + ] } ], "condition": { @@ -457,11 +546,15 @@ "oneOf": [ { "title": "Performance Mode", - "enum": ["0"] + "enum": [ + "0" + ] }, { "title": "Silent Mode", - "enum": ["1"] + "enum": [ + "1" + ] } ], "condition": { @@ -502,23 +595,33 @@ "oneOf": [ { "title": "Middle to Up", - "enum": ["only_up"] + "enum": [ + "only_up" + ] }, { "title": "Middle to Down", - "enum": ["only_down"] + "enum": [ + "only_down" + ] }, { "title": "Down-to-Up", - "enum": ["down_and_up"] + "enum": [ + "down_and_up" + ] }, { "title": "Up-to-Down", - "enum": ["up_and_down"] + "enum": [ + "up_and_down" + ] }, { "title": "Tilt Direction", - "enum": ["use_tilt_for_direction"] + "enum": [ + "use_tilt_for_direction" + ] } ], "description": "Defines how the Home app sliders control the blind tilt.", @@ -774,19 +877,27 @@ "oneOf": [ { "title": "Default Logging", - "enum": [""] + "enum": [ + "" + ] }, { "title": "Standard Logging", - "enum": ["standard"] + "enum": [ + "standard" + ] }, { "title": "No Logging", - "enum": ["none"] + "enum": [ + "none" + ] }, { "title": "Debug Logging", - "enum": ["debug"] + "enum": [ + "debug" + ] } ], "condition": { @@ -794,7 +905,13 @@ } } }, - "required": ["deviceId", "configDeviceType", "configDeviceName", "connectionType", "logging"] + "required": [ + "deviceId", + "configDeviceType", + "configDeviceName", + "connectionType", + "logging" + ] }, "uniqueItems": true }, @@ -831,111 +948,165 @@ "oneOf": [ { "title": "Air Conditioner (IR)", - "enum": ["Air Conditioner"] + "enum": [ + "Air Conditioner" + ] }, { "title": "DIY Air Conditioner (IR)", - "enum": ["DIY Air Conditioner"] + "enum": [ + "DIY Air Conditioner" + ] }, { "title": "TV (IR)", - "enum": ["TV"] + "enum": [ + "TV" + ] }, { "title": "DIY TV (IR)", - "enum": ["DIY TV"] + "enum": [ + "DIY TV" + ] }, { "title": "Light (IR)", - "enum": ["Light"] + "enum": [ + "Light" + ] }, { "title": "DIY Light (IR)", - "enum": ["DIY Light"] + "enum": [ + "DIY Light" + ] }, { "title": "IPTV (IR)", - "enum": ["IPTV"] + "enum": [ + "IPTV" + ] }, { "title": "DIY IPTV (IR)", - "enum": ["DIY IPTV"] + "enum": [ + "DIY IPTV" + ] }, { "title": "Set Top Box (IR)", - "enum": ["Set Top Box"] + "enum": [ + "Set Top Box" + ] }, { "title": "DIY Set Top Box (IR)", - "enum": ["DIY Set Top Box"] + "enum": [ + "DIY Set Top Box" + ] }, { "title": "DVD (IR)", - "enum": ["DVD"] + "enum": [ + "DVD" + ] }, { "title": "DIY DVD (IR)", - "enum": ["DIY DVD"] + "enum": [ + "DIY DVD" + ] }, { "title": "Fan (IR)", - "enum": ["Fan"] + "enum": [ + "Fan" + ] }, { "title": "DIY Fan (IR)", - "enum": ["DIY Fan"] + "enum": [ + "DIY Fan" + ] }, { "title": "Projector (IR)", - "enum": ["Projector"] + "enum": [ + "Projector" + ] }, { "title": "DIY Projector (IR)", - "enum": ["DIY Projector"] + "enum": [ + "DIY Projector" + ] }, { "title": "Camera (IR)", - "enum": ["Camera"] + "enum": [ + "Camera" + ] }, { "title": "DIY Camera (IR)", - "enum": ["DIY Camera"] + "enum": [ + "DIY Camera" + ] }, { "title": "Air Purifier (IR)", - "enum": ["Air Purifier"] + "enum": [ + "Air Purifier" + ] }, { "title": "DIY Air Purifier (IR)", - "enum": ["DIY Air Purifier"] + "enum": [ + "DIY Air Purifier" + ] }, { "title": "Speaker (IR)", - "enum": ["Speaker"] + "enum": [ + "Speaker" + ] }, { "title": "DIY Speaker (IR)", - "enum": ["DIY Speaker"] + "enum": [ + "DIY Speaker" + ] }, { "title": "Water Heater (IR)", - "enum": ["Water Heater"] + "enum": [ + "Water Heater" + ] }, { "title": "DIY Water Heater (IR)", - "enum": ["DIY Water Heater"] + "enum": [ + "DIY Water Heater" + ] }, { "title": "Vacuum Cleaner (IR)", - "enum": ["Vacuum Cleaner"] + "enum": [ + "Vacuum Cleaner" + ] }, { "title": "DIY Vacuum Cleaner (IR)", - "enum": ["DIY Vacuum Cleaner"] + "enum": [ + "DIY Vacuum Cleaner" + ] }, { "title": "Others (IR)", - "enum": ["Others"] + "enum": [ + "Others" + ] } ], "condition": { @@ -948,11 +1119,15 @@ "oneOf": [ { "title": "OpenAPI", - "enum": ["OpenAPI"] + "enum": [ + "OpenAPI" + ] }, { "title": "Disable", - "enum": ["Disabled"] + "enum": [ + "Disabled" + ] } ], "description": "Enables OpenAPI, if disabled will leave device in HomeKit and commands will not be sent to OpenAPI.", @@ -1031,23 +1206,33 @@ "oneOf": [ { "title": "Meter", - "enum": ["Meter"] + "enum": [ + "Meter" + ] }, { "title": "MeterPlus", - "enum": ["MeterPlus"] + "enum": [ + "MeterPlus" + ] }, { "title": "Meter Plus (JP)", - "enum": ["Meter Plus (JP)"] + "enum": [ + "Meter Plus (JP)" + ] }, { "title": "Hub 2", - "enum": ["Hub 2"] + "enum": [ + "Hub 2" + ] }, { "title": "WoIOSensor", - "enum": ["WoIOSensor"] + "enum": [ + "WoIOSensor" + ] } ], "condition": { @@ -1117,47 +1302,69 @@ "oneOf": [ { "title": "Default", - "enum": [""] + "enum": [ + "" + ] }, { "title": "Outlet", - "enum": ["outlet"] + "enum": [ + "outlet" + ] }, { "title": "Garage Door", - "enum": ["garagedoor"] + "enum": [ + "garagedoor" + ] }, { "title": "Door", - "enum": ["door"] + "enum": [ + "door" + ] }, { "title": "Lock", - "enum": ["lock"] + "enum": [ + "lock" + ] }, { "title": "Faucet", - "enum": ["faucet"] + "enum": [ + "faucet" + ] }, { "title": "Fan", - "enum": ["fan"] + "enum": [ + "fan" + ] }, { "title": "Window", - "enum": ["window"] + "enum": [ + "window" + ] }, { "title": "Window Covering", - "enum": ["windowcovering"] + "enum": [ + "windowcovering" + ] }, { "title": "Stateful Programmable Switch (Only Works in 3rd Party Home Apps)", - "enum": ["stateful"] + "enum": [ + "stateful" + ] }, { "title": "Switch", - "enum": ["switch"] + "enum": [ + "switch" + ] } ], "condition": { @@ -1189,19 +1396,27 @@ "oneOf": [ { "title": "Default Logging", - "enum": [""] + "enum": [ + "" + ] }, { "title": "Standard Logging", - "enum": ["standard"] + "enum": [ + "standard" + ] }, { "title": "No Logging", - "enum": ["none"] + "enum": [ + "none" + ] }, { "title": "Debug Logging", - "enum": ["debug"] + "enum": [ + "debug" + ] } ], "condition": { @@ -1209,7 +1424,12 @@ } } }, - "required": ["deviceId", "configRemoteType", "connectionType", "logging"] + "required": [ + "deviceId", + "configRemoteType", + "connectionType", + "logging" + ] }, "uniqueItems": true }, @@ -1233,24 +1453,35 @@ "oneOf": [ { "title": "Default Logging", - "enum": [""] + "enum": [ + "" + ] }, { "title": "Standard Logging", - "enum": ["standard"] + "enum": [ + "standard" + ] }, { "title": "No Logging", - "enum": ["none"] + "enum": [ + "none" + ] }, { "title": "Debug Logging", - "enum": ["debug"] + "enum": [ + "debug" + ] } ] } }, - "required": ["name", "logging"] + "required": [ + "name", + "logging" + ] } } }, @@ -1260,7 +1491,10 @@ "title": "SwitchBot Account Info", "expandable": true, "expanded": false, - "items": ["credentials.token", "credentials.secret"] + "items": [ + "credentials.token", + "credentials.secret" + ] }, { "type": "fieldset", @@ -1407,4 +1641,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/nodemon.json b/nodemon.json index b46d728d..db352cec 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,5 +1,7 @@ { - "watch": ["src"], + "watch": [ + "src" + ], "ext": "ts", "ignore": [], "exec": "DEBUG= tsc && homebridge -T -D -P -I -U ~/.homebridge-dev ..", @@ -7,4 +9,4 @@ "env": { "NODE_OPTIONS": "--trace-warnings" } -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 2d4b44fd..267cb34f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@switchbot/homebridge-switchbot", - "version": "2.9.0", + "version": "2.9.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@switchbot/homebridge-switchbot", - "version": "2.9.0", + "version": "2.9.1", "funding": [ { "type": "Paypal", @@ -21,14 +21,12 @@ "dependencies": { "@homebridge/plugin-ui-utils": "^0.1.0", "async-mqtt": "^2.6.3", - "crypto-js": "^4.1.1", "fakegato-history": "^0.6.4", "homebridge-lib": "^6.6.1", "rxjs": "^7.8.1", "undici": "^5.26.3" }, "devDependencies": { - "@types/crypto-js": "^4.1.2", "@types/node": "^20.8.6", "@typescript-eslint/eslint-plugin": "^6.7.5", "@typescript-eslint/parser": "^6.7.5", @@ -45,7 +43,7 @@ }, "engines": { "homebridge": "^1.6.1", - "node": "^16.20.2 || ^18.17.1 || ^20.5.1" + "node": "^18.18.2 || ^20.8.1" }, "optionalDependencies": { "@abandonware/bluetooth-hci-socket": "^0.5.3-10", @@ -810,12 +808,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@types/crypto-js": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.1.2.tgz", - "integrity": "sha512-t33RNmTu5ufG/sorROIafiCVJMx3jz95bXUMoPAZcUD14fxMXnuTzqzXZoxpR0tNx2xpw11Dlmem9vGCsrSOfA==", - "dev": true - }, "node_modules/@types/http-cache-semantics": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.2.tgz", @@ -1884,11 +1876,6 @@ "node": ">= 8" } }, - "node_modules/crypto-js": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", - "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" - }, "node_modules/crypto-random-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-4.0.0.tgz", diff --git a/package.json b/package.json index c6c81035..d7ab5789 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "displayName": "Homebridge SwitchBot", "name": "@switchbot/homebridge-switchbot", - "version": "2.9.0", + "version": "2.9.1", "description": "The [Homebridge](https://homebridge.io) SwitchBot plugin allows you to access your [SwitchBot](https://www.switch-bot.com) device(s) from HomeKit.", "author": "SwitchBot (https://github.com/SwitchBot)", "license": "ISC", @@ -14,7 +14,7 @@ }, "engines": { "homebridge": "^1.6.1", - "node": "^16.20.2 || ^18.17.1 || ^20.5.1" + "node": "^18.18.2 || ^20.8.1" }, "main": "dist/index.js", "scripts": { @@ -57,7 +57,6 @@ "dependencies": { "@homebridge/plugin-ui-utils": "^0.1.0", "async-mqtt": "^2.6.3", - "crypto-js": "^4.1.1", "fakegato-history": "^0.6.4", "homebridge-lib": "^6.6.1", "rxjs": "^7.8.1", @@ -69,19 +68,15 @@ "node-switchbot": "^1.9.0" }, "devDependencies": { - "@types/crypto-js": "^4.1.2", "@types/node": "^20.8.6", "@typescript-eslint/eslint-plugin": "^6.7.5", "@typescript-eslint/parser": "^6.7.5", "eslint": "^8.51.0", - "eslint-config-prettier": "9.0.0", - "eslint-plugin-prettier": "5.0.1", "homebridge": "^1.6.1", "nodemon": "^3.0.1", "npm-check-updates": "^16.14.6", - "prettier": "3.0.3", "rimraf": "^5.0.5", "ts-node": "^10.9.1", "typescript": "^5.2.2" } -} +} \ No newline at end of file diff --git a/src/device/blindtilt.ts b/src/device/blindtilt.ts index 9bc562a5..eaac305a 100644 --- a/src/device/blindtilt.ts +++ b/src/device/blindtilt.ts @@ -118,9 +118,10 @@ export class BlindTilt { // get the WindowCovering service if it exists, otherwise create a new WindowCovering service // you can create multiple services for each accessory + const windowCoveringService = `${device.deviceName} ${device.deviceType}`; (this.windowCoveringService = - accessory.getService(this.platform.Service.WindowCovering) || accessory.addService(this.platform.Service.WindowCovering)), - `${device.deviceName} ${device.deviceType}`; + accessory.getService(this.platform.Service.WindowCovering) + || accessory.addService(this.platform.Service.WindowCovering)), windowCoveringService; this.windowCoveringService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.windowCoveringService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -178,8 +179,9 @@ export class BlindTilt { .onSet(this.TargetHorizontalTiltAngleSet.bind(this)); // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -438,7 +440,7 @@ export class BlindTilt { this.BatteryLevel = 100; } this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` - + ` StatusLowBattery: ${this.StatusLowBattery}`); + + ` StatusLowBattery: ${this.StatusLowBattery}`); // FirmwareRevision this.FirmwareRevision = this.OpenAPI_FirmwareRevision!; diff --git a/src/device/bot.ts b/src/device/bot.ts index 9baa576f..d9f33ed6 100644 --- a/src/device/bot.ts +++ b/src/device/bot.ts @@ -109,8 +109,9 @@ export class Bot { this.removeStatefulProgrammableSwitchService(accessory); // Add switchService - (this.switchService = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)), - `${accessory.displayName} Switch`; + const switchService = `${accessory.displayName} Switch`; + (this.switchService = accessory.getService(this.platform.Service.Switch) + || accessory.addService(this.platform.Service.Switch)), switchService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Switch`); this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -129,10 +130,10 @@ export class Bot { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.garageDoorService = - accessory.getService(this.platform.Service.GarageDoorOpener) || accessory.addService(this.platform.Service.GarageDoorOpener)), - `${accessory.displayName} Garage Door Opener`; + // Add garageDoorService + const garageDoorService = `${accessory.displayName} Garage Door Opener`; + (this.garageDoorService = accessory.getService(this.platform.Service.GarageDoorOpener) + || accessory.addService(this.platform.Service.GarageDoorOpener)), garageDoorService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Garage Door Opener`); this.garageDoorService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -152,9 +153,10 @@ export class Bot { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.doorService = accessory.getService(this.platform.Service.Door) || accessory.addService(this.platform.Service.Door)), - `${accessory.displayName} Door`; + // Add doorService + const doorService = `${accessory.displayName} Door`; + (this.doorService = accessory.getService(this.platform.Service.Door) + || accessory.addService(this.platform.Service.Door)), doorService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Door`); this.doorService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -182,9 +184,10 @@ export class Bot { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.windowService = accessory.getService(this.platform.Service.Window) || accessory.addService(this.platform.Service.Window)), - `${accessory.displayName} Window`; + // Add windowService + const windowService = `${accessory.displayName} Window`; + (this.windowService = accessory.getService(this.platform.Service.Window) + || accessory.addService(this.platform.Service.Window)), windowService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Window`); this.windowService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -212,10 +215,10 @@ export class Bot { this.removeGarageDoorService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.windowCoveringService = - accessory.getService(this.platform.Service.WindowCovering) || accessory.addService(this.platform.Service.WindowCovering)), - `${accessory.displayName} Window Covering`; + // Add windowCoveringService + const windowCoveringService = `${accessory.displayName} Window Covering`; + (this.windowCoveringService = accessory.getService(this.platform.Service.WindowCovering) + || accessory.addService(this.platform.Service.WindowCovering)), windowCoveringService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Window Covering`); this.windowCoveringService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -243,9 +246,10 @@ export class Bot { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.lockService = accessory.getService(this.platform.Service.LockMechanism) || accessory.addService(this.platform.Service.LockMechanism)), - `${accessory.displayName} Lock`; + // Add lockService + const lockService = `${accessory.displayName} Lock`; + (this.lockService = accessory.getService(this.platform.Service.LockMechanism) + || accessory.addService(this.platform.Service.LockMechanism)), lockService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Lock`); this.lockService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -264,9 +268,10 @@ export class Bot { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.faucetService = accessory.getService(this.platform.Service.Faucet) || accessory.addService(this.platform.Service.Faucet)), - `${accessory.displayName} Faucet`; + // Add faucetService + const faucetService = `${accessory.displayName} Faucet`; + (this.faucetService = accessory.getService(this.platform.Service.Faucet) + || accessory.addService(this.platform.Service.Faucet)), faucetService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Faucet`); this.faucetService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -285,9 +290,10 @@ export class Bot { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.fanService = accessory.getService(this.platform.Service.Fan) || accessory.addService(this.platform.Service.Fan)), - `${accessory.displayName} Fan`; + // Add fanService + const fanService = `${accessory.displayName} Fan`; + (this.fanService = accessory.getService(this.platform.Service.Fan) + || accessory.addService(this.platform.Service.Fan)), fanService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Fan`); this.fanService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -306,11 +312,10 @@ export class Bot { this.removeGarageDoorService(accessory); this.removeWindowCoveringService(accessory); - // Add switchService - (this.statefulProgrammableSwitchService = - accessory.getService(this.platform.Service.StatefulProgrammableSwitch) || - accessory.addService(this.platform.Service.StatefulProgrammableSwitch)), - `${accessory.displayName} Stateful Programmable Switch`; + // Add statefulProgrammableSwitchService + const statefulProgrammableSwitchService = `${accessory.displayName} Stateful Programmable Switch`; + (this.statefulProgrammableSwitchService = accessory.getService(this.platform.Service.StatefulProgrammableSwitch) || + accessory.addService(this.platform.Service.StatefulProgrammableSwitch)), statefulProgrammableSwitchService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Stateful Programmable Switch`); this.statefulProgrammableSwitchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -332,8 +337,9 @@ export class Bot { this.removeStatefulProgrammableSwitchService(accessory); // Add outletService - (this.outletService = accessory.getService(this.platform.Service.Outlet) || accessory.addService(this.platform.Service.Outlet)), - `${accessory.displayName} Outlet`; + const outletService = `${accessory.displayName} Outlet`; + (this.outletService = accessory.getService(this.platform.Service.Outlet) + || accessory.addService(this.platform.Service.Outlet)), outletService; this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Outlet`); this.outletService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -343,9 +349,10 @@ export class Bot { this.outletService.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this)); } - // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + // batteryService + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -437,7 +444,7 @@ export class Bot { this.BatteryLevel = 100; } this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` - + ` StatusLowBattery: ${this.StatusLowBattery}`); + + ` StatusLowBattery: ${this.StatusLowBattery}`); } async openAPIparseStatus(): Promise { @@ -464,7 +471,7 @@ export class Bot { this.BatteryLevel = 100; } this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` - + ` StatusLowBattery: ${this.StatusLowBattery}`); + + ` StatusLowBattery: ${this.StatusLowBattery}`); // FirmwareRevision this.FirmwareRevision = this.OpenAPI_FirmwareRevision!; diff --git a/src/device/ceilinglight.ts b/src/device/ceilinglight.ts index 3202d135..492fae9d 100644 --- a/src/device/ceilinglight.ts +++ b/src/device/ceilinglight.ts @@ -91,8 +91,9 @@ export class CeilingLight { // get the Lightbulb service if it exists, otherwise create a new Lightbulb service // you can create multiple services for each accessory - (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)), - `${accessory.displayName} ${device.deviceType}`; + const lightBulbService = `${accessory.displayName} ${device.deviceType}`; + (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) + || accessory.addService(this.platform.Service.Lightbulb)), lightBulbService; if (this.adaptiveLightingShift === -1 && this.accessory.context.adaptiveLighting) { this.accessory.removeService(this.lightBulbService); @@ -310,8 +311,8 @@ export class CeilingLight { async refreshStatus(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus enableCloudService: ${this.device.enableCloudService}`); - /*} else if (this.BLE) { - await this.BLERefreshStatus();*/ + /*} else if (this.BLE) { + await this.BLERefreshStatus();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIRefreshStatus(); } else { @@ -441,8 +442,8 @@ export class CeilingLight { async pushChanges(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`); - /*} else if (this.BLE) { - await this.BLEpushChanges();*/ + /*} else if (this.BLE) { + await this.BLEpushChanges();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIpushChanges(); } else { diff --git a/src/device/colorbulb.ts b/src/device/colorbulb.ts index 8facce0f..988d9c03 100644 --- a/src/device/colorbulb.ts +++ b/src/device/colorbulb.ts @@ -97,8 +97,9 @@ export class ColorBulb { // get the Lightbulb service if it exists, otherwise create a new Lightbulb service // you can create multiple services for each accessory - (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)), - `${accessory.displayName} ${device.deviceType}`; + const lightBulbService = `${accessory.displayName} ${device.deviceType}`; + (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) + || accessory.addService(this.platform.Service.Lightbulb)), lightBulbService; if (this.adaptiveLightingShift === -1 && this.accessory.context.adaptiveLighting) { this.accessory.removeService(this.lightBulbService); @@ -468,8 +469,8 @@ export class ColorBulb { async pushChanges(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`); - /*} else if (this.BLE) { - await this.BLEpushChanges();*/ + /*} else if (this.BLE) { + await this.BLEpushChanges();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIpushChanges(); } else { diff --git a/src/device/contact.ts b/src/device/contact.ts index 686cb7b2..f69e2012 100644 --- a/src/device/contact.ts +++ b/src/device/contact.ts @@ -87,9 +87,9 @@ export class Contact { // get the Contact service if it exists, otherwise create a new Contact service // you can create multiple services for each accessory - (this.contactSensorservice = - accessory.getService(this.platform.Service.ContactSensor) || accessory.addService(this.platform.Service.ContactSensor)), - `${accessory.displayName} Contact Sensor`; + const contactSensorservice = `${accessory.displayName} Contact Sensor`; + (this.contactSensorservice = accessory.getService(this.platform.Service.ContactSensor) + || accessory.addService(this.platform.Service.ContactSensor)), contactSensorservice; this.contactSensorservice.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.contactSensorservice.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -103,9 +103,9 @@ export class Contact { accessory.removeService(this.motionService!); } else if (!this.motionService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Motion Sensor Service`); - (this.motionService = - this.accessory.getService(this.platform.Service.MotionSensor) || this.accessory.addService(this.platform.Service.MotionSensor)), - `${accessory.displayName} Motion Sensor`; + const motionService = `${accessory.displayName} Motion Sensor`; + (this.motionService = this.accessory.getService(this.platform.Service.MotionSensor) + || this.accessory.addService(this.platform.Service.MotionSensor)), motionService; this.motionService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Motion Sensor`); this.motionService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Motion Sensor`); @@ -120,9 +120,10 @@ export class Contact { accessory.removeService(this.lightSensorService!); } else if (!this.lightSensorService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Light Sensor Service`); - (this.lightSensorService = - this.accessory.getService(this.platform.Service.LightSensor) || this.accessory.addService(this.platform.Service.LightSensor)), - `${accessory.displayName} Light Sensor`; + + const lightSensorService = `${accessory.displayName} Light Sensor`; + (this.lightSensorService = this.accessory.getService(this.platform.Service.LightSensor) + || this.accessory.addService(this.platform.Service.LightSensor)), lightSensorService; this.lightSensorService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Light Sensor`); this.lightSensorService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Light Sensor`); @@ -131,8 +132,9 @@ export class Contact { } // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/src/device/curtain.ts b/src/device/curtain.ts index 73f7f58b..e90285fe 100644 --- a/src/device/curtain.ts +++ b/src/device/curtain.ts @@ -106,9 +106,9 @@ export class Curtain { // get the WindowCovering service if it exists, otherwise create a new WindowCovering service // you can create multiple services for each accessory - (this.windowCoveringService = - accessory.getService(this.platform.Service.WindowCovering) || accessory.addService(this.platform.Service.WindowCovering)), - `${device.deviceName} ${device.deviceType}`; + const windowCoveringService = `${accessory.displayName} ${device.deviceType}`; + (this.windowCoveringService = accessory.getService(this.platform.Service.WindowCovering) + || accessory.addService(this.platform.Service.WindowCovering)), windowCoveringService; this.windowCoveringService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.windowCoveringService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -150,9 +150,9 @@ export class Curtain { accessory.removeService(this.lightSensorService!); } else if (!this.lightSensorService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Light Sensor Service`); - (this.lightSensorService = - this.accessory.getService(this.platform.Service.LightSensor) || this.accessory.addService(this.platform.Service.LightSensor)), - `${accessory.displayName} Light Sensor`; + const lightSensorService = `${accessory.displayName} Light Sensor`; + (this.lightSensorService = this.accessory.getService(this.platform.Service.LightSensor) + || this.accessory.addService(this.platform.Service.LightSensor)), lightSensorService; this.lightSensorService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Light Sensor`); if (!this.lightSensorService?.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -163,8 +163,9 @@ export class Curtain { } // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -465,7 +466,7 @@ export class Curtain { this.BatteryLevel = 100; } this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` - + ` StatusLowBattery: ${this.StatusLowBattery}`); + + ` StatusLowBattery: ${this.StatusLowBattery}`); // FirmwareRevision this.FirmwareRevision = this.OpenAPI_FirmwareRevision!; diff --git a/src/device/hub.ts b/src/device/hub.ts index f8dd7fa3..8f1cbed5 100644 --- a/src/device/hub.ts +++ b/src/device/hub.ts @@ -81,9 +81,9 @@ export class Hub { accessory.removeService(this.temperatureService!); } else if (!this.temperatureService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`); - (this.temperatureService = - this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)), - `${accessory.displayName} Temperature Sensor`; + const temperatureService = `${accessory.displayName} Temperature Sensor`; + (this.temperatureService = this.accessory.getService(this.platform.Service.TemperatureSensor) + || this.accessory.addService(this.platform.Service.TemperatureSensor)), temperatureService; this.temperatureService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`); if (!this.temperatureService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -112,9 +112,9 @@ export class Hub { accessory.removeService(this.humidityService!); } else if (!this.humidityService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Humidity Sensor Service`); - (this.humidityService = - this.accessory.getService(this.platform.Service.HumiditySensor) || this.accessory.addService(this.platform.Service.HumiditySensor)), - `${accessory.displayName} Humidity Sensor`; + const humidityService = `${accessory.displayName} Humidity Sensor`; + (this.humidityService = this.accessory.getService(this.platform.Service.HumiditySensor) + || this.accessory.addService(this.platform.Service.HumiditySensor)), humidityService; this.humidityService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`); if (!this.humidityService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -139,9 +139,9 @@ export class Hub { accessory.removeService(this.lightSensorService!); } else if (!this.lightSensorService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Light Sensor Service`); - (this.lightSensorService = - this.accessory.getService(this.platform.Service.LightSensor) || this.accessory.addService(this.platform.Service.LightSensor)), - `${accessory.displayName} Light Sensor`; + const lightSensorService = `${accessory.displayName} Light Sensor`; + (this.lightSensorService = this.accessory.getService(this.platform.Service.LightSensor) + || this.accessory.addService(this.platform.Service.LightSensor)), lightSensorService; this.lightSensorService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Light Sensor`); this.lightSensorService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Light Sensor`); diff --git a/src/device/humidifier.ts b/src/device/humidifier.ts index c4d21e17..4d9324ec 100644 --- a/src/device/humidifier.ts +++ b/src/device/humidifier.ts @@ -84,9 +84,9 @@ export class Humidifier { // get the service if it exists, otherwise create a new service // you can create multiple services for each accessory - (this.humidifierService = - accessory.getService(this.platform.Service.HumidifierDehumidifier) || accessory.addService(this.platform.Service.HumidifierDehumidifier)), - `${accessory.displayName} Humidifier`; + const humidifierService = `${accessory.displayName} Humidifier`; + (this.humidifierService = accessory.getService(this.platform.Service.HumidifierDehumidifier) + || accessory.addService(this.platform.Service.HumidifierDehumidifier)), humidifierService; this.humidifierService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.humidifierService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -131,9 +131,9 @@ export class Humidifier { accessory.removeService(this.temperatureservice!); } else if (!this.temperatureservice && !this.BLE) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`); - (this.temperatureservice = - this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)), - `${accessory.displayName} Temperature Sensor`; + const temperatureservice = `${accessory.displayName} Temperature Sensor`; + (this.temperatureservice = this.accessory.getService(this.platform.Service.TemperatureSensor) + || this.accessory.addService(this.platform.Service.TemperatureSensor)), temperatureservice; this.temperatureservice.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`); if (!this.temperatureservice.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -408,8 +408,8 @@ export class Humidifier { async pushChanges(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`); - /*} else if (this.BLE) { - await this.BLEpushChanges();*/ + /*} else if (this.BLE) { + await this.BLEpushChanges();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIpushChanges(); } else { diff --git a/src/device/iosensor.ts b/src/device/iosensor.ts index 762b1627..5c58b69e 100644 --- a/src/device/iosensor.ts +++ b/src/device/iosensor.ts @@ -98,9 +98,9 @@ export class IOSensor { accessory.removeService(this.temperatureservice!); } else if (!this.temperatureservice) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`); - (this.temperatureservice = - this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)), - `${accessory.displayName} Temperature Sensor`; + const temperatureservice = `${accessory.displayName} Temperature Sensor`; + (this.temperatureservice = this.accessory.getService(this.platform.Service.TemperatureSensor) + || this.accessory.addService(this.platform.Service.TemperatureSensor)), temperatureservice; this.temperatureservice.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`); if (!this.temperatureservice.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -129,9 +129,9 @@ export class IOSensor { accessory.removeService(this.humidityservice!); } else if (!this.humidityservice) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Humidity Sensor Service`); - (this.humidityservice = - this.accessory.getService(this.platform.Service.HumiditySensor) || this.accessory.addService(this.platform.Service.HumiditySensor)), - `${accessory.displayName} Humidity Sensor`; + const humidityservice = `${accessory.displayName} Humidity Sensor`; + (this.humidityservice = this.accessory.getService(this.platform.Service.HumiditySensor) + || this.accessory.addService(this.platform.Service.HumiditySensor)), humidityservice; this.humidityservice.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`); if (!this.humidityservice.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -150,8 +150,9 @@ export class IOSensor { } // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -248,7 +249,7 @@ export class IOSensor { this.BatteryLevel = 100; } this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` - + ` StatusLowBattery: ${this.StatusLowBattery}`); + + ` StatusLowBattery: ${this.StatusLowBattery}`); // FirmwareRevision this.FirmwareRevision = this.OpenAPI_FirmwareRevision!; diff --git a/src/device/lightstrip.ts b/src/device/lightstrip.ts index 4373253f..7c31b65e 100644 --- a/src/device/lightstrip.ts +++ b/src/device/lightstrip.ts @@ -89,8 +89,9 @@ export class StripLight { // get the Lightbulb service if it exists, otherwise create a new Lightbulb service // you can create multiple services for each accessory - (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)), - `${accessory.displayName} ${device.deviceType}`; + const lightBulbService = `${accessory.displayName} ${device.deviceType}`; + (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) + || accessory.addService(this.platform.Service.Lightbulb)), lightBulbService; if (this.adaptiveLightingShift === -1 && this.accessory.context.adaptiveLighting) { this.accessory.removeService(this.lightBulbService); @@ -406,8 +407,8 @@ export class StripLight { async pushChanges(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`); - /* }else if (this.BLE) { - await this.BLEpushChanges();*/ + /* }else if (this.BLE) { + await this.BLEpushChanges();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIpushChanges(); } else { diff --git a/src/device/lock.ts b/src/device/lock.ts index 52c2a522..547290bc 100644 --- a/src/device/lock.ts +++ b/src/device/lock.ts @@ -77,8 +77,9 @@ export class Lock { // get the LockMechanism service if it exists, otherwise create a new LockMechanism service // you can create multiple services for each accessory - (this.lockService = accessory.getService(this.platform.Service.LockMechanism) || accessory.addService(this.platform.Service.LockMechanism)), - `${device.deviceName} ${device.deviceType}`; + const lockService = `${accessory.displayName} ${device.deviceType}`; + (this.lockService = accessory.getService(this.platform.Service.LockMechanism) + || accessory.addService(this.platform.Service.LockMechanism)), lockService; this.lockService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.lockService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -98,9 +99,9 @@ export class Lock { accessory.removeService(this.contactSensorService!); } else if (!this.contactSensorService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Contact Sensor Service`); - (this.contactSensorService = - this.accessory.getService(this.platform.Service.ContactSensor) || this.accessory.addService(this.platform.Service.ContactSensor)), - `${accessory.displayName} Contact Sensor`; + const contactSensorService = `${accessory.displayName} Contact Sensor`; + (this.contactSensorService = this.accessory.getService(this.platform.Service.ContactSensor) + || this.accessory.addService(this.platform.Service.ContactSensor)), contactSensorService; this.contactSensorService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Contact Sensor`); if (!this.contactSensorService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -111,8 +112,9 @@ export class Lock { } // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -159,8 +161,8 @@ export class Lock { async parseStatus(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} parseStatus enableCloudService: ${this.device.enableCloudService}`); - /* } else if (this.BLE) { - await this.BLEparseStatus();*/ + /* } else if (this.BLE) { + await this.BLEparseStatus();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIparseStatus(); } else { @@ -367,8 +369,8 @@ export class Lock { async pushChanges(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`); - /*} else if (this.BLE) { - await this.BLEpushChanges();*/ + /*} else if (this.BLE) { + await this.BLEpushChanges();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIpushChanges(); } else { diff --git a/src/device/meter.ts b/src/device/meter.ts index 576d692d..954d4f9a 100644 --- a/src/device/meter.ts +++ b/src/device/meter.ts @@ -87,9 +87,9 @@ export class Meter { accessory.removeService(this.temperatureService!); } else if (!this.temperatureService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`); - (this.temperatureService = - this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)), - `${accessory.displayName} Temperature Sensor`; + const temperatureService = `${accessory.displayName} Temperature Sensor`; + (this.temperatureService = this.accessory.getService(this.platform.Service.TemperatureSensor) + || this.accessory.addService(this.platform.Service.TemperatureSensor)), temperatureService; this.temperatureService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`); if (!this.temperatureService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -118,9 +118,9 @@ export class Meter { accessory.removeService(this.humidityService!); } else if (!this.humidityService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Humidity Sensor Service`); - (this.humidityService = - this.accessory.getService(this.platform.Service.HumiditySensor) || this.accessory.addService(this.platform.Service.HumiditySensor)), - `${accessory.displayName} Humidity Sensor`; + const humidityService = `${accessory.displayName} Humidity Sensor`; + (this.humidityService = this.accessory.getService(this.platform.Service.HumiditySensor) + || this.accessory.addService(this.platform.Service.HumiditySensor)), humidityService; this.humidityService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`); if (!this.humidityService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -139,8 +139,9 @@ export class Meter { } // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -237,7 +238,7 @@ export class Meter { this.BatteryLevel = 100; } this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` - + ` StatusLowBattery: ${this.StatusLowBattery}`); + + ` StatusLowBattery: ${this.StatusLowBattery}`); // FirmwareRevision this.FirmwareRevision = this.OpenAPI_FirmwareRevision!; @@ -387,7 +388,7 @@ export class Meter { this.accessory.context.CurrentRelativeHumidity = this.CurrentRelativeHumidity; this.humidityService?.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity); this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ` - + `updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`); + + `updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`); } } // CurrentTemperature diff --git a/src/device/meterplus.ts b/src/device/meterplus.ts index f14417aa..607599a2 100644 --- a/src/device/meterplus.ts +++ b/src/device/meterplus.ts @@ -89,9 +89,9 @@ export class MeterPlus { accessory.removeService(this.temperatureService!); } else if (!this.temperatureService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`); - (this.temperatureService = - this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)), - `${accessory.displayName} Temperature Sensor`; + const temperatureService = `${accessory.displayName} Temperature Sensor`; + (this.temperatureService = this.accessory.getService(this.platform.Service.TemperatureSensor) + || this.accessory.addService(this.platform.Service.TemperatureSensor)), temperatureService; this.temperatureService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`); if (!this.temperatureService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -120,9 +120,9 @@ export class MeterPlus { accessory.removeService(this.humidityService!); } else if (!this.humidityService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Humidity Sensor Service`); - (this.humidityService = - this.accessory.getService(this.platform.Service.HumiditySensor) || this.accessory.addService(this.platform.Service.HumiditySensor)), - `${accessory.displayName} Humidity Sensor`; + const humidityService = `${accessory.displayName} Humidity Sensor`; + (this.humidityService = this.accessory.getService(this.platform.Service.HumiditySensor) + || this.accessory.addService(this.platform.Service.HumiditySensor)), humidityService; this.humidityService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`); if (!this.humidityService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -141,8 +141,9 @@ export class MeterPlus { } // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -239,7 +240,7 @@ export class MeterPlus { this.BatteryLevel = 100; } this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` - + ` StatusLowBattery: ${this.StatusLowBattery}`); + + ` StatusLowBattery: ${this.StatusLowBattery}`); // FirmwareRevision this.FirmwareRevision = this.OpenAPI_FirmwareRevision!; diff --git a/src/device/motion.ts b/src/device/motion.ts index 6bfd4047..2d000192 100644 --- a/src/device/motion.ts +++ b/src/device/motion.ts @@ -83,8 +83,9 @@ export class Motion { // get the Battery service if it exists, otherwise create a new Motion service // you can create multiple services for each accessory - (this.motionSensorService = accessory.getService(this.platform.Service.MotionSensor) || accessory.addService(this.platform.Service.MotionSensor)), - `${accessory.displayName} Motion Sensor`; + const motionSensorService = `${accessory.displayName} Motion Sensor`; + (this.motionSensorService = accessory.getService(this.platform.Service.MotionSensor) + || accessory.addService(this.platform.Service.MotionSensor)), motionSensorService; this.motionSensorService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.motionSensorService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -100,9 +101,9 @@ export class Motion { accessory.removeService(this.lightSensorService!); } else if (!this.lightSensorService) { this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Light Sensor Service`); - (this.lightSensorService = - this.accessory.getService(this.platform.Service.LightSensor) || this.accessory.addService(this.platform.Service.LightSensor)), - `${accessory.displayName} Light Sensor`; + const lightSensorService = `${accessory.displayName} Light Sensor`; + (this.lightSensorService = this.accessory.getService(this.platform.Service.LightSensor) + || this.accessory.addService(this.platform.Service.LightSensor)), lightSensorService; this.lightSensorService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Light Sensor`); this.lightSensorService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Light Sensor`); @@ -111,8 +112,9 @@ export class Motion { } // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -223,7 +225,7 @@ export class Motion { this.BatteryLevel = 100; } this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` - + ` StatusLowBattery: ${this.StatusLowBattery}`); + + ` StatusLowBattery: ${this.StatusLowBattery}`); // FirmwareRevision this.FirmwareRevision = this.OpenAPI_FirmwareRevision!; diff --git a/src/device/plug.ts b/src/device/plug.ts index 48200060..53883af7 100644 --- a/src/device/plug.ts +++ b/src/device/plug.ts @@ -64,8 +64,9 @@ export class Plug { // get the Outlet service if it exists, otherwise create a new Outlet service // you can create multiple services for each accessory - (this.outletService = accessory.getService(this.platform.Service.Outlet) || accessory.addService(this.platform.Service.Outlet)), - `${device.deviceName} ${device.deviceType}`; + const outletService = `${accessory.displayName} ${device.deviceType}`; + (this.outletService = accessory.getService(this.platform.Service.Outlet) + || accessory.addService(this.platform.Service.Outlet)), outletService; this.outletService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.outletService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/src/device/robotvacuumcleaner.ts b/src/device/robotvacuumcleaner.ts index b9acd872..0c90c9f6 100644 --- a/src/device/robotvacuumcleaner.ts +++ b/src/device/robotvacuumcleaner.ts @@ -71,8 +71,9 @@ export class RobotVacuumCleaner { // get the Lightbulb service if it exists, otherwise create a new Lightbulb service // you can create multiple services for each accessory - (this.robotVacuumCleanerService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)), - `${device.deviceName} ${device.deviceType}`; + const robotVacuumCleanerService = `${accessory.displayName} ${device.deviceType}`; + (this.robotVacuumCleanerService = accessory.getService(this.platform.Service.Lightbulb) + || accessory.addService(this.platform.Service.Lightbulb)), robotVacuumCleanerService; this.robotVacuumCleanerService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.robotVacuumCleanerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -100,8 +101,9 @@ export class RobotVacuumCleaner { .onSet(this.BrightnessSet.bind(this)); // Battery Service - (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)), - `${accessory.displayName} Battery`; + const batteryService = `${accessory.displayName} Battery`; + (this.batteryService = this.accessory.getService(this.platform.Service.Battery) + || accessory.addService(this.platform.Service.Battery)), batteryService; this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`); if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { @@ -152,8 +154,8 @@ export class RobotVacuumCleaner { async parseStatus(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} parseStatus enableCloudService: ${this.device.enableCloudService}`); - /*} else if (this.BLE) { - await this.BLEparseStatus();*/ + /*} else if (this.BLE) { + await this.BLEparseStatus();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIparseStatus(); } else { @@ -208,8 +210,8 @@ export class RobotVacuumCleaner { async refreshStatus(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus enableCloudService: ${this.device.enableCloudService}`); - /*} else if (this.BLE) { - await this.BLERefreshStatus();*/ + /*} else if (this.BLE) { + await this.BLERefreshStatus();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIRefreshStatus(); } else { @@ -328,8 +330,8 @@ export class RobotVacuumCleaner { async pushChanges(): Promise { if (!this.device.enableCloudService && this.OpenAPI) { this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`); - /*} else if (this.BLE) { - await this.BLEpushChanges();*/ + /*} else if (this.BLE) { + await this.BLEpushChanges();*/ } else if (this.OpenAPI && this.platform.config.credentials?.token) { await this.openAPIpushChanges(); } else { diff --git a/src/irdevice/airconditioner.ts b/src/irdevice/airconditioner.ts index 0b9b8662..16659599 100644 --- a/src/irdevice/airconditioner.ts +++ b/src/irdevice/airconditioner.ts @@ -67,8 +67,9 @@ export class AirConditioner { // get the Television service if it exists, otherwise create a new Television service // you can create multiple services for each accessory - (this.coolerService = accessory.getService(this.platform.Service.HeaterCooler) || accessory.addService(this.platform.Service.HeaterCooler)), - `${accessory.displayName} ${device.remoteType}`; + const coolerService = `${accessory.displayName} ${device.remoteType}`; + (this.coolerService = accessory.getService(this.platform.Service.HeaterCooler) + || accessory.addService(this.platform.Service.HeaterCooler)), coolerService; this.coolerService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.coolerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/src/irdevice/airpurifier.ts b/src/irdevice/airpurifier.ts index 89c03628..8cefb865 100644 --- a/src/irdevice/airpurifier.ts +++ b/src/irdevice/airpurifier.ts @@ -61,8 +61,9 @@ export class AirPurifier { // get the Television service if it exists, otherwise create a new Television service // you can create multiple services for each accessory - (this.airPurifierService = accessory.getService(this.platform.Service.AirPurifier) || accessory.addService(this.platform.Service.AirPurifier)), - `${accessory.displayName} Air Purifier`; + const airPurifierService = `${accessory.displayName} Air Purifier`; + (this.airPurifierService = accessory.getService(this.platform.Service.AirPurifier) + || accessory.addService(this.platform.Service.AirPurifier)), airPurifierService; this.airPurifierService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.airPurifierService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/src/irdevice/camera.ts b/src/irdevice/camera.ts index 60d80b66..0f73c38c 100644 --- a/src/irdevice/camera.ts +++ b/src/irdevice/camera.ts @@ -43,8 +43,9 @@ export class Camera { // get the Television service if it exists, otherwise create a new Television service // you can create multiple services for each accessory - (this.switchService = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)), - `${accessory.displayName} Camera`; + const switchService = `${accessory.displayName} Camera`; + (this.switchService = accessory.getService(this.platform.Service.Switch) + || accessory.addService(this.platform.Service.Switch)), switchService; this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.switchService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/src/irdevice/fan.ts b/src/irdevice/fan.ts index e0d422eb..fb92d320 100644 --- a/src/irdevice/fan.ts +++ b/src/irdevice/fan.ts @@ -50,8 +50,9 @@ export class Fan { // get the Television service if it exists, otherwise create a new Television service // you can create multiple services for each accessory - (this.fanService = accessory.getService(this.platform.Service.Fanv2) || accessory.addService(this.platform.Service.Fanv2)), - `${accessory.displayName} Fan`; + const fanService = `${accessory.displayName} Fan`; + (this.fanService = accessory.getService(this.platform.Service.Fanv2) + || accessory.addService(this.platform.Service.Fanv2)), fanService; this.fanService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.fanService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/src/irdevice/light.ts b/src/irdevice/light.ts index 850cee60..7a33c2b6 100644 --- a/src/irdevice/light.ts +++ b/src/irdevice/light.ts @@ -43,8 +43,9 @@ export class Light { // get the Light service if it exists, otherwise create a new Light service // you can create multiple services for each accessory - (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)), - `${accessory.displayName} ${device.remoteType}`; + const lightBulbService = `${accessory.displayName} ${device.remoteType}`; + (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) + || accessory.addService(this.platform.Service.Lightbulb)), lightBulbService; this.lightBulbService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.lightBulbService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/src/irdevice/other.ts b/src/irdevice/other.ts index 8b06e08e..eb438c03 100644 --- a/src/irdevice/other.ts +++ b/src/irdevice/other.ts @@ -65,8 +65,9 @@ export class Others { this.removeStatefulProgrammableSwitchService(accessory); // Add switchService - (this.switchService = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)), - `${accessory.displayName} Switch`; + const switchService = `${accessory.displayName} Switch`; + (this.switchService = accessory.getService(this.platform.Service.Switch) + || accessory.addService(this.platform.Service.Switch)), switchService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Switch`); this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -85,10 +86,10 @@ export class Others { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.garageDoorService = - accessory.getService(this.platform.Service.GarageDoorOpener) || accessory.addService(this.platform.Service.GarageDoorOpener)), - `${accessory.displayName} Garage Door Opener`; + // Add garageDoorService + const garageDoorService = `${accessory.displayName} Garage Door Opener`; + (this.garageDoorService = accessory.getService(this.platform.Service.GarageDoorOpener) + || accessory.addService(this.platform.Service.GarageDoorOpener)), garageDoorService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Garage Door Opener`); this.garageDoorService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -108,9 +109,10 @@ export class Others { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.doorService = accessory.getService(this.platform.Service.Door) || accessory.addService(this.platform.Service.Door)), - `${accessory.displayName} Door`; + // Add doorService + const doorService = `${accessory.displayName} Door`; + (this.doorService = accessory.getService(this.platform.Service.Door) + || accessory.addService(this.platform.Service.Door)), doorService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Door`); this.doorService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -138,9 +140,10 @@ export class Others { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.windowService = accessory.getService(this.platform.Service.Window) || accessory.addService(this.platform.Service.Window)), - `${accessory.displayName} Window`; + // Add windowService + const windowService = `${accessory.displayName} Window`; + (this.windowService = accessory.getService(this.platform.Service.Window) + || accessory.addService(this.platform.Service.Window)), windowService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window`); this.windowService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -168,10 +171,10 @@ export class Others { this.removeGarageDoorService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.windowCoveringService = - accessory.getService(this.platform.Service.WindowCovering) || accessory.addService(this.platform.Service.WindowCovering)), - `${accessory.displayName} Window Covering`; + // Add windowCoveringService + const windowCoveringService = `${accessory.displayName} Window Covering`; + (this.windowCoveringService = accessory.getService(this.platform.Service.WindowCovering) + || accessory.addService(this.platform.Service.WindowCovering)), windowCoveringService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window Covering`); this.windowCoveringService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -199,9 +202,10 @@ export class Others { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.lockService = accessory.getService(this.platform.Service.LockMechanism) || accessory.addService(this.platform.Service.LockMechanism)), - `${accessory.displayName} Lock`; + // Add lockService + const lockService = `${accessory.displayName} Lock`; + (this.lockService = accessory.getService(this.platform.Service.LockMechanism) + || accessory.addService(this.platform.Service.LockMechanism)), lockService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Lock`); this.lockService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -220,9 +224,10 @@ export class Others { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.faucetService = accessory.getService(this.platform.Service.Faucet) || accessory.addService(this.platform.Service.Faucet)), - `${accessory.displayName} Faucet`; + // Add faucetService + const faucetService = `${accessory.displayName} Faucet`; + (this.faucetService = accessory.getService(this.platform.Service.Faucet) + || accessory.addService(this.platform.Service.Faucet)), faucetService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Faucet`); this.faucetService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -241,9 +246,10 @@ export class Others { this.removeWindowCoveringService(accessory); this.removeStatefulProgrammableSwitchService(accessory); - // Add switchService - (this.fanService = accessory.getService(this.platform.Service.Fan) || accessory.addService(this.platform.Service.Fan)), - `${accessory.displayName} Fan`; + // Add fanService + const fanService = `${accessory.displayName} Fan`; + (this.fanService = accessory.getService(this.platform.Service.Fan) + || accessory.addService(this.platform.Service.Fan)), fanService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Fan`); this.fanService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -262,11 +268,10 @@ export class Others { this.removeGarageDoorService(accessory); this.removeWindowCoveringService(accessory); - // Add switchService - (this.statefulProgrammableSwitchService = - accessory.getService(this.platform.Service.StatefulProgrammableSwitch) || - accessory.addService(this.platform.Service.StatefulProgrammableSwitch)), - `${accessory.displayName} Stateful Programmable Switch`; + // Add statefulProgrammableSwitchService + const statefulProgrammableSwitchService = `${accessory.displayName} Stateful Programmable Switch`; + (this.statefulProgrammableSwitchService = accessory.getService(this.platform.Service.StatefulProgrammableSwitch) + || accessory.addService(this.platform.Service.StatefulProgrammableSwitch)), statefulProgrammableSwitchService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Stateful Programmable Switch`); this.statefulProgrammableSwitchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); @@ -288,8 +293,9 @@ export class Others { this.removeStatefulProgrammableSwitchService(accessory); // Add outletService - (this.outletService = accessory.getService(this.platform.Service.Outlet) || accessory.addService(this.platform.Service.Outlet)), - `${accessory.displayName} Outlet`; + const outletService = `${accessory.displayName} Outlet`; + (this.outletService = accessory.getService(this.platform.Service.Outlet) + || accessory.addService(this.platform.Service.Outlet)), outletService; this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Outlet`); this.outletService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); diff --git a/src/irdevice/tv.ts b/src/irdevice/tv.ts index e398c3ad..0b259b1b 100644 --- a/src/irdevice/tv.ts +++ b/src/irdevice/tv.ts @@ -47,34 +47,35 @@ export class TV { .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision); // set the accessory category + const tvServiceCategory = `${accessory.displayName} ${device.remoteType}`; switch (device.remoteType) { case 'Speaker': case 'DIY Speaker': accessory.category = this.platform.api.hap.Categories.SPEAKER; - (this.tvService = accessory.getService(this.platform.Service.Television) || accessory.addService(this.platform.Service.Television)), - `${accessory.displayName} ${device.remoteType}`; + (this.tvService = accessory.getService(this.platform.Service.Television) + || accessory.addService(this.platform.Service.Television)), tvServiceCategory; break; case 'IPTV': case 'DIY IPTV': accessory.category = this.platform.api.hap.Categories.TV_STREAMING_STICK; - (this.tvService = accessory.getService(this.platform.Service.Television) || accessory.addService(this.platform.Service.Television)), - `${accessory.displayName} ${device.remoteType}`; + (this.tvService = accessory.getService(this.platform.Service.Television) + || accessory.addService(this.platform.Service.Television)), tvServiceCategory; break; case 'DVD': case 'DIY DVD': case 'Set Top Box': case 'DIY Set Top Box': accessory.category = this.platform.api.hap.Categories.TV_SET_TOP_BOX; - (this.tvService = accessory.getService(this.platform.Service.Television) || accessory.addService(this.platform.Service.Television)), - `${accessory.displayName} ${device.remoteType}`; + (this.tvService = accessory.getService(this.platform.Service.Television) + || accessory.addService(this.platform.Service.Television)), tvServiceCategory; break; default: accessory.category = this.platform.api.hap.Categories.TELEVISION; // get the Television service if it exists, otherwise create a new Television service // you can create multiple services for each accessory - (this.tvService = accessory.getService(this.platform.Service.Television) || accessory.addService(this.platform.Service.Television)), - `${accessory.displayName} ${device.remoteType}`; + (this.tvService = accessory.getService(this.platform.Service.Television) + || accessory.addService(this.platform.Service.Television)), tvServiceCategory; } this.tvService.getCharacteristic(this.platform.Characteristic.ConfiguredName); @@ -100,9 +101,9 @@ export class TV { * Create a speaker service to allow volume control */ // create a new Television Speaker service - (this.speakerService = - accessory.getService(this.platform.Service.TelevisionSpeaker) || accessory.addService(this.platform.Service.TelevisionSpeaker)), - `${accessory.displayName} Speaker`; + const speakerService = `${accessory.displayName} Speaker`; + (this.speakerService = accessory.getService(this.platform.Service.TelevisionSpeaker) + || accessory.addService(this.platform.Service.TelevisionSpeaker)), speakerService; this.speakerService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Speaker`); if (!this.speakerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/src/irdevice/vacuumcleaner.ts b/src/irdevice/vacuumcleaner.ts index a36dde1b..8b5a9099 100644 --- a/src/irdevice/vacuumcleaner.ts +++ b/src/irdevice/vacuumcleaner.ts @@ -43,8 +43,9 @@ export class VacuumCleaner { // get the Television service if it exists, otherwise create a new Television service // you can create multiple services for each accessory - (this.switchService = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)), - `${accessory.displayName} ${device.remoteType}`; + const switchService = `${accessory.displayName} ${device.remoteType}`; + (this.switchService = accessory.getService(this.platform.Service.Switch) + || accessory.addService(this.platform.Service.Switch)), switchService; this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.switchService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/src/irdevice/waterheater.ts b/src/irdevice/waterheater.ts index 01278764..46ea58c7 100644 --- a/src/irdevice/waterheater.ts +++ b/src/irdevice/waterheater.ts @@ -43,8 +43,9 @@ export class WaterHeater { // get the Television service if it exists, otherwise create a new Television service // you can create multiple services for each accessory - (this.valveService = accessory.getService(this.platform.Service.Valve) || accessory.addService(this.platform.Service.Valve)), - `${accessory.displayName} ${device.remoteType}`; + const valveService = `${accessory.displayName} ${device.remoteType}`; + (this.valveService = accessory.getService(this.platform.Service.Valve) + || accessory.addService(this.platform.Service.Valve)), valveService; this.valveService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName); if (!this.valveService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) { diff --git a/tsconfig.json b/tsconfig.json index 41b030fc..a08cd3c5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,15 @@ "compilerOptions": { "target": "ES2021", "module": "commonjs", - "lib": ["ES2015", "ES2016", "ES2017", "ES2018", "ES2019", "ES2020", "ES2021"], + "lib": [ + "ES2015", + "ES2016", + "ES2017", + "ES2018", + "ES2019", + "ES2020", + "ES2021" + ], "declaration": true, "declarationMap": true, "sourceMap": true, @@ -12,6 +20,10 @@ "esModuleInterop": true, "noImplicitAny": false }, - "include": ["src/"], - "exclude": ["**/*.spec.ts"] -} + "include": [ + "src/" + ], + "exclude": [ + "**/*.spec.ts" + ] +} \ No newline at end of file