Skip to content

Commit

Permalink
v4.1.3 (#1105)
Browse files Browse the repository at this point in the history
## [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
  • Loading branch information
donavanbecker authored Nov 5, 2024
1 parent da56779 commit a25c02f
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 137 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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

## [4.1.3](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v4.1.3) (2024-11-05)

### What's Changed
- Fix characteristic warnings [#1104](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/1104), Thanks [@dnicolson](https://github.com/dnicolson)

**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.2...v4.1.3

## [4.1.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v4.1.2) (2024-11-04)

### What's Changed
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
- [SwitchBot Battery Circulator Fan](https://us.switch-bot.com/products/switchbot-battery-circulator-fan)
- Supports OpenAPI Connection Only
- [SwitchBot Water Leak Detector](https://us.switch-bot.com/products/switchbot-water-leak-detector)
- Supports OpenAPI Connection Only
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections

## Supported IR Devices

Expand Down Expand Up @@ -216,9 +216,9 @@

## SwitchBot APIs

- [OpenWonderLabs/SwitchBotAPI](https://github.com/OpenWonderLabs/SwitchBotAPI)
- [OpenWonderLabs/SwitchBotAPI-BLE](https://github.com/OpenWonderLabs/SwitchBotAPI-BLE)
- [OpenWonderLabs/node-switchbot](https://github.com/OpenWonderLabs/node-switchbot)
- [OpenWonderLabs/node-switchbot](https://github.com/OpenWonderLabs/node-switchbot)
- [OpenWonderLabs/SwitchBotAPI](https://github.com/OpenWonderLabs/SwitchBotAPI)
- [OpenWonderLabs/SwitchBotAPI-BLE](https://github.com/OpenWonderLabs/SwitchBotAPI-BLE)

## Community

Expand Down
2 changes: 1 addition & 1 deletion docs/functions/default.html
Original file line number Diff line number Diff line change
@@ -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>
<!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>
8 changes: 4 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
</li>
<li><a href="https://us.switch-bot.com/products/switchbot-water-leak-detector" target="_blank" class="external">SwitchBot Water Leak Detector</a>
<ul>
<li>Supports OpenAPI Connection Only</li>
<li>Supports OpenAPI &amp; Bluetooth Low Energy (BLE) Connections</li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -364,10 +364,10 @@
</li>
</ul>
<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>
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI" target="_blank" class="external">OpenWonderLabs/SwitchBotAPI</a></li>
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI-BLE" target="_blank" class="external">OpenWonderLabs/SwitchBotAPI-BLE</a>
<li><a href="https://github.com/OpenWonderLabs/node-switchbot" target="_blank" class="external">OpenWonderLabs/node-switchbot</a>
<ul>
<li><a href="https://github.com/OpenWonderLabs/node-switchbot" target="_blank" class="external">OpenWonderLabs/node-switchbot</a></li>
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI" target="_blank" class="external">OpenWonderLabs/SwitchBotAPI</a></li>
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI-BLE" target="_blank" class="external">OpenWonderLabs/SwitchBotAPI-BLE</a></li>
</ul>
</li>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@switchbot/homebridge-switchbot",
"displayName": "SwitchBot",
"type": "module",
"version": "4.1.2",
"version": "4.1.3",
"description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
"author": "SwitchBot <[email protected]> (https://github.com/SwitchBot)",
"contributors": [
Expand Down
7 changes: 3 additions & 4 deletions src/device/blindtilt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,11 @@ export class BlindTilt extends deviceBase {
this.getLightLevel(this.serviceData.lightLevel, set_minLux, set_maxLux, spaceBetweenLevels)
this.debugLog(`LightLevel: ${this.serviceData.lightLevel}, CurrentAmbientLightLevel: ${this.LightSensor!.CurrentAmbientLightLevel}`)
}

// BatteryLevel
if (this.serviceData?.battery) {
// Battery Info
if (this.serviceData.battery) {
// BatteryLevel
this.Battery.BatteryLevel = this.serviceData.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)

// StatusLowBattery
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
Expand Down
21 changes: 11 additions & 10 deletions src/device/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,17 @@ export class Bot extends deviceBase {
const mode = this.serviceData.mode ? 'Switch' : 'Press'
this.debugLog(`${mode} Mode, On: ${this.On}`)
this.accessory.context.On = this.On

// BatteryLevel
this.Battery.BatteryLevel = this.serviceData.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)

// StatusLowBattery
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
// Battery Info
if (this.serviceData.battery) {
// BatteryLevel
this.Battery.BatteryLevel = this.serviceData.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
// StatusLowBattery
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
}
}

/**
Expand Down
19 changes: 11 additions & 8 deletions src/device/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,17 @@ export class Contact extends deviceBase {
this.LightSensor.CurrentAmbientLightLevel = this.getLightLevel(lightLevel, set_minLux, set_maxLux, 2)
this.debugLog(`LightLevel: ${this.serviceData.lightLevel}, CurrentAmbientLightLevel: ${this.LightSensor.CurrentAmbientLightLevel}`)
}
// BatteryLevel
this.Battery.BatteryLevel = this.serviceData.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
// StatusLowBattery
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
// Battery Info
if (this.serviceData.battery) {
// BatteryLevel
this.Battery.BatteryLevel = this.serviceData.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
// StatusLowBattery
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
}
}

async openAPIparseStatus(): Promise<void> {
Expand Down
19 changes: 11 additions & 8 deletions src/device/curtain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,17 @@ export class Curtain extends deviceBase {
this.LightSensor.CurrentAmbientLightLevel = this.getLightLevel(lightLevel, set_minLux, set_maxLux, 19)
this.debugLog(`LightLevel: ${this.serviceData.lightLevel}, CurrentAmbientLightLevel: ${this.LightSensor.CurrentAmbientLightLevel}`)
}
// BatteryLevel
this.Battery.BatteryLevel = this.serviceData.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
// StatusLowBattery
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
// Battery Info
if (this.serviceData.battery) {
// BatteryLevel
this.Battery.BatteryLevel = this.serviceData.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
// StatusLowBattery
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
}
}

async openAPIparseStatus(): Promise<void> {
Expand Down
23 changes: 11 additions & 12 deletions src/device/iosensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,22 @@ export class IOSensor extends deviceBase {
async BLEparseStatus(): Promise<void> {
this.debugLog('BLEparseStatus')
this.debugLog(`(battery, temperature, humidity) = BLE:(${this.serviceData.battery}, ${this.serviceData.celsius}, ${this.serviceData.humidity}), current:(${this.Battery.BatteryLevel}, ${this.TemperatureSensor?.CurrentTemperature}, ${this.HumiditySensor?.CurrentRelativeHumidity})`)

// BatteryLevel
this.Battery.BatteryLevel = this.serviceData.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)

// StatusLowBattery
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)

// Battery Info
if (this.serviceData.battery) {
// BatteryLevel
this.Battery.BatteryLevel = this.serviceData.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
// StatusLowBattery
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
}
// CurrentRelativeHumidity
if (!(this.device as indoorOutdoorSensorConfig).hide_humidity && this.HumiditySensor?.Service) {
this.HumiditySensor.CurrentRelativeHumidity = validHumidity(this.serviceData.humidity, 0, 100)
this.debugLog(`CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}%`)
}

// Current Temperature
if (!(this.device as indoorOutdoorSensorConfig).hide_temperature && this.TemperatureSensor?.Service) {
const CELSIUS = this.serviceData.celsius < 0 ? 0 : this.serviceData.celsius > 100 ? 100 : this.serviceData.celsius
Expand Down
Loading

0 comments on commit a25c02f

Please sign in to comment.