Skip to content

Commit

Permalink
v3.8.0 (#1040)
Browse files Browse the repository at this point in the history
## [3.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v3.8.0) (2024-09-11)

### What's Changed
- Added specific macOS Bluetooth permission instructions to Readme [#1026](#1026), Thanks [@rSffsE](https://github.com/rSffsE)
- Added partial support for `Roller Shade` deviceType. Currently only supports status.
- Added `silentModeSwitch` config option for both `Curtain` & `Blind Titl` deviceTypes, allowing two switches to be display for Closing and Moding Mode. If turned on then Silent Mode is enabled.
- Added option to allow invalid Characters in displayName with config `allowInvalidCharacters`
- Added `dry` config option to enable Dry Status support for Water Detector
- Fixed Platform BLE Scanning events not registering
- Fix `On` state for robot vacuum cleaners [#1028](#1028), Thanks [@JannThomas](https://github.com/JannThomas)
- Housekeeping and updated dependencies.

**Full Changelog**: v3.7.0...v3.8.0
  • Loading branch information
donavanbecker committed Sep 11, 2024
1 parent 11d4dc4 commit 75340ab
Show file tree
Hide file tree
Showing 49 changed files with 22,388 additions and 18,380 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/)

## [3.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v3.8.0) (2024-09-11)

### What's Changed
- Added specific macOS Bluetooth permission instructions to Readme [#1026](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/1026), Thanks [@rSffsE](https://github.com/rSffsE)
- Added partial support for `Roller Shade` deviceType. Currently only supports status.
- Added `silentModeSwitch` config option for both `Curtain` & `Blind Titl` deviceTypes, allowing two switches to be display for Closing and Moding Mode. If turned on then Silent Mode is enabled.
- Added option to allow invalid Characters in displayName with config `allowInvalidCharacters`
- Added `dry` config option to enable Dry Status support for Water Detector
- Fixed Platform BLE Scanning events not registering
- Fix `On` state for robot vacuum cleaners [#1028](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/1028), Thanks [@JannThomas](https://github.com/JannThomas)
- Housekeeping and updated dependencies.

**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.7.0...v3.8.0

## [3.7.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v3.7.0) (2024-07-21)

### What's Changed
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@

This lists all discovered Bluetooth devices. The BLE address of the SwitchBot device should be included in this list, otherwise your computer does not discover it.

- ### If using MacOS
1. Manually grant Bluetooth access in System Settings UI for `Security & Privacy -> Privacy` to the node executable, eg `/usr/local/bin/node`
![Security & Privacy -> Privacy](assets/security-privacy-bluetooth.png)
(This is what is intended in documentation for the noble bluetooth package [prerequisites](https://github.com/abandonware/noble#prerequisites) by "Add terminal app", however for HomeBridge it is `node` that needs the permission granted, not `terminal`.
Without this step, then you will receive the following error when the swichbot plugin launches, which will cause Homebridge or the child bridge process to restart:
```
Error: Failed to initialize the Noble object: unauthorized
at Noble.<anonymous> (file:///usr/local/lib/node_modules/@switchbot/homebridge-switchbot/node_modules/node-switchbot/src/switchbot.ts:244:19)
at Object.onceWrapper (node:events:629:26)
at Noble.emit (node:events:514:28)
at Noble.onStateChange (/usr/local/lib/node_modules/@switchbot/homebridge-switchbot/node_modules/@stoprocent/noble/lib/noble.js:92:8)
at NobleMac.emit (node:events:514:28)
```

## Supported SwitchBot Devices

- [SwitchBot Humidifier](https://www.switch-bot.com/products/switchbot-smart-humidifier)
Expand Down
Binary file added assets/security-privacy-bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 83 additions & 2 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@
"Robot Vacuum Cleaner S1 Plus"
]
},
{
"title": "Roller Shade",
"enum": [
"Roller Shade"
]
},
{
"title": "Smart Fan",
"enum": [
Expand Down Expand Up @@ -587,6 +593,14 @@
"condition": {
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType === 'Water Detector' && model.options.devices[arrayIndices].deviceId);"
}
},
"dry": {
"title": "Water Detector's Dry Alert",
"type": "boolean",
"description": "If true, the Water Detector will send an alert when it is dry.",
"condition": {
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType === 'Water Detector' && model.options.devices[arrayIndices].deviceId);"
}
}
}
},
Expand Down Expand Up @@ -699,6 +713,13 @@
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].configDeviceType === 'Curtain' || model.options.devices[arrayIndices].configDeviceType === 'Curtain3') && model.options.devices[arrayIndices].deviceId);"
}
},
"silentModeSwitch": {
"title": "Enable Curtain Silent Mode Switches",
"type": "boolean",
"condition": {
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].configDeviceType === 'Curtain' || model.options.devices[arrayIndices].configDeviceType === 'Curtain3') && model.options.devices[arrayIndices].deviceId);"
}
},
"hide_lightsensor": {
"title": "Hide Light Sensor",
"type": "boolean",
Expand Down Expand Up @@ -810,6 +831,55 @@
"condition": {
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType === 'Blind Tilt' && model.options.devices[arrayIndices].deviceId);"
}
},
"setOpenMode": {
"title": "Blind Tilt's Opening Mode",
"type": "string",
"oneOf": [
{
"enum": [
"0"
],
"title": "Performance Mode"
},
{
"enum": [
"1"
],
"title": "Silent Mode"
}
],
"condition": {
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType === 'Blind Tilt' && model.options.devices[arrayIndices].deviceId);"
}
},
"setCloseMode": {
"title": "Blind Tilt's Closing Mode",
"type": "string",
"oneOf": [
{
"enum": [
"0"
],
"title": "Performance Mode"
},
{
"enum": [
"1"
],
"title": "Silent Mode"
}
],
"condition": {
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType === 'Blind Tilt' && model.options.devices[arrayIndices].deviceId);"
}
},
"silentModeSwitch": {
"title": "Enable Blind Tilt Silent Mode Switches",
"type": "boolean",
"condition": {
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType === 'Blind Tilt' && model.options.devices[arrayIndices].deviceId);"
}
}
}
},
Expand Down Expand Up @@ -1737,6 +1807,11 @@
]
}
]
},
"allowInvalidCharacters": {
"title": "Allow Invalid Characters",
"type": "boolean",
"description": "If true, invalid characters will be allowed in the device name."
}
},
"required": [
Expand Down Expand Up @@ -1795,13 +1870,15 @@
"options.devices[].hub.hide_humidity",
"options.devices[].hub.hide_lightsensor",
"options.devices[].waterdetector.hide_leak",
"options.devices[].waterdetector.dry",
"options.devices[].humidifier.set_minStep",
"options.devices[].humidifier.hide_temperature",
"options.devices[].curtain.set_minStep",
"options.devices[].curtain.set_min",
"options.devices[].curtain.set_max",
"options.devices[].curtain.setOpenMode",
"options.devices[].curtain.setCloseMode",
"options.devices[].curtain.silentModeSwitch",
"options.devices[].curtain.updateRate",
"options.devices[].curtain.disable_group",
"options.devices[].curtain.hide_lightsensor",
Expand All @@ -1813,6 +1890,9 @@
"options.devices[].blindTilt.set_max",
"options.devices[].blindTilt.hide_lightsensor",
"options.devices[].blindTilt.updateRate",
"options.devices[].blindTilt.setOpenMode",
"options.devices[].blindTilt.setCloseMode",
"options.devices[].blindTilt.silentModeSwitch",
"options.devices[].contact.hide_lightsensor",
"options.devices[].contact.set_minlux",
"options.devices[].contact.set_maxlux",
Expand Down Expand Up @@ -1929,8 +2009,9 @@
"key": "options.pushRate",
"description": "<em class='primary-text'>Specifies the interval, in seconds, between pushes to the SwitchBot API.</em>"
},
"options.logging"
"options.logging",
"options.allowInvalidCharacters"
]
}
]
}
}
141 changes: 48 additions & 93 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,51 @@
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin'
import antfu from '@antfu/eslint-config'


export default tseslint.config({
plugins: {
'@stylistic': stylistic,
'@typescript-eslint': tseslint.plugin,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: true,
export default antfu(
{
ignores: ['dist', 'docs'],
jsx: false,
typescript: true,
formatters: {
markdown: true,
},
rules: {
'curly': ['error', 'multi-line'],
'import/extensions': ['error', 'ignorePackages'],
'import/order': 0,
'jsdoc/check-alignment': 'error',
'jsdoc/check-line-alignment': 'error',
'no-undef': 'error',
'perfectionist/sort-exports': 'error',
'perfectionist/sort-imports': [
'error',
{
groups: [
'builtin-type',
'external-type',
'internal-type',
['parent-type', 'sibling-type', 'index-type'],
'builtin',
'external',
'internal',
['parent', 'sibling', 'index'],
'object',
'unknown',
],
order: 'asc',
type: 'natural',
},
],
'perfectionist/sort-named-exports': 'error',
'perfectionist/sort-named-imports': 'error',
'sort-imports': 0,
'style/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'style/quote-props': ['error', 'consistent-as-needed'],
'test/no-only-tests': 'error',
'unicorn/no-useless-spread': 'error',
'unused-imports/no-unused-vars': ['error', { caughtErrors: 'none' }],
'no-new': 0, // Disable the no-new rule
'new-cap': 0, // Disable the new-cap rule
'no-undef': 0, // Disable the no-undef rule
},
},
files: ['**/*.ts'],
ignores: ['.dist/*'],
extends: [
pluginJs.configs.recommended,
...tseslint.configs.recommended,
],
rules: {
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@stylistic/type-annotation-spacing': 'error',
'@stylistic/quotes': [
'warn',
'single',
],
'@stylistic/indent': [
'warn',
2,
{
'SwitchCase': 1,
},
],
'@stylistic/linebreak-style': [
'warn',
'unix',
],
'@stylistic/semi': [
'warn',
'always',
],
'@stylistic/comma-dangle': [
'warn',
'always-multiline',
],
'@stylistic/dot-notation': 'off',
'eqeqeq': 'warn',
'curly': [
'warn',
'all',
],
'@stylistic/brace-style': [
'warn',
],
'prefer-arrow-callback': [
'warn',
],
'@stylistic/max-len': [
'warn',
150,
],
'no-console': [
'warn',
], // use the provided Homebridge log method instead
'no-non-null-assertion': [
'off',
],
'@stylistic/comma-spacing': [
'error',
],
'@stylistic/no-multi-spaces': [
'warn',
{
'ignoreEOLComments': true,
},
],
'@stylistic/no-trailing-spaces': [
'warn',
],
'@stylistic/lines-between-class-members': [
'warn',
'always',
{
'exceptAfterSingleLine': true,
},
],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
});
)
Loading

0 comments on commit 75340ab

Please sign in to comment.