@switchbot/homebridge-switchbot 1.4.1-beta.1 → 1.4.1-beta.2
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 +14 -0
- package/config.schema.json +82 -10
- package/dist/devices/bots.d.ts +12 -2
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +140 -89
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.d.ts +12 -2
- package/dist/devices/colorbulb.d.ts.map +1 -1
- package/dist/devices/colorbulb.js +138 -84
- package/dist/devices/colorbulb.js.map +1 -1
- package/dist/devices/contact.d.ts +12 -2
- package/dist/devices/contact.d.ts.map +1 -1
- package/dist/devices/contact.js +101 -52
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/curtains.d.ts +13 -4
- package/dist/devices/curtains.d.ts.map +1 -1
- package/dist/devices/curtains.js +173 -124
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.d.ts +12 -2
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +156 -108
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/meters.d.ts +12 -2
- package/dist/devices/meters.d.ts.map +1 -1
- package/dist/devices/meters.js +98 -49
- package/dist/devices/meters.js.map +1 -1
- package/dist/devices/motion.d.ts +12 -2
- package/dist/devices/motion.d.ts.map +1 -1
- package/dist/devices/motion.js +86 -37
- package/dist/devices/motion.js.map +1 -1
- package/dist/devices/plugs.d.ts +12 -2
- package/dist/devices/plugs.d.ts.map +1 -1
- package/dist/devices/plugs.js +80 -31
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.d.ts +10 -2
- package/dist/irdevices/airconditioners.d.ts.map +1 -1
- package/dist/irdevices/airconditioners.js +77 -37
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.d.ts +10 -2
- package/dist/irdevices/airpurifiers.d.ts.map +1 -1
- package/dist/irdevices/airpurifiers.js +65 -25
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.d.ts +10 -2
- package/dist/irdevices/cameras.d.ts.map +1 -1
- package/dist/irdevices/cameras.js +61 -21
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.d.ts +10 -2
- package/dist/irdevices/fans.d.ts.map +1 -1
- package/dist/irdevices/fans.js +71 -30
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.d.ts +10 -2
- package/dist/irdevices/lights.d.ts.map +1 -1
- package/dist/irdevices/lights.js +62 -22
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.d.ts +10 -2
- package/dist/irdevices/others.d.ts.map +1 -1
- package/dist/irdevices/others.js +68 -28
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.d.ts +10 -2
- package/dist/irdevices/tvs.d.ts.map +1 -1
- package/dist/irdevices/tvs.js +78 -38
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.d.ts +10 -2
- package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +61 -21
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.d.ts +10 -2
- package/dist/irdevices/waterheaters.d.ts.map +1 -1
- package/dist/irdevices/waterheaters.js +61 -21
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/dist/platform.d.ts +9 -10
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +264 -285
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +4 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/nodemon.json +1 -1
- package/package.json +1 -1
- package/src/devices/bots.ts +146 -89
- package/src/devices/colorbulb.ts +146 -86
- package/src/devices/contact.ts +107 -52
- package/src/devices/curtains.ts +182 -129
- package/src/devices/humidifiers.ts +162 -109
- package/src/devices/meters.ts +104 -49
- package/src/devices/motion.ts +91 -36
- package/src/devices/plugs.ts +84 -31
- package/src/irdevices/airconditioners.ts +81 -36
- package/src/irdevices/airpurifiers.ts +69 -24
- package/src/irdevices/cameras.ts +65 -20
- package/src/irdevices/fans.ts +75 -30
- package/src/irdevices/lights.ts +66 -21
- package/src/irdevices/others.ts +72 -27
- package/src/irdevices/tvs.ts +82 -37
- package/src/irdevices/vacuumcleaners.ts +65 -20
- package/src/irdevices/waterheaters.ts +65 -20
- package/src/platform.ts +267 -290
- package/src/settings.ts +4 -1
- package/dist/devices/indoorcam.d.ts +0 -64
- package/dist/devices/indoorcam.d.ts.map +0 -1
- package/dist/devices/indoorcam.js +0 -249
- package/dist/devices/indoorcam.js.map +0 -1
- package/src/devices/indoorcam.ts +0 -309
|
@@ -12,10 +12,8 @@ class WaterHeater {
|
|
|
12
12
|
this.platform = platform;
|
|
13
13
|
this.accessory = accessory;
|
|
14
14
|
this.device = device;
|
|
15
|
-
// Config
|
|
16
|
-
this.deviceDebug = this.platform.config.options?.debug === 'device' || this.platform.debugMode;
|
|
17
|
-
this.debugDebug = this.platform.config.options?.debug === 'debug' || this.platform.debugMode;
|
|
18
15
|
// default placeholders
|
|
16
|
+
this.logs();
|
|
19
17
|
if (this.Active === undefined) {
|
|
20
18
|
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
21
19
|
}
|
|
@@ -44,8 +42,19 @@ class WaterHeater {
|
|
|
44
42
|
// handle on / off events using the Active characteristic
|
|
45
43
|
this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
|
|
46
44
|
}
|
|
45
|
+
logs() {
|
|
46
|
+
if (this.device.logging) {
|
|
47
|
+
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
48
|
+
}
|
|
49
|
+
else if (this.platform.config.options?.logging) {
|
|
50
|
+
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
47
56
|
ActiveSet(value) {
|
|
48
|
-
this.
|
|
57
|
+
this.debugLog(`Water Heater: ${this.accessory.displayName} Active: ${value}`);
|
|
49
58
|
if (value === this.platform.Characteristic.Active.INACTIVE) {
|
|
50
59
|
this.pushWaterHeaterOffChanges();
|
|
51
60
|
this.service.setCharacteristic(this.platform.Characteristic.InUse, this.platform.Characteristic.InUse.NOT_IN_USE);
|
|
@@ -60,11 +69,11 @@ class WaterHeater {
|
|
|
60
69
|
}
|
|
61
70
|
updateHomeKitCharacteristics() {
|
|
62
71
|
if (this.Active === undefined) {
|
|
63
|
-
this.
|
|
72
|
+
this.debugLog(`Water Heater: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
64
73
|
}
|
|
65
74
|
else {
|
|
66
75
|
this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
67
|
-
this.
|
|
76
|
+
this.debugLog(`Water Heater: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
68
77
|
}
|
|
69
78
|
}
|
|
70
79
|
/**
|
|
@@ -99,22 +108,22 @@ class WaterHeater {
|
|
|
99
108
|
}
|
|
100
109
|
async pushChanges(payload) {
|
|
101
110
|
try {
|
|
102
|
-
this.
|
|
111
|
+
this.infoLog(`Water Heater: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},`
|
|
103
112
|
+ ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
|
|
104
113
|
// Make the API request
|
|
105
114
|
const push = await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
106
|
-
this.
|
|
115
|
+
this.debugLog(`Water Heater: ${this.accessory.displayName} pushChanges: ${push.data}`);
|
|
107
116
|
this.statusCode(push);
|
|
108
117
|
this.updateHomeKitCharacteristics();
|
|
109
118
|
}
|
|
110
119
|
catch (e) {
|
|
111
|
-
this.
|
|
112
|
-
if (this.
|
|
113
|
-
this.
|
|
120
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
121
|
+
if (this.deviceLogging === 'debug') {
|
|
122
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
114
123
|
+ ` Error Message: ${JSON.stringify(e.message)}`);
|
|
115
124
|
}
|
|
116
|
-
if (this.
|
|
117
|
-
this.
|
|
125
|
+
if (this.platform.debugMode) {
|
|
126
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
118
127
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
119
128
|
}
|
|
120
129
|
this.apiError();
|
|
@@ -123,34 +132,65 @@ class WaterHeater {
|
|
|
123
132
|
statusCode(push) {
|
|
124
133
|
switch (push.data.statusCode) {
|
|
125
134
|
case 151:
|
|
126
|
-
this.
|
|
135
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} Command not supported by this device type.`);
|
|
127
136
|
break;
|
|
128
137
|
case 152:
|
|
129
|
-
this.
|
|
138
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} Device not found.`);
|
|
130
139
|
break;
|
|
131
140
|
case 160:
|
|
132
|
-
this.
|
|
141
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} Command is not supported.`);
|
|
133
142
|
break;
|
|
134
143
|
case 161:
|
|
135
|
-
this.
|
|
144
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} Device is offline.`);
|
|
136
145
|
break;
|
|
137
146
|
case 171:
|
|
138
|
-
this.
|
|
147
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
|
|
139
148
|
break;
|
|
140
149
|
case 190:
|
|
141
|
-
this.
|
|
150
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} Device internal error due to device states not synchronized`
|
|
142
151
|
+ ` with server, Or command: ${JSON.stringify(push.data)} format is invalid`);
|
|
143
152
|
break;
|
|
144
153
|
case 100:
|
|
145
|
-
this.
|
|
154
|
+
this.debugLog(`Water Heater: ${this.accessory.displayName} Command successfully sent.`);
|
|
146
155
|
break;
|
|
147
156
|
default:
|
|
148
|
-
this.
|
|
157
|
+
this.debugLog(`Water Heater: ${this.accessory.displayName} Unknown statusCode.`);
|
|
149
158
|
}
|
|
150
159
|
}
|
|
151
160
|
apiError() {
|
|
152
161
|
throw new this.platform.api.hap.HapStatusError(-70402 /* SERVICE_COMMUNICATION_FAILURE */);
|
|
153
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Logging for Device
|
|
165
|
+
*/
|
|
166
|
+
infoLog(...log) {
|
|
167
|
+
if (this.enablingDeviceLogging()) {
|
|
168
|
+
this.platform.log.info(String(...log));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
warnLog(...log) {
|
|
172
|
+
if (this.enablingDeviceLogging()) {
|
|
173
|
+
this.platform.log.warn(String(...log));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
errorLog(...log) {
|
|
177
|
+
if (this.enablingDeviceLogging()) {
|
|
178
|
+
this.platform.log.error(String(...log));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
debugLog(...log) {
|
|
182
|
+
if (this.enablingDeviceLogging()) {
|
|
183
|
+
if (this.deviceLogging === 'debug') {
|
|
184
|
+
this.platform.log.info('[DEBUG]', String(...log));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
this.platform.log.debug(String(...log));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
enablingDeviceLogging() {
|
|
192
|
+
return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
|
|
193
|
+
}
|
|
154
194
|
}
|
|
155
195
|
exports.WaterHeater = WaterHeater;
|
|
156
196
|
//# sourceMappingURL=waterheaters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waterheaters.js","sourceRoot":"","sources":["../../src/irdevices/waterheaters.ts"],"names":[],"mappings":";;;AAEA,0CAA4E;AAG5E;;;;GAIG;AACH,MAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"waterheaters.js","sourceRoot":"","sources":["../../src/irdevices/waterheaters.ts"],"names":[],"mappings":";;;AAEA,0CAA4E;AAG5E;;;;GAIG;AACH,MAAa,WAAW;IAWtB,YACmB,QAA2B,EACpC,SAA4B,EAC7B,MAAkC;QAFxB,aAAQ,GAAR,QAAQ,CAAmB;QACpC,cAAS,GAAT,SAAS,CAAmB;QAC7B,WAAM,GAAN,MAAM,CAA4B;QAEzC,uBAAuB;QACvB,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;YAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC;SAC5D;aAAM;YACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;SAC7C;QAED,4BAA4B;QAC5B,SAAS;aACN,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAE;aACvD,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,YAAY,EAAE,WAAW,CAAC;aACzE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;aACxE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,YAAY,EAAE,MAAM,CAAC,QAAS,CAAC,CAAC;QAElF,qFAAqF;QACrF,sDAAsD;QACtD,CAAC,IAAI,CAAC,OAAO;YACX,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;gBACjD,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,OAA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AC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;aACnD;iBAAM;gBACL,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;aACzC;SACF;IACH,CAAC;IAED,qBAAqB;QACnB,OAAO,IAAI,CAAC,aAAa,KAAK,OAAO,IAAI,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC;IAC7E,CAAC;CACF;AAzND,kCAyNC"}
|
package/dist/platform.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ export declare class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
18
18
|
deviceStatus: deviceResponses;
|
|
19
19
|
registeringDevice: boolean;
|
|
20
20
|
debugMode: boolean;
|
|
21
|
+
platformLogging?: string;
|
|
21
22
|
constructor(log: Logger, config: SwitchBotPlatformConfig, api: API);
|
|
23
|
+
logs(): void;
|
|
22
24
|
/**
|
|
23
25
|
* This function is invoked when homebridge restores cached accessories from disk at startup.
|
|
24
26
|
* It should be used to setup event handlers for characteristics and update respective values.
|
|
@@ -45,7 +47,6 @@ export declare class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
45
47
|
private isCurtainGrouped;
|
|
46
48
|
private createPlug;
|
|
47
49
|
private createColorBulb;
|
|
48
|
-
private createIndoorCam;
|
|
49
50
|
private createTV;
|
|
50
51
|
private createFan;
|
|
51
52
|
private createLight;
|
|
@@ -57,21 +58,19 @@ export declare class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
57
58
|
private createOthers;
|
|
58
59
|
connectionTypeNewAccessory(device: device & devicesConfig, accessory: PlatformAccessory): Promise<void>;
|
|
59
60
|
connectionTypeExistingAccessory(device: device & devicesConfig, existingAccessory: PlatformAccessory): Promise<void>;
|
|
60
|
-
connectionTypeNewIRAccessory(
|
|
61
|
-
connectionTypeExistingIRAccessory(
|
|
61
|
+
connectionTypeNewIRAccessory(accessory: PlatformAccessory): Promise<void>;
|
|
62
|
+
connectionTypeExistingIRAccessory(existingAccessory: PlatformAccessory): Promise<void>;
|
|
62
63
|
unregisterPlatformAccessories(existingAccessory: PlatformAccessory): void;
|
|
63
64
|
deviceListInfo(devices: deviceResponses): void;
|
|
64
65
|
deviceInfo(device: irdevice & devicesConfig | device & devicesConfig): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* If debug level logging is turned on, log to log.info
|
|
67
|
-
* Otherwise send debug logs to log.debug
|
|
68
|
-
* this.debugMode = process.argv.includes('-D') || process.argv.includes('--debug');
|
|
69
|
-
*/
|
|
70
|
-
debug(...log: any[]): void;
|
|
71
66
|
/**
|
|
72
67
|
* If device level logging is turned on, log to log.warn
|
|
73
68
|
* Otherwise send debug logs to log.debug
|
|
74
69
|
*/
|
|
75
|
-
|
|
70
|
+
infoLog(...log: any[]): void;
|
|
71
|
+
warnLog(...log: any[]): void;
|
|
72
|
+
errorLog(...log: any[]): void;
|
|
73
|
+
debugLog(...log: any[]): void;
|
|
74
|
+
enablingPlatfromLogging(): boolean;
|
|
76
75
|
}
|
|
77
76
|
//# sourceMappingURL=platform.d.ts.map
|
package/dist/platform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAkBA,OAAc,EAAE,aAAa,EAAsB,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5G,OAAO,EAAyC,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9I;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW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