Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Co-authored-by: mrlt8 <[email protected]>

## [Version 2.7.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.7.1) (2023-07-29)

## What's Changed

- Fixed Hub 2 temperature/humidity data for AC, Thanks [@mrlt8](https://github.com/mrlt8) [OpenWonderLabs#779](OpenWonderLabs#779)
- Fixed TargetTemperature not being updated in the HomeKit, Thanks [@mrlt8](https://github.com/mrlt8) [#7779](OpenWonderLabs#779)
- Housekeeping and updated dependencies.

**Full Changelog**: OpenWonderLabs/homebridge-switchbot@v2.7.0....v2.7.1
  • Loading branch information
donavanbecker authored and banboobee committed Jul 29, 2023
1 parent 99bc21d commit 21dcdf7
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 228 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@

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

## [Version 2.7.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.7.1) (2023-07-29)

## What's Changed

- Fixed Hub 2 temperature/humidity data for AC, Thanks [@mrlt8](https://github.com/mrlt8) [#779](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/779)
- 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

## [Version 2.7.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.7.0) (2023-07-25)

## What's Changed

- Will now log if there are no devices discovered by SwitchBot-API.
- Added the ability to use Tempature from a SwitchBot Meter to be used with an IR Air Conditioner. [#761](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/761), Thanks [@mrlt8](https://github.com/mrlt8)
- Adds the ability to enable EVE history SwitchBot Curtains. [#766](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/766), Thanks [@banboobee](https://github.com/banboobee)
- Added the ability to use Tempature from a SwitchBot Meter to be used with an IR Air Conditioner, Thanks [@mrlt8](https://github.com/mrlt8) [#761](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/761)
- 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
Expand All @@ -26,7 +36,7 @@ All notable changes to this project will be documented in this file. This projec

## What's Changed

- Add Support for [SwitchBot Meter Plus (JP)](https://www.switchbot.jp/products/switchbot-meter-plus), [#642](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/642)
- 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

Expand Down
127 changes: 76 additions & 51 deletions package-lock.json

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

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Homebridge SwitchBot",
"name": "@switchbot/homebridge-switchbot",
"version": "2.7.0",
"version": "2.7.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 <[email protected]> (https://github.com/SwitchBot)",
"license": "ISC",
Expand Down Expand Up @@ -65,17 +65,17 @@
"await-semaphore": "^0.1.3"
},
"optionalDependencies": {
"@abandonware/bluetooth-hci-socket": "0.5.3-10",
"@abandonware/noble": "1.9.2-21",
"node-switchbot": "1.8.2"
"@abandonware/bluetooth-hci-socket": "^0.5.3-10",
"@abandonware/noble": "^1.9.2-23",
"node-switchbot": "^1.8.2"
},
"devDependencies": {
"@types/crypto-js": "^4.1.1",
"@types/node": "^20.4.5",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"eslint": "^8.45.0",
"eslint-config-prettier": "8.8.0",
"eslint": "^8.46.0",
"eslint-config-prettier": "8.9.0",
"eslint-plugin-prettier": "5.0.0",
"homebridge": "^1.6.1",
"nodemon": "^3.0.1",
Expand Down
34 changes: 23 additions & 11 deletions src/device/hub.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Context } from 'vm';
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
import { interval } from 'rxjs';
import { request } from 'undici';
import { sleep } from '../utils';
import { Context } from 'vm';
import { SwitchBotPlatform } from '../platform';
import { device, devicesConfig, Devices } from '../settings';
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
import { Devices, device, devicesConfig } from '../settings';
import { sleep } from '../utils';

export class Hub {
// Services
Expand Down Expand Up @@ -56,11 +56,11 @@ export class Hub {
// you can create multiple services for each accessory
(this.hubTemperatureSensor =
accessory.getService(this.platform.Service.TemperatureSensor) || accessory.addService(this.platform.Service.TemperatureSensor)),
`${device.deviceName} ${device.deviceType}`;
`${device.deviceName} ${device.deviceType}`;

(this.hubHumiditySensor =
accessory.getService(this.platform.Service.HumiditySensor) || accessory.addService(this.platform.Service.HumiditySensor)),
`${device.deviceName} ${device.deviceType}`;
`${device.deviceName} ${device.deviceType}`;

// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
Expand Down Expand Up @@ -92,7 +92,7 @@ export class Hub {
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Humidity Sensor Service`);
(this.hubHumiditySensor =
accessory.getService(this.platform.Service.HumiditySensor) || accessory.addService(this.platform.Service.HumiditySensor)),
`${device.deviceName} ${device.deviceType}`;
`${device.deviceName} ${device.deviceType}`;

this.hubHumiditySensor.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`);
this.hubHumiditySensor.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Humidity Sensor`);
Expand All @@ -109,7 +109,7 @@ export class Hub {
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`);
(this.hubTemperatureSensor =
accessory.getService(this.platform.Service.TemperatureSensor) || accessory.addService(this.platform.Service.TemperatureSensor)),
`${device.deviceName} ${device.deviceType}`;
`${device.deviceName} ${device.deviceType}`;

this.hubTemperatureSensor.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`);
this.hubTemperatureSensor.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Temperature Sensor`);
Expand Down Expand Up @@ -207,9 +207,21 @@ export class Hub {
*/

async updateHomeKitCharacteristics(): Promise<void> {
this.hubHumiditySensor?.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
this.hubTemperatureSensor?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
if (this.CurrentRelativeHumidity === undefined) {
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
} else {
this.accessory.context.CurrentRelativeHumidity = this.CurrentRelativeHumidity;
this.hubHumiditySensor?.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
}

if (this.CurrentTemperature === undefined) {
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
} else {
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
this.hubTemperatureSensor?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
}
}

async statusCode(statusCode: number): Promise<void> {
Expand Down
Loading

0 comments on commit 21dcdf7

Please sign in to comment.