@switchbot/homebridge-switchbot 2.6.0-beta.4 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/tasks.json +13 -0
- package/CHANGELOG.md +4 -2
- package/README.md +18 -9
- package/dist/device/blindtilt.d.ts +1 -5
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +80 -140
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -5
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +79 -138
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +2 -6
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +157 -304
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +2 -6
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +164 -311
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +1 -5
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +36 -72
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +1 -5
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +78 -138
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +2 -6
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +30 -63
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +1 -5
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +115 -228
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +1 -5
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +38 -74
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/{striplight.d.ts → lightstrip.d.ts} +2 -10
- package/dist/device/lightstrip.d.ts.map +1 -0
- package/dist/device/{striplight.js → lightstrip.js} +138 -194
- package/dist/device/lightstrip.js.map +1 -0
- package/dist/device/lock.d.ts +1 -5
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +66 -126
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +1 -5
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +38 -74
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +1 -5
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +39 -75
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +1 -5
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +35 -72
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +1 -5
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +65 -126
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +1 -5
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +79 -151
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +3 -7
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +34 -62
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +3 -7
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +31 -59
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +1 -5
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +30 -57
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +2 -6
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +39 -66
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +1 -5
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +32 -59
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -5
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +30 -57
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +3 -7
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +46 -76
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +2 -6
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +30 -58
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +7 -23
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +41 -74
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +14 -5
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +156 -149
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +4 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +5 -1
- package/dist/settings.js.map +1 -1
- package/nodemon.json +1 -1
- package/package.json +10 -10
- package/src/device/blindtilt.ts +122 -181
- package/src/device/bot.ts +96 -149
- package/src/device/ceilinglight.ts +172 -315
- package/src/device/colorbulb.ts +178 -324
- package/src/device/contact.ts +48 -78
- package/src/device/curtain.ts +93 -148
- package/src/device/hub.ts +34 -63
- package/src/device/humidifier.ts +135 -243
- package/src/device/iosensor.ts +49 -79
- package/src/device/{striplight.ts → lightstrip.ts} +148 -200
- package/src/device/lock.ts +78 -134
- package/src/device/meter.ts +48 -78
- package/src/device/meterplus.ts +50 -80
- package/src/device/motion.ts +46 -77
- package/src/device/plug.ts +76 -134
- package/src/device/robotvacuumcleaner.ts +91 -159
- package/src/irdevice/airconditioner.ts +56 -81
- package/src/irdevice/airpurifier.ts +41 -67
- package/src/irdevice/camera.ts +35 -60
- package/src/irdevice/fan.ts +46 -71
- package/src/irdevice/light.ts +38 -63
- package/src/irdevice/other.ts +35 -60
- package/src/irdevice/tv.ts +52 -80
- package/src/irdevice/vacuumcleaner.ts +36 -62
- package/src/irdevice/waterheater.ts +46 -76
- package/src/platform.ts +144 -158
- package/src/settings.ts +5 -0
- package/.github/npm-version-script.js +0 -81
- package/dist/device/striplight.d.ts.map +0 -1
- package/dist/device/striplight.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/)
|
|
4
4
|
|
|
5
|
-
## [
|
|
5
|
+
## [Version 2.6.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.6.0) (2023-04-15)
|
|
6
6
|
|
|
7
7
|
## What's Changed
|
|
8
8
|
|
|
9
|
-
- Add Support for Hub 2 Humidity and Temperature Sensor, Thanks [@alvie](https://github.com/alvie). [#700](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/700)
|
|
9
|
+
- Add Support for [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Humidity and Temperature Sensor, Thanks [@alvie](https://github.com/alvie). [#700](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/700)
|
|
10
|
+
- Housekeeping and updated dependencies.
|
|
10
11
|
|
|
11
12
|
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.5.3....v2.6.0
|
|
12
13
|
|
|
@@ -18,6 +19,7 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
18
19
|
- Removed inMotion condition, Thanks [@dnicolson](https://github.com/dnicolson). [#703](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/703)
|
|
19
20
|
- Fix async method calls, Thanks [@dnicolson](https://github.com/dnicolson). [#690](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/690)
|
|
20
21
|
- Improve curtain retry functionality, Thanks [@dnicolson](https://github.com/dnicolson). [#694](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/694)
|
|
22
|
+
- Add Support for [SwitchBot Indoor/Outdoor Thermo-Hygrometer](https://www.switch-bot.com/products/switchbot-indoor-outdoor-thermo-hygrometer)
|
|
21
23
|
- Housekeeping and updated dependencies.
|
|
22
24
|
- This release will end support for Node v14.
|
|
23
25
|
|
package/README.md
CHANGED
|
@@ -64,9 +64,10 @@
|
|
|
64
64
|
- [SwitchBot Meter](https://www.switch-bot.com/products/switchbot-meter)
|
|
65
65
|
- [SwitchBot Meter Plus (US)](https://www.switch-bot.com/products/switchbot-meter-plus)
|
|
66
66
|
- [SwitchBot Meter Plus (JP)](https://www.switchbot.jp/products/switchbot-meter-plus)
|
|
67
|
+
- [SwitchBot Indoor/Outdoor Thermo-Hygrometer](https://www.switch-bot.com/products/switchbot-indoor-outdoor-thermo-hygrometer)
|
|
67
68
|
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
|
|
68
69
|
- If using OpenAPI:
|
|
69
|
-
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub
|
|
70
|
+
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
70
71
|
- Enable Cloud Services for Device on SwitchBot App
|
|
71
72
|
- If using Bluetooth Low Energy (BLE) only:
|
|
72
73
|
- Must supply `deviceId` & `deviceName` to Device Config
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
- [SwitchBot Motion Sensor](https://www.switch-bot.com/products/motion-sensor)
|
|
75
76
|
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
|
|
76
77
|
- If using OpenAPI:
|
|
77
|
-
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub
|
|
78
|
+
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
78
79
|
- Enable Cloud Services for Device on SwitchBot App
|
|
79
80
|
- If using Bluetooth Low Energy (BLE) only:
|
|
80
81
|
- Must supply `deviceId` & `deviceName` to Device Config
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
- [SwitchBot Contact Sensor](https://www.switch-bot.com/products/contact-sensor)
|
|
83
84
|
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
|
|
84
85
|
- If using OpenAPI:
|
|
85
|
-
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub
|
|
86
|
+
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
86
87
|
- Enable Cloud Services for Device on SwitchBot App
|
|
87
88
|
- If using Bluetooth Low Energy (BLE) only:
|
|
88
89
|
- Must supply `deviceId` & `deviceName` to Device Config
|
|
@@ -90,23 +91,28 @@
|
|
|
90
91
|
- [SwitchBot Curtain](https://www.switch-bot.com/products/switchbot-curtain)
|
|
91
92
|
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
|
|
92
93
|
- If using OpenAPI:
|
|
93
|
-
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub
|
|
94
|
+
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
94
95
|
- Enable Cloud Services for Device on SwitchBot App
|
|
95
96
|
- If using Bluetooth Low Energy (BLE) only:
|
|
96
97
|
- Must supply `deviceId` & `deviceName` to Device Config
|
|
97
98
|
- Check `Enable Bluetooth Low Energy (BLE) Connection` on Device Config
|
|
99
|
+
- [SwitchBot Blind Tilt](https://us.switch-bot.com/pages/switchbot-blind-tilt)
|
|
100
|
+
- Supports OpenAPI Connection Only
|
|
101
|
+
- If using OpenAPI:
|
|
102
|
+
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
103
|
+
- Enable Cloud Services for Device on SwitchBot App
|
|
98
104
|
- [SwitchBot Bulb](https://www.switch-bot.com/products/switchbot-color-bulb)
|
|
99
105
|
- [SwitchBot Ceiling Light](https://www.switchbot.jp/collections/all/products/switchbot-ceiling-light)
|
|
100
106
|
- [SwitchBot Ceiling Light Pro](https://www.switchbot.jp/collections/all/products/switchbot-ceiling-light)
|
|
101
107
|
- [SwitchBot Light Strip](https://www.switch-bot.com/products/switchbot-light-strip)
|
|
102
108
|
- Supports OpenAPI Connection Only
|
|
103
109
|
- If using OpenAPI:
|
|
104
|
-
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub
|
|
110
|
+
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
105
111
|
- Enable Cloud Services for Device on SwitchBot App
|
|
106
112
|
- [SwitchBot Lock](https://us.switch-bot.com/products/switchbot-lock)
|
|
107
113
|
- Supports OpenAPI Connection Only
|
|
108
114
|
- If using OpenAPI:
|
|
109
|
-
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub
|
|
115
|
+
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
110
116
|
- Enable Cloud Services for Device on SwitchBot App
|
|
111
117
|
- [SwitchBot Robot Vacuum Cleaner S1](https://www.switchbot.jp/products/switchbot-robot-vacuum-cleaner)
|
|
112
118
|
- [SwitchBot Robot Vacuum Cleaner S1 Plus](https://www.switchbot.jp/products/switchbot-robot-vacuum-cleaner)
|
|
@@ -116,12 +122,12 @@
|
|
|
116
122
|
- [SwitchBot Plug Mini (JP)](https://www.switchbot.jp/products/switchbot-plug-mini)
|
|
117
123
|
- Supports OpenAPI Connection Only
|
|
118
124
|
- If using OpenAPI:
|
|
119
|
-
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub
|
|
125
|
+
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
120
126
|
- Enable Cloud Services for Device on SwitchBot App
|
|
121
127
|
- [SwitchBot Bot](https://www.switch-bot.com/products/switchbot-bot)
|
|
122
128
|
- Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
|
|
123
129
|
- If using OpenAPI:
|
|
124
|
-
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub
|
|
130
|
+
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
125
131
|
- Enable Cloud Services for Device on SwitchBot App
|
|
126
132
|
- You must set your Bot's Device ID in the Press Mode or Switch Mode Bot Settings (Advanced Settings > Device Settings > Bot Settings)
|
|
127
133
|
- Press Mode - Turns on then instantly turn it off
|
|
@@ -131,10 +137,13 @@
|
|
|
131
137
|
- If using Bluetooth Low Energy (BLE) only:
|
|
132
138
|
- Must supply `deviceId` & `deviceName` to Device Config
|
|
133
139
|
- Check `Enable Bluetooth Low Energy (BLE) Connection` on Device Config
|
|
140
|
+
- [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2)
|
|
141
|
+
- Supports OpenAPI Connection Only
|
|
142
|
+
- Enables Humidity and Temperature Sensor
|
|
134
143
|
|
|
135
144
|
## Supported IR Devices
|
|
136
145
|
|
|
137
|
-
### _(All IR Devices require [Hub
|
|
146
|
+
### _(All IR Devices require [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) or [Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini))_
|
|
138
147
|
|
|
139
148
|
- TV
|
|
140
149
|
- Allows for On/Off and Volume Controls
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
3
|
import { Context } from 'vm';
|
|
5
4
|
import { MqttClient } from 'mqtt';
|
|
6
|
-
import { IncomingMessage } from 'http';
|
|
7
5
|
import { Subject } from 'rxjs';
|
|
8
6
|
import { SwitchBotPlatform } from '../platform';
|
|
9
7
|
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
@@ -107,9 +105,7 @@ export declare class BlindTilt {
|
|
|
107
105
|
minLux(): number;
|
|
108
106
|
maxLux(): number;
|
|
109
107
|
scan(device: device & devicesConfig): Promise<void>;
|
|
110
|
-
statusCode(
|
|
111
|
-
res: IncomingMessage;
|
|
112
|
-
}): Promise<void>;
|
|
108
|
+
statusCode(statusCode: number): Promise<void>;
|
|
113
109
|
offlineOff(): Promise<void>;
|
|
114
110
|
apiError(e: any): Promise<void>;
|
|
115
111
|
FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blindtilt.d.ts","sourceRoot":"","sources":["../../src/device/blindtilt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blindtilt.d.ts","sourceRoot":"","sources":["../../src/device/blindtilt.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAY,OAAO,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY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,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.BlindTilt = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const undici_1 = require("undici");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
const rxjs_1 = require("rxjs");
|
|
10
7
|
const async_mqtt_1 = require("async-mqtt");
|
|
11
|
-
const super_stringify_1 = __importDefault(require("super-stringify"));
|
|
12
8
|
const operators_1 = require("rxjs/operators");
|
|
13
9
|
const settings_1 = require("../settings");
|
|
14
|
-
const utils_1 = require("../utils");
|
|
15
10
|
var BlindTiltMappingMode;
|
|
16
11
|
(function (BlindTiltMappingMode) {
|
|
17
12
|
BlindTiltMappingMode["OnlyUp"] = "only_up";
|
|
@@ -165,7 +160,7 @@ class BlindTilt {
|
|
|
165
160
|
catch (e) {
|
|
166
161
|
this.apiError(e);
|
|
167
162
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,`
|
|
168
|
-
+ ` Error Message: ${
|
|
163
|
+
+ ` Error Message: ${JSON.stringify(e.message)}`);
|
|
169
164
|
}
|
|
170
165
|
this.blindTiltUpdateInProgress = false;
|
|
171
166
|
});
|
|
@@ -398,7 +393,7 @@ class BlindTilt {
|
|
|
398
393
|
this.inMotion = ad.serviceData.inMotion;
|
|
399
394
|
this.position = ad.serviceData.position;
|
|
400
395
|
this.lightLevel = ad.serviceData.lightLevel;
|
|
401
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${
|
|
396
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
402
397
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} calibration: ${ad.serviceData.calibration}, ` +
|
|
403
398
|
`position: ${ad.serviceData.position}, lightLevel: ${ad.serviceData.lightLevel}, battery: ${ad.serviceData.battery}, ` +
|
|
404
399
|
`inMotion: ${ad.serviceData.inMotion}`);
|
|
@@ -422,7 +417,7 @@ class BlindTilt {
|
|
|
422
417
|
.catch(async (e) => {
|
|
423
418
|
this.apiError(e);
|
|
424
419
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
425
|
-
+ ` Connection, Error Message: ${
|
|
420
|
+
+ ` Connection, Error Message: ${JSON.stringify(e.message)}`);
|
|
426
421
|
await this.BLERefreshConnection(switchbot);
|
|
427
422
|
});
|
|
428
423
|
}
|
|
@@ -433,57 +428,25 @@ class BlindTilt {
|
|
|
433
428
|
async openAPIRefreshStatus() {
|
|
434
429
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
435
430
|
try {
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
const data = this.platform.config.credentials?.token + t + nonce;
|
|
439
|
-
const signTerm = crypto_1.default.createHmac('sha256', this.platform.config.credentials?.secret).update(Buffer.from(data, 'utf-8')).digest();
|
|
440
|
-
const sign = signTerm.toString('base64');
|
|
441
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} sign: ${sign}`);
|
|
442
|
-
const options = {
|
|
443
|
-
hostname: settings_1.HostDomain,
|
|
444
|
-
port: 443,
|
|
445
|
-
path: `${settings_1.DevicePath}/${this.device.deviceId}/status`,
|
|
446
|
-
method: 'GET',
|
|
447
|
-
headers: {
|
|
448
|
-
Authorization: this.platform.config.credentials?.token,
|
|
449
|
-
sign: sign,
|
|
450
|
-
nonce: nonce,
|
|
451
|
-
t: t,
|
|
452
|
-
'Content-Type': 'application/json',
|
|
453
|
-
},
|
|
454
|
-
};
|
|
455
|
-
const req = https_1.default.request(options, (res) => {
|
|
456
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
|
|
457
|
-
let rawData = '';
|
|
458
|
-
res.on('data', (d) => {
|
|
459
|
-
rawData += d;
|
|
460
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} d: ${d}`);
|
|
461
|
-
});
|
|
462
|
-
res.on('end', () => {
|
|
463
|
-
try {
|
|
464
|
-
this.deviceStatus = JSON.parse(rawData);
|
|
465
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${(0, super_stringify_1.default)(this.deviceStatus)}`);
|
|
466
|
-
this.slidePosition = this.deviceStatus.body.slidePosition;
|
|
467
|
-
this.direction = this.deviceStatus.body.direction;
|
|
468
|
-
this.moving = this.deviceStatus.body.moving;
|
|
469
|
-
this.brightness = this.deviceStatus.body.brightness;
|
|
470
|
-
this.openAPIparseStatus();
|
|
471
|
-
this.updateHomeKitCharacteristics();
|
|
472
|
-
}
|
|
473
|
-
catch (e) {
|
|
474
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} error message: ${e.message}`);
|
|
475
|
-
}
|
|
476
|
-
});
|
|
431
|
+
const { body, statusCode, headers } = await (0, undici_1.request)(`${settings_1.Devices}/${this.device.deviceId}/status`, {
|
|
432
|
+
headers: this.platform.generateHeaders(),
|
|
477
433
|
});
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
434
|
+
const deviceStatus = await body.json();
|
|
435
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
|
|
436
|
+
this.statusCode(statusCode);
|
|
437
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
|
|
438
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
|
|
439
|
+
this.slidePosition = deviceStatus.body.slidePosition;
|
|
440
|
+
this.direction = deviceStatus.body.direction;
|
|
441
|
+
this.moving = deviceStatus.body.moving;
|
|
442
|
+
this.brightness = deviceStatus.body.brightness;
|
|
443
|
+
this.openAPIparseStatus();
|
|
444
|
+
this.updateHomeKitCharacteristics();
|
|
482
445
|
}
|
|
483
446
|
catch (e) {
|
|
484
447
|
this.apiError(e);
|
|
485
448
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIRefreshStatus with ${this.device.connectionType}`
|
|
486
|
-
+ ` Connection, Error Message: ${
|
|
449
|
+
+ ` Connection, Error Message: ${JSON.stringify(e.message)}`);
|
|
487
450
|
}
|
|
488
451
|
}
|
|
489
452
|
async pushChanges() {
|
|
@@ -543,7 +506,7 @@ class BlindTilt {
|
|
|
543
506
|
.catch(async (e) => {
|
|
544
507
|
this.apiError(e);
|
|
545
508
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}`
|
|
546
|
-
+ ` Connection, Error Message: ${
|
|
509
|
+
+ ` Connection, Error Message: ${JSON.stringify(e.message)}`);
|
|
547
510
|
await this.BLEPushConnection();
|
|
548
511
|
});
|
|
549
512
|
}
|
|
@@ -577,82 +540,54 @@ class BlindTilt {
|
|
|
577
540
|
}
|
|
578
541
|
}
|
|
579
542
|
async openAPIpushChanges() {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
const sign = signTerm.toString('base64');
|
|
593
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} sign: ${sign}`);
|
|
594
|
-
const [direction, position] = this.mapHomekitValuesToDeviceValues(Number(this.TargetPosition), Number(this.TargetHorizontalTiltAngle));
|
|
595
|
-
this.debugLog(`Pushing ${this.TargetPosition} (device = ${direction};${position})`);
|
|
596
|
-
this.debugLog(`${this.accessory.displayName} Mode: ${this.Mode}`);
|
|
597
|
-
let body = '';
|
|
598
|
-
if (position === 100) {
|
|
599
|
-
body = (0, super_stringify_1.default)({
|
|
600
|
-
'command': 'fullyOpen',
|
|
601
|
-
'commandType': 'command',
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
else if (position === 0) {
|
|
605
|
-
body = (0, super_stringify_1.default)({
|
|
606
|
-
'command': direction === 'up' ? 'closeUp' : 'closeDown',
|
|
607
|
-
'commandType': 'command',
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
else {
|
|
611
|
-
body = (0, super_stringify_1.default)({
|
|
612
|
-
'command': 'setPosition',
|
|
613
|
-
'parameter': `${direction};${position}`,
|
|
614
|
-
'commandType': 'command',
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${body},`);
|
|
618
|
-
const options = {
|
|
619
|
-
hostname: settings_1.HostDomain,
|
|
620
|
-
port: 443,
|
|
621
|
-
path: `${settings_1.DevicePath}/${this.device.deviceId}/commands`,
|
|
622
|
-
method: 'POST',
|
|
623
|
-
headers: {
|
|
624
|
-
'Authorization': this.platform.config.credentials?.token,
|
|
625
|
-
'sign': sign,
|
|
626
|
-
'nonce': nonce,
|
|
627
|
-
't': t,
|
|
628
|
-
'Content-Type': 'application/json',
|
|
629
|
-
'Content-Length': body.length,
|
|
630
|
-
},
|
|
631
|
-
};
|
|
632
|
-
const req = https_1.default.request(options, res => {
|
|
633
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIpushChanges statusCode: ${res.statusCode}`);
|
|
634
|
-
this.statusCode({ res });
|
|
635
|
-
res.on('data', d => {
|
|
636
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} d: ${d}`);
|
|
637
|
-
});
|
|
543
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} OpenAPI pushChanges`);
|
|
544
|
+
const hasDifferentAndRelevantHorizontalTiltAngle = (this.mappingMode === BlindTiltMappingMode.UseTiltForDirection
|
|
545
|
+
&& this.TargetHorizontalTiltAngle !== this.CurrentHorizontalTiltAngle);
|
|
546
|
+
if ((this.TargetPosition !== this.CurrentPosition) || hasDifferentAndRelevantHorizontalTiltAngle || this.device.disableCaching) {
|
|
547
|
+
const [direction, position] = this.mapHomekitValuesToDeviceValues(Number(this.TargetPosition), Number(this.TargetHorizontalTiltAngle));
|
|
548
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Pushing ${this.TargetPosition} (device = ${direction};${position})`);
|
|
549
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Mode: ${this.Mode}`);
|
|
550
|
+
let body = '';
|
|
551
|
+
if (position === 100) {
|
|
552
|
+
body = JSON.stringify({
|
|
553
|
+
'command': 'fullyOpen',
|
|
554
|
+
'commandType': 'command',
|
|
638
555
|
});
|
|
639
|
-
|
|
640
|
-
|
|
556
|
+
}
|
|
557
|
+
else if (position === 0) {
|
|
558
|
+
body = JSON.stringify({
|
|
559
|
+
'command': direction === 'up' ? 'closeUp' : 'closeDown',
|
|
560
|
+
'commandType': 'command',
|
|
641
561
|
});
|
|
642
|
-
req.write(body);
|
|
643
|
-
req.end();
|
|
644
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIpushChanges: ${(0, super_stringify_1.default)(req)}`);
|
|
645
562
|
}
|
|
646
563
|
else {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
564
|
+
body = JSON.stringify({
|
|
565
|
+
'command': 'setPosition',
|
|
566
|
+
'parameter': `${direction};${position}`,
|
|
567
|
+
'commandType': 'command',
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${body},`);
|
|
571
|
+
try {
|
|
572
|
+
const { body, statusCode, headers } = await (0, undici_1.request)(`${settings_1.Devices}/${this.device.deviceId}/commands`, {
|
|
573
|
+
method: 'POST',
|
|
574
|
+
headers: this.platform.generateHeaders(),
|
|
575
|
+
});
|
|
576
|
+
const deviceStatus = await body.json();
|
|
577
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
|
|
578
|
+
this.statusCode(statusCode);
|
|
579
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
|
|
580
|
+
}
|
|
581
|
+
catch (e) {
|
|
582
|
+
this.apiError(e);
|
|
583
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIpushChanges with ${this.device.connectionType}`
|
|
584
|
+
+ ` Connection, Error Message: ${JSON.stringify(e.message)}`);
|
|
650
585
|
}
|
|
651
586
|
}
|
|
652
|
-
|
|
653
|
-
this.
|
|
654
|
-
|
|
655
|
-
+ `
|
|
587
|
+
else {
|
|
588
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No OpenAPI Changes, CurrentPosition & TargetPosition Are the Same.`
|
|
589
|
+
+ ` CurrentPosition: ${this.CurrentPosition}, TargetPosition ${this.TargetPosition}`
|
|
590
|
+
+ ` CurrentHorizontalTiltAngle: ${this.CurrentHorizontalTiltAngle}, TargetPosition ${this.TargetHorizontalTiltAngle}`);
|
|
656
591
|
}
|
|
657
592
|
}
|
|
658
593
|
/**
|
|
@@ -824,7 +759,7 @@ class BlindTilt {
|
|
|
824
759
|
?.join(':');
|
|
825
760
|
const options = this.device.mqttPubOptions || {};
|
|
826
761
|
this.mqttClient?.publish(`homebridge-switchbot/blindtilt/${mac}/${topic}`, `${message}`, options);
|
|
827
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} MQTT message: ${topic}/${message} options:${
|
|
762
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} MQTT message: ${topic}/${message} options:${JSON.stringify(options)}`);
|
|
828
763
|
}
|
|
829
764
|
/*
|
|
830
765
|
* Setup MQTT hadler if URL is specifed.
|
|
@@ -863,7 +798,7 @@ class BlindTilt {
|
|
|
863
798
|
});
|
|
864
799
|
// Set an event handler
|
|
865
800
|
switchbot.onadvertisement = (ad) => {
|
|
866
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} ad: ${
|
|
801
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
867
802
|
};
|
|
868
803
|
await (0, utils_1.sleep)(10000);
|
|
869
804
|
// Stop to monitor
|
|
@@ -976,34 +911,39 @@ class BlindTilt {
|
|
|
976
911
|
}
|
|
977
912
|
}
|
|
978
913
|
}
|
|
979
|
-
async statusCode(
|
|
980
|
-
switch (
|
|
914
|
+
async statusCode(statusCode) {
|
|
915
|
+
switch (statusCode) {
|
|
981
916
|
case 151:
|
|
982
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Command not supported by this
|
|
917
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Command not supported by this deviceType, statusCode: ${statusCode}`);
|
|
983
918
|
break;
|
|
984
919
|
case 152:
|
|
985
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device not found
|
|
920
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device not found, statusCode: ${statusCode}`);
|
|
986
921
|
break;
|
|
987
922
|
case 160:
|
|
988
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Command is not supported
|
|
923
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Command is not supported, statusCode: ${statusCode}`);
|
|
989
924
|
break;
|
|
990
925
|
case 161:
|
|
991
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device is offline
|
|
926
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device is offline, statusCode: ${statusCode}`);
|
|
992
927
|
this.offlineOff();
|
|
993
928
|
break;
|
|
994
929
|
case 171:
|
|
995
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Hub Device is offline
|
|
930
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. `
|
|
931
|
+
+ `Hub: ${this.device.hubDeviceId}`);
|
|
996
932
|
this.offlineOff();
|
|
997
933
|
break;
|
|
998
934
|
case 190:
|
|
999
935
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
|
|
1000
|
-
` Or command
|
|
936
|
+
` Or command format is invalid, statusCode: ${statusCode}`);
|
|
1001
937
|
break;
|
|
1002
938
|
case 100:
|
|
1003
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Command successfully sent
|
|
939
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Command successfully sent, statusCode: ${statusCode}`);
|
|
940
|
+
break;
|
|
941
|
+
case 200:
|
|
942
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
|
|
1004
943
|
break;
|
|
1005
944
|
default:
|
|
1006
|
-
this.
|
|
945
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode: `
|
|
946
|
+
+ `${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
|
|
1007
947
|
}
|
|
1008
948
|
}
|
|
1009
949
|
async offlineOff() {
|
|
@@ -1229,7 +1169,7 @@ class BlindTilt {
|
|
|
1229
1169
|
config['mode'] = device.blindTilt?.mode;
|
|
1230
1170
|
}
|
|
1231
1171
|
if (Object.entries(config).length !== 0) {
|
|
1232
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${
|
|
1172
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
1233
1173
|
}
|
|
1234
1174
|
}
|
|
1235
1175
|
async logs(device) {
|