Skip to content

Commit a25c02f

Browse files
v4.1.3 (#1105)
## [4.1.3](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v4.1.3) (2024-11-05) ### What's Changed - Fix characteristic warnings [#1104](#1104), Thanks [@dnicolson](https://github.com/dnicolson) **Full Changelog**: v4.1.2...v4.1.3
1 parent da56779 commit a25c02f

18 files changed

+153
-137
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

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

5+
## [4.1.3](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v4.1.3) (2024-11-05)
6+
7+
### What's Changed
8+
- Fix characteristic warnings [#1104](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/1104), Thanks [@dnicolson](https://github.com/dnicolson)
9+
10+
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.2...v4.1.3
11+
512
## [4.1.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v4.1.2) (2024-11-04)
613

714
### What's Changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
- [SwitchBot Battery Circulator Fan](https://us.switch-bot.com/products/switchbot-battery-circulator-fan)
174174
- Supports OpenAPI Connection Only
175175
- [SwitchBot Water Leak Detector](https://us.switch-bot.com/products/switchbot-water-leak-detector)
176-
- Supports OpenAPI Connection Only
176+
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
177177

178178
## Supported IR Devices
179179

@@ -216,9 +216,9 @@
216216

217217
## SwitchBot APIs
218218

219-
- [OpenWonderLabs/SwitchBotAPI](https://github.com/OpenWonderLabs/SwitchBotAPI)
220-
- [OpenWonderLabs/SwitchBotAPI-BLE](https://github.com/OpenWonderLabs/SwitchBotAPI-BLE)
221-
- [OpenWonderLabs/node-switchbot](https://github.com/OpenWonderLabs/node-switchbot)
219+
- [OpenWonderLabs/node-switchbot](https://github.com/OpenWonderLabs/node-switchbot)
220+
- [OpenWonderLabs/SwitchBotAPI](https://github.com/OpenWonderLabs/SwitchBotAPI)
221+
- [OpenWonderLabs/SwitchBotAPI-BLE](https://github.com/OpenWonderLabs/SwitchBotAPI-BLE)
222222

223223
## Community
224224

docs/functions/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@switchbot/homebridge-switchbot</a></li><li><a href="default.html">default</a></li></ul><h1>Function default</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="default" class="tsd-anchor"></a><span class="tsd-kind-call-signature">default</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/ebf590a7c7b218e9a9b9124a9b16a90045eadfdc/src/index.ts#L11">index.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@switchbot/homebridge-switchbot</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
1+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@switchbot/homebridge-switchbot</a></li><li><a href="default.html">default</a></li></ul><h1>Function default</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="default" class="tsd-anchor"></a><span class="tsd-kind-call-signature">default</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/1b9e752ca7b712fe6d46effa37a8fdf0210381a0/src/index.ts#L11">index.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@switchbot/homebridge-switchbot</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>

docs/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278
</li>
279279
<li><a href="https://us.switch-bot.com/products/switchbot-water-leak-detector" target="_blank" class="external">SwitchBot Water Leak Detector</a>
280280
<ul>
281-
<li>Supports OpenAPI Connection Only</li>
281+
<li>Supports OpenAPI &amp; Bluetooth Low Energy (BLE) Connections</li>
282282
</ul>
283283
</li>
284284
</ul>
@@ -364,10 +364,10 @@
364364
</li>
365365
</ul>
366366
<a id="md:switchbot-apis" class="tsd-anchor"></a><h2 class="tsd-anchor-link">SwitchBot APIs<a href="#md:switchbot-apis" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
367-
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI" target="_blank" class="external">OpenWonderLabs/SwitchBotAPI</a></li>
368-
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI-BLE" target="_blank" class="external">OpenWonderLabs/SwitchBotAPI-BLE</a>
367+
<li><a href="https://github.com/OpenWonderLabs/node-switchbot" target="_blank" class="external">OpenWonderLabs/node-switchbot</a>
369368
<ul>
370-
<li><a href="https://github.com/OpenWonderLabs/node-switchbot" target="_blank" class="external">OpenWonderLabs/node-switchbot</a></li>
369+
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI" target="_blank" class="external">OpenWonderLabs/SwitchBotAPI</a></li>
370+
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI-BLE" target="_blank" class="external">OpenWonderLabs/SwitchBotAPI-BLE</a></li>
371371
</ul>
372372
</li>
373373
</ul>

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@switchbot/homebridge-switchbot",
33
"displayName": "SwitchBot",
44
"type": "module",
5-
"version": "4.1.2",
5+
"version": "4.1.3",
66
"description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
77
"author": "SwitchBot <[email protected]> (https://github.com/SwitchBot)",
88
"contributors": [

src/device/blindtilt.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,11 @@ export class BlindTilt extends deviceBase {
350350
this.getLightLevel(this.serviceData.lightLevel, set_minLux, set_maxLux, spaceBetweenLevels)
351351
this.debugLog(`LightLevel: ${this.serviceData.lightLevel}, CurrentAmbientLightLevel: ${this.LightSensor!.CurrentAmbientLightLevel}`)
352352
}
353-
354-
// BatteryLevel
355-
if (this.serviceData?.battery) {
353+
// Battery Info
354+
if (this.serviceData.battery) {
355+
// BatteryLevel
356356
this.Battery.BatteryLevel = this.serviceData.battery
357357
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
358-
359358
// StatusLowBattery
360359
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
361360
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW

src/device/bot.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,16 +281,17 @@ export class Bot extends deviceBase {
281281
const mode = this.serviceData.mode ? 'Switch' : 'Press'
282282
this.debugLog(`${mode} Mode, On: ${this.On}`)
283283
this.accessory.context.On = this.On
284-
285-
// BatteryLevel
286-
this.Battery.BatteryLevel = this.serviceData.battery
287-
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
288-
289-
// StatusLowBattery
290-
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
291-
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
292-
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
293-
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
284+
// Battery Info
285+
if (this.serviceData.battery) {
286+
// BatteryLevel
287+
this.Battery.BatteryLevel = this.serviceData.battery
288+
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
289+
// StatusLowBattery
290+
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
291+
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
292+
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
293+
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
294+
}
294295
}
295296

296297
/**

src/device/contact.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,17 @@ export class Contact extends deviceBase {
204204
this.LightSensor.CurrentAmbientLightLevel = this.getLightLevel(lightLevel, set_minLux, set_maxLux, 2)
205205
this.debugLog(`LightLevel: ${this.serviceData.lightLevel}, CurrentAmbientLightLevel: ${this.LightSensor.CurrentAmbientLightLevel}`)
206206
}
207-
// BatteryLevel
208-
this.Battery.BatteryLevel = this.serviceData.battery
209-
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
210-
// StatusLowBattery
211-
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
212-
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
213-
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
214-
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
207+
// Battery Info
208+
if (this.serviceData.battery) {
209+
// BatteryLevel
210+
this.Battery.BatteryLevel = this.serviceData.battery
211+
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
212+
// StatusLowBattery
213+
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
214+
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
215+
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
216+
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
217+
}
215218
}
216219

217220
async openAPIparseStatus(): Promise<void> {

src/device/curtain.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,17 @@ export class Curtain extends deviceBase {
391391
this.LightSensor.CurrentAmbientLightLevel = this.getLightLevel(lightLevel, set_minLux, set_maxLux, 19)
392392
this.debugLog(`LightLevel: ${this.serviceData.lightLevel}, CurrentAmbientLightLevel: ${this.LightSensor.CurrentAmbientLightLevel}`)
393393
}
394-
// BatteryLevel
395-
this.Battery.BatteryLevel = this.serviceData.battery
396-
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
397-
// StatusLowBattery
398-
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
399-
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
400-
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
401-
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
394+
// Battery Info
395+
if (this.serviceData.battery) {
396+
// BatteryLevel
397+
this.Battery.BatteryLevel = this.serviceData.battery
398+
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
399+
// StatusLowBattery
400+
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
401+
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
402+
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
403+
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
404+
}
402405
}
403406

404407
async openAPIparseStatus(): Promise<void> {

0 commit comments

Comments
 (0)