Skip to content

Commit

Permalink
v4.3.0
Browse files Browse the repository at this point in the history
## [4.3.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v4.3.0) (2025-01-24)

### What's Changed
- Add Support for Relay Switch 1 & Relay Switch 1PM with OpenAPI
- Add Meter Pro & Meter Pro (CO2) as `meterType` for IR AirConditioner
- Fixed SwitchBot Meter Pro Battery Error #1160
- Housekeeping and updated dependencies.

**Full Changelog**: v4.2.0...v4.3.0
  • Loading branch information
donavanbecker committed Jan 24, 2025
1 parent d59d4f2 commit 2fa8a3a
Show file tree
Hide file tree
Showing 10 changed files with 1,640 additions and 192 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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

## [4.3.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v4.3.0) (2025-01-24)

### What's Changed
- Add Support for Relay Switch 1 & Relay Switch 1PM with OpenAPI
- Add Meter Pro & Meter Pro (CO2) as `meterType` for IR AirConditioner
- Fixed SwitchBot Meter Pro Battery Error #1160
- Housekeeping and updated dependencies.

**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.2.0...v4.3.0

## [4.2.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v4.2.0) (2025-01-23)

### What's Changed
Expand Down
963 changes: 786 additions & 177 deletions config.schema.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/default.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><style>body { visibility: hidden; }</style><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><link rel="stylesheet" href="../assets/dmt/dmt-components.css"><link rel="stylesheet" href="../assets/dmt/dmt-theme.css"><script src="../assets/dmt/dmt-components.js" type="module"></script><noscript><style>body { visibility: visible; }</style></noscript></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";</script><div class="overlay"></div>
<main><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field" id="dmt-search-main"></div><div class="field" id="dmt-toolbar"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a></div></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" tabindex="-1"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"></ul><div class="dmt-title-header-flex"><h1>Function default</h1></div></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-type">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/f58f57d81407839c58edd47de3ef918e0d027fdb/src/index.ts#L11">index.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar" tabindex="-1"><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" tabindex="-1"><nav class="tsd-navigation"><a href="../modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"></ul></nav></div></div></div></main></body></html>
<main><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field" id="dmt-search-main"></div><div class="field" id="dmt-toolbar"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a></div></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" tabindex="-1"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"></ul><div class="dmt-title-header-flex"><h1>Function default</h1></div></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-type">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/d59d4f25fa9f54404a8b090757813621f1115a9e/src/index.ts#L11">index.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar" tabindex="-1"><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" tabindex="-1"><nav class="tsd-navigation"><a href="../modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"></ul></nav></div></div></div></main></body></html>
12 changes: 6 additions & 6 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions 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.2.0",
"version": "4.3.0",
"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 Expand Up @@ -83,7 +83,7 @@
"async-mqtt": "^2.6.3",
"fakegato-history": "^0.6.5",
"homebridge-lib": "^7.1.2",
"node-switchbot": "^3.4.4",
"node-switchbot": "^3.4.9",
"rxjs": "^7.8.1"
},
"devDependencies": {
Expand Down
21 changes: 20 additions & 1 deletion src/device/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { MqttClient } from 'mqtt'
import type { ad, bodyChange, device, deviceStatus, deviceStatusRequest, pushResponse, SwitchBotBLE } from 'node-switchbot'

import type { SwitchBotPlatform } from '../platform.js'
import type { blindTiltConfig, botConfig, ceilingLightConfig, colorBulbConfig, contactConfig, curtainConfig, devicesConfig, hubConfig, humidifierConfig, indoorOutdoorSensorConfig, lockConfig, meterConfig, motionConfig, plugConfig, stripLightConfig, SwitchBotPlatformConfig, waterDetectorConfig } from '../settings.js'
import type { blindTiltConfig, botConfig, ceilingLightConfig, colorBulbConfig, contactConfig, curtainConfig, devicesConfig, hubConfig, humidifierConfig, indoorOutdoorSensorConfig, lockConfig, meterConfig, motionConfig, plugConfig, relaySwitch1Config, relaySwitch1PMConfig, stripLightConfig, SwitchBotPlatformConfig, waterDetectorConfig } from '../settings.js'

import { hostname } from 'node:os'

Expand Down Expand Up @@ -149,6 +149,7 @@ export abstract class deviceBase {
device.maxRetry !== 0 && { maxRetry: device.maxRetry },
device.webhook === true && { webhook: device.webhook },
device.connectionType !== '' && { connectionType: device.connectionType },
device.disablePlatformBLE !== false && { disablePlatformBLE: device.disablePlatformBLE },
device.external === true && { external: device.external },
device.mqttURL !== '' && { mqttURL: device.mqttURL },
device.mqttOptions && { mqttOptions: device.mqttOptions },
Expand All @@ -161,6 +162,12 @@ export abstract class deviceBase {
case 'Bot':
deviceSpecificConfig = device as botConfig
break
case 'Relay Switch 1':
deviceSpecificConfig = device as relaySwitch1Config
break
case 'Relay Switch 1PM':
deviceSpecificConfig = device as relaySwitch1PMConfig
break
case 'Meter':
case 'MeterPlus':
deviceSpecificConfig = device as meterConfig
Expand Down Expand Up @@ -445,6 +452,18 @@ export abstract class deviceBase {
bleModelName: SwitchBotBLEModelName.Bot,
bleModelFriendlyName: SwitchBotBLEModelFriendlyName.Bot,
},
'Relay Switch 1': {
model: SwitchBotModel.RelaySwitch1,
bleModel: SwitchBotBLEModel.RelaySwitch1,
bleModelName: SwitchBotBLEModelName.RelaySwitch1,
bleModelFriendlyName: SwitchBotBLEModelFriendlyName.RelaySwitch1,
},
'Relay Switch 1PM': {
model: SwitchBotModel.RelaySwitch1PM,
bleModel: SwitchBotBLEModel.RelaySwitch1PM,
bleModelName: SwitchBotBLEModelName.RelaySwitch1PM,
bleModelFriendlyName: SwitchBotBLEModelFriendlyName.RelaySwitch1PM,
},
'Meter': {
model: SwitchBotModel.Meter,
bleModel: SwitchBotBLEModel.Meter,
Expand Down
2 changes: 1 addition & 1 deletion src/device/meterpro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class MeterPro extends deviceBase {
}

// Battery Info
if ('battery' in this.serviceData) {
if ('battery' in this.deviceStatus) {
// BatteryLevel
this.Battery.BatteryLevel = this.deviceStatus.battery
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
Expand Down
Loading

0 comments on commit 2fa8a3a

Please sign in to comment.