@switchbot/homebridge-switchbot 3.7.1-beta.3 → 3.7.1-beta.4
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/CHANGELOG.md +8 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +25 -6
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +25 -6
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +25 -6
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +25 -6
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +25 -6
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +25 -6
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +25 -6
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +25 -6
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +25 -6
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +25 -6
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +25 -6
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +25 -6
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +25 -6
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +25 -6
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +25 -6
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +25 -6
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +25 -6
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +25 -6
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +22 -3
- package/dist/platform.js.map +1 -1
- package/package.json +6 -6
- package/src/device/blindtilt.ts +22 -6
- package/src/device/bot.ts +22 -6
- package/src/device/ceilinglight.ts +22 -6
- package/src/device/colorbulb.ts +22 -6
- package/src/device/contact.ts +22 -6
- package/src/device/curtain.ts +23 -6
- package/src/device/fan.ts +22 -6
- package/src/device/hub.ts +22 -6
- package/src/device/humidifier.ts +22 -6
- package/src/device/iosensor.ts +22 -6
- package/src/device/lightstrip.ts +22 -6
- package/src/device/lock.ts +22 -6
- package/src/device/meter.ts +22 -6
- package/src/device/meterplus.ts +22 -6
- package/src/device/motion.ts +22 -6
- package/src/device/plug.ts +22 -6
- package/src/device/robotvacuumcleaner.ts +22 -6
- package/src/device/waterdetector.ts +22 -6
- package/src/platform.ts +19 -3
package/src/device/meterplus.ts
CHANGED
|
@@ -6,6 +6,10 @@ import { Units } from 'homebridge';
|
|
|
6
6
|
import { deviceBase } from './device.js';
|
|
7
7
|
import { Subject, interval, skipWhile } from 'rxjs';
|
|
8
8
|
import { convertUnits, validHumidity } from '../utils.js';
|
|
9
|
+
/*
|
|
10
|
+
* For Testing Locally:
|
|
11
|
+
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
12
|
+
*/
|
|
9
13
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
|
|
10
14
|
|
|
11
15
|
import type { devicesConfig } from '../settings.js';
|
|
@@ -153,16 +157,28 @@ export class MeterPlus extends deviceBase {
|
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
// Retrieve initial values and updateHomekit
|
|
156
|
-
|
|
157
|
-
|
|
160
|
+
try {
|
|
161
|
+
this.debugLog('Retrieve initial values and update Homekit');
|
|
162
|
+
this.refreshStatus();
|
|
163
|
+
} catch (e: any) {
|
|
164
|
+
this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
|
|
165
|
+
}
|
|
158
166
|
|
|
159
167
|
//regisiter webhook event handler if enabled
|
|
160
|
-
|
|
161
|
-
|
|
168
|
+
try {
|
|
169
|
+
this.debugLog('Registering Webhook Event Handler');
|
|
170
|
+
this.registerWebhook();
|
|
171
|
+
} catch (e: any) {
|
|
172
|
+
this.errorLog(`failed to registerWebhook, Error: ${e}`);
|
|
173
|
+
}
|
|
162
174
|
|
|
163
175
|
//regisiter platform BLE event handler if enabled
|
|
164
|
-
|
|
165
|
-
|
|
176
|
+
try {
|
|
177
|
+
this.debugLog('Registering Platform BLE Event Handler');
|
|
178
|
+
this.registerPlatformBLE();
|
|
179
|
+
} catch (e: any) {
|
|
180
|
+
this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
|
|
181
|
+
}
|
|
166
182
|
|
|
167
183
|
// Start an update interval
|
|
168
184
|
interval(this.deviceRefreshRate * 1000)
|
package/src/device/motion.ts
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { deviceBase } from './device.js';
|
|
7
7
|
import { Subject, interval, skipWhile } from 'rxjs';
|
|
8
|
+
/*
|
|
9
|
+
* For Testing Locally:
|
|
10
|
+
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
11
|
+
*/
|
|
8
12
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
|
|
9
13
|
|
|
10
14
|
import type { devicesConfig } from '../settings.js';
|
|
@@ -138,16 +142,28 @@ export class Motion extends deviceBase {
|
|
|
138
142
|
};
|
|
139
143
|
|
|
140
144
|
// Retrieve initial values and updateHomekit
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
try {
|
|
146
|
+
this.debugLog('Retrieve initial values and update Homekit');
|
|
147
|
+
this.refreshStatus();
|
|
148
|
+
} catch (e: any) {
|
|
149
|
+
this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
|
|
150
|
+
}
|
|
143
151
|
|
|
144
152
|
//regisiter webhook event handler if enabled
|
|
145
|
-
|
|
146
|
-
|
|
153
|
+
try {
|
|
154
|
+
this.debugLog('Registering Webhook Event Handler');
|
|
155
|
+
this.registerWebhook();
|
|
156
|
+
} catch (e: any) {
|
|
157
|
+
this.errorLog(`failed to registerWebhook, Error: ${e}`);
|
|
158
|
+
}
|
|
147
159
|
|
|
148
160
|
//regisiter platform BLE event handler if enabled
|
|
149
|
-
|
|
150
|
-
|
|
161
|
+
try {
|
|
162
|
+
this.debugLog('Registering Platform BLE Event Handler');
|
|
163
|
+
this.registerPlatformBLE();
|
|
164
|
+
} catch (e: any) {
|
|
165
|
+
this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
|
|
166
|
+
}
|
|
151
167
|
|
|
152
168
|
// Start an update interval
|
|
153
169
|
interval(this.deviceRefreshRate * 1000)
|
package/src/device/plug.ts
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* plug.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import { deviceBase } from './device.js';
|
|
6
|
+
/*
|
|
7
|
+
* For Testing Locally:
|
|
8
|
+
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
9
|
+
*/
|
|
6
10
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
|
|
7
11
|
import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
|
|
8
12
|
|
|
@@ -66,16 +70,28 @@ export class Plug extends deviceBase {
|
|
|
66
70
|
.onSet(this.OnSet.bind(this));
|
|
67
71
|
|
|
68
72
|
// Retrieve initial values and updateHomekit
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
try {
|
|
74
|
+
this.debugLog('Retrieve initial values and update Homekit');
|
|
75
|
+
this.refreshStatus();
|
|
76
|
+
} catch (e: any) {
|
|
77
|
+
this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
|
|
78
|
+
}
|
|
71
79
|
|
|
72
80
|
//regisiter webhook event handler if enabled
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
try {
|
|
82
|
+
this.debugLog('Registering Webhook Event Handler');
|
|
83
|
+
this.registerWebhook();
|
|
84
|
+
} catch (e: any) {
|
|
85
|
+
this.errorLog(`failed to registerWebhook, Error: ${e}`);
|
|
86
|
+
}
|
|
75
87
|
|
|
76
88
|
//regisiter platform BLE event handler if enabled
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
try {
|
|
90
|
+
this.debugLog('Registering Platform BLE Event Handler');
|
|
91
|
+
this.registerPlatformBLE();
|
|
92
|
+
} catch (e: any) {
|
|
93
|
+
this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
|
|
94
|
+
}
|
|
79
95
|
|
|
80
96
|
// Start an update interval
|
|
81
97
|
interval(this.deviceRefreshRate * 1000)
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* robotvacuumcleaner.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import { deviceBase } from './device.js';
|
|
6
|
+
/*
|
|
7
|
+
* For Testing Locally:
|
|
8
|
+
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
9
|
+
*/
|
|
6
10
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
|
|
7
11
|
import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
|
|
8
12
|
|
|
@@ -127,16 +131,28 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
127
131
|
});
|
|
128
132
|
|
|
129
133
|
// Retrieve initial values and updateHomekit
|
|
130
|
-
|
|
131
|
-
|
|
134
|
+
try {
|
|
135
|
+
this.debugLog('Retrieve initial values and update Homekit');
|
|
136
|
+
this.refreshStatus();
|
|
137
|
+
} catch (e: any) {
|
|
138
|
+
this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
|
|
139
|
+
}
|
|
132
140
|
|
|
133
141
|
//regisiter webhook event handler if enabled
|
|
134
|
-
|
|
135
|
-
|
|
142
|
+
try {
|
|
143
|
+
this.debugLog('Registering Webhook Event Handler');
|
|
144
|
+
this.registerWebhook();
|
|
145
|
+
} catch (e: any) {
|
|
146
|
+
this.errorLog(`failed to registerWebhook, Error: ${e}`);
|
|
147
|
+
}
|
|
136
148
|
|
|
137
149
|
//regisiter platform BLE event handler if enabled
|
|
138
|
-
|
|
139
|
-
|
|
150
|
+
try {
|
|
151
|
+
this.debugLog('Registering Platform BLE Event Handler');
|
|
152
|
+
this.registerPlatformBLE();
|
|
153
|
+
} catch (e: any) {
|
|
154
|
+
this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
|
|
155
|
+
}
|
|
140
156
|
|
|
141
157
|
// Start an update interval
|
|
142
158
|
interval(this.deviceRefreshRate * 1000)
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { deviceBase } from './device.js';
|
|
6
6
|
import { Subject, interval, skipWhile } from 'rxjs';
|
|
7
|
+
/*
|
|
8
|
+
* For Testing Locally:
|
|
9
|
+
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
10
|
+
*/
|
|
7
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
|
|
8
12
|
|
|
9
13
|
import type { devicesConfig } from '../settings.js';
|
|
@@ -118,16 +122,28 @@ export class WaterDetector extends deviceBase {
|
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
// Retrieve initial values and updateHomekit
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
try {
|
|
126
|
+
this.debugLog('Retrieve initial values and update Homekit');
|
|
127
|
+
this.refreshStatus();
|
|
128
|
+
} catch (e: any) {
|
|
129
|
+
this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
|
|
130
|
+
}
|
|
123
131
|
|
|
124
132
|
//regisiter webhook event handler if enabled
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
try {
|
|
134
|
+
this.debugLog('Registering Webhook Event Handler');
|
|
135
|
+
this.registerWebhook();
|
|
136
|
+
} catch (e: any) {
|
|
137
|
+
this.errorLog(`failed to registerWebhook, Error: ${e}`);
|
|
138
|
+
}
|
|
127
139
|
|
|
128
140
|
//regisiter platform BLE event handler if enabled
|
|
129
|
-
|
|
130
|
-
|
|
141
|
+
try {
|
|
142
|
+
this.debugLog('Registering Platform BLE Event Handler');
|
|
143
|
+
this.registerPlatformBLE();
|
|
144
|
+
} catch (e: any) {
|
|
145
|
+
this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
|
|
146
|
+
}
|
|
131
147
|
|
|
132
148
|
// Start an update interval
|
|
133
149
|
interval(this.deviceRefreshRate * 1000)
|
package/src/platform.ts
CHANGED
|
@@ -51,6 +51,10 @@ import type { blindTilt, curtain, curtain3, device } from './types/devicelist.js
|
|
|
51
51
|
import type { API, DynamicPlatformPlugin, Logging, PlatformAccessory } from 'homebridge';
|
|
52
52
|
import type { SwitchBotPlatformConfig, devicesConfig, irDevicesConfig } from './settings.js';
|
|
53
53
|
import type { IncomingMessage, Server, ServerResponse } from 'http';
|
|
54
|
+
/*
|
|
55
|
+
* For Testing Locally:
|
|
56
|
+
* import { SwitchBotModel } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
57
|
+
*/
|
|
54
58
|
import { SwitchBotModel } from 'node-switchbot';
|
|
55
59
|
|
|
56
60
|
/**
|
|
@@ -147,9 +151,21 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
147
151
|
}
|
|
148
152
|
});
|
|
149
153
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
try {
|
|
155
|
+
this.setupMqtt();
|
|
156
|
+
} catch (e: any) {
|
|
157
|
+
this.errorLog(`Setup MQTT, Error Message: ${e.message}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
this.setupwebhook();
|
|
161
|
+
} catch (e: any) {
|
|
162
|
+
this.errorLog(`Setup Webhook, Error Message: ${e.message}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
this.setupBlE();
|
|
166
|
+
} catch (e: any) {
|
|
167
|
+
this.errorLog(`Setup Platform BLE, Error Message: ${e.message}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
|
|
168
|
+
}
|
|
153
169
|
}
|
|
154
170
|
|
|
155
171
|
async setupMqtt(): Promise<void> {
|