@switchbot/homebridge-switchbot 1.15.1-beta.9 → 2.0.0-beta.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/.github/Old Releaser.zip +0 -0
- package/.github/npm-version-script.js +81 -0
- package/.github/workflows/beta-release.yml +31 -0
- package/.github/workflows/build.yml +18 -0
- package/.github/workflows/codeql-analysis.yml +5 -63
- package/.github/workflows/label.yml +2 -2
- package/.github/workflows/release-drafter.yml +14 -0
- package/.github/workflows/release.yml +24 -0
- package/.github/workflows/stale.yml +6 -22
- package/README.md +10 -3
- package/dist/device/bot.js +1 -1
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +1 -0
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +33 -7
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.js +1 -1
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +8 -2
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.js +1 -1
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/meter.js +1 -1
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.js +1 -1
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.js +1 -1
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.js +1 -1
- package/dist/device/plug.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +35 -32
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +30 -28
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +28 -26
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +47 -45
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +40 -38
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +28 -26
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +82 -80
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +24 -22
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +28 -26
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +79 -79
- package/src/device/bot.ts +1 -1
- package/src/device/colorbulb.ts +33 -9
- package/src/device/contact.ts +1 -1
- package/src/device/curtain.ts +8 -2
- package/src/device/humidifier.ts +1 -1
- package/src/device/meter.ts +1 -1
- package/src/device/meterplus.ts +1 -1
- package/src/device/motion.ts +1 -1
- package/src/device/plug.ts +1 -1
- package/src/irdevice/airconditioner.ts +35 -40
- package/src/irdevice/airpurifier.ts +30 -37
- package/src/irdevice/camera.ts +28 -33
- package/src/irdevice/fan.ts +47 -52
- package/src/irdevice/light.ts +40 -45
- package/src/irdevice/other.ts +28 -33
- package/src/irdevice/tv.ts +82 -87
- package/src/irdevice/vacuumcleaner.ts +24 -29
- package/src/irdevice/waterheater.ts +28 -33
- package/.github/workflows/nodejs-beta.yml +0 -42
- package/.github/workflows/nodejs.yml +0 -47
- package/.github/workflows/prerelease-beta.js +0 -34
|
@@ -31,7 +31,7 @@ export declare class WaterHeater {
|
|
|
31
31
|
*/
|
|
32
32
|
pushWaterHeaterOnChanges(): Promise<void>;
|
|
33
33
|
pushWaterHeaterOffChanges(): Promise<void>;
|
|
34
|
-
pushChanges(
|
|
34
|
+
pushChanges(body: any): Promise<void>;
|
|
35
35
|
statusCode({ res }: {
|
|
36
36
|
res: IncomingMessage;
|
|
37
37
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waterheater.d.ts","sourceRoot":"","sources":["../../src/irdevice/waterheater.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAA0B,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE7E;;;;GAIG;AACH,qBAAa,WAAW;IAWV,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAqB,OAAO,CAAC,SAAS;IAA4B,MAAM,EAAE,QAAQ,GAAG,eAAe;IATzI,YAAY,EAAG,OAAO,CAAC;IAGvB,MAAM,EAAG,mBAAmB,CAAC;IAC7B,YAAY,EAAG,mBAAmB,CAAC;IAGnC,aAAa,EAAG,MAAM,CAAC;gBAEM,QAAQ,EAAE,iBAAiB,EAAU,SAAS,EAAE,iBAAiB,EAAS,MAAM,EAAE,QAAQ,GAAG,eAAe;IAqCnI,SAAS,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAcpD,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC;IASnD;;;;;;;;;OASG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAWzC,yBAAyB,IAAI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Q,GAAG,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAazD,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB7D;;OAEG;IACH,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5B,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5B,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM7B,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAU7B,qBAAqB,IAAI,OAAO;CAGjC"}
|
|
@@ -82,59 +82,61 @@ class WaterHeater {
|
|
|
82
82
|
*/
|
|
83
83
|
async pushWaterHeaterOnChanges() {
|
|
84
84
|
if (this.Active !== 1) {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
parameter: 'default',
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
await this.pushChanges(
|
|
85
|
+
const body = JSON.stringify({
|
|
86
|
+
'command': 'turnOn',
|
|
87
|
+
'parameter': 'default',
|
|
88
|
+
'commandType': 'command',
|
|
89
|
+
});
|
|
90
|
+
await this.pushChanges(body);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
async pushWaterHeaterOffChanges() {
|
|
94
94
|
if (this.Active !== 0) {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
parameter: 'default',
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
await this.pushChanges(
|
|
95
|
+
const body = JSON.stringify({
|
|
96
|
+
'command': 'turnOff',
|
|
97
|
+
'parameter': 'default',
|
|
98
|
+
'commandType': 'command',
|
|
99
|
+
});
|
|
100
|
+
await this.pushChanges(body);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
async pushChanges(
|
|
103
|
+
async pushChanges(body) {
|
|
104
104
|
try {
|
|
105
|
-
|
|
106
|
-
` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
|
|
107
|
-
// Make the API request
|
|
105
|
+
// Make Push On request to the API
|
|
108
106
|
const t = Date.now();
|
|
109
107
|
const nonce = 'requestID';
|
|
110
108
|
const data = this.platform.config.credentials?.token + t + nonce;
|
|
111
|
-
const signTerm = crypto_1.default.createHmac('sha256', this.platform.config.credentials?.secret)
|
|
109
|
+
const signTerm = crypto_1.default.createHmac('sha256', this.platform.config.credentials?.secret)
|
|
110
|
+
.update(Buffer.from(data, 'utf-8'))
|
|
111
|
+
.digest();
|
|
112
112
|
const sign = signTerm.toString('base64');
|
|
113
113
|
this.debugLog(`Water Heater: ${this.accessory.displayName} sign: ${sign}`);
|
|
114
|
+
this.infoLog(`Water Heater: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
|
|
114
115
|
const options = {
|
|
115
116
|
hostname: settings_1.HostDomain,
|
|
116
117
|
port: 443,
|
|
117
118
|
path: `${settings_1.DevicePath}/${this.device.deviceId}/commands`,
|
|
118
119
|
method: 'POST',
|
|
119
120
|
headers: {
|
|
120
|
-
Authorization: this.platform.config.credentials?.token,
|
|
121
|
-
sign: sign,
|
|
122
|
-
nonce: nonce,
|
|
123
|
-
t: t,
|
|
121
|
+
'Authorization': this.platform.config.credentials?.token,
|
|
122
|
+
'sign': sign,
|
|
123
|
+
'nonce': nonce,
|
|
124
|
+
't': t,
|
|
124
125
|
'Content-Type': 'application/json',
|
|
126
|
+
'Content-Length': body.length,
|
|
125
127
|
},
|
|
126
128
|
};
|
|
127
|
-
const req = https_1.default.request(options,
|
|
129
|
+
const req = https_1.default.request(options, res => {
|
|
128
130
|
this.debugLog(`Water Heater: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
|
|
129
131
|
this.statusCode({ res });
|
|
130
|
-
res.on('data',
|
|
132
|
+
res.on('data', d => {
|
|
131
133
|
this.debugLog(`Water Heater: ${this.accessory.displayName} d: ${d}`);
|
|
132
134
|
});
|
|
133
135
|
});
|
|
134
|
-
req.on('error', (
|
|
135
|
-
this.errorLog(`Water Heater: ${this.accessory.displayName} error: ${
|
|
136
|
+
req.on('error', (e) => {
|
|
137
|
+
this.errorLog(`Water Heater: ${this.accessory.displayName} error message: ${e.message}`);
|
|
136
138
|
});
|
|
137
|
-
req.write(
|
|
139
|
+
req.write(body);
|
|
138
140
|
req.end();
|
|
139
141
|
this.debugLog(`Water Heater: ${this.accessory.displayName} pushchanges: ${JSON.stringify(req)}`);
|
|
140
142
|
this.updateHomeKitCharacteristics();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waterheater.js","sourceRoot":"","sources":["../../src/irdevice/waterheater.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,oDAA4B;AAG5B,0CAAgF;AAGhF;;;;GAIG;AACH,MAAa,WAAW;IAWtB,YAA6B,QAA2B,EAAU,SAA4B,EAAS,MAAkC;QAA5G,aAAQ,GAAR,QAAQ,CAAmB;QAAU,cAAS,GAAT,SAAS,CAAmB;QAAS,WAAM,GAAN,MAAM,CAA4B;QACvI,uBAAuB;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpB,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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,EAAE;YAChC,IAAI,IAAI,CAAC,aAAa,KAAK,OAAO,EAAE;gBAClC,IAAI,CAAC,QAAQ,CAAC,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,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC;IACnF,CAAC;CACF;AA7PD,kCA6PC"}
|
package/package.json
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"displayName": "Homebridge SwitchBot",
|
|
3
|
+
"name": "@switchbot/homebridge-switchbot",
|
|
4
|
+
"version": "2.0.0-beta.0",
|
|
5
|
+
"description": "The [Homebridge](https://homebridge.io) SwitchBot plugin allows you to access your [SwitchBot](https://www.switch-bot.com) device(s) from HomeKit.",
|
|
6
|
+
"author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git://github.com/OpenWonderLabs/homebridge-switchbot.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/OpenWonderLabs/homebridge-switchbot/issues"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"homebridge": "^1.5.0",
|
|
17
|
+
"node": "^14.20.0 || ^16.17.0 || ^18.8.0"
|
|
18
|
+
},
|
|
19
|
+
"main": "dist/index.js",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"check": "npm install && npm outdated",
|
|
22
|
+
"update": "ncu -u && npm update && npm install",
|
|
23
|
+
"lint": "eslint src/**.ts",
|
|
24
|
+
"watch": "npm run build && npm link && nodemon",
|
|
25
|
+
"build": "rimraf ./dist && tsc",
|
|
26
|
+
"prepublishOnly": "npm run lint && npm run build",
|
|
27
|
+
"postpublish": "npm run clean",
|
|
28
|
+
"clean": "rimraf ./dist",
|
|
29
|
+
"test": "eslint src/**.ts"
|
|
30
|
+
},
|
|
31
|
+
"funding": [
|
|
32
|
+
{
|
|
33
|
+
"type": "Paypal",
|
|
34
|
+
"url": "https://paypal.me/donavanbecker"
|
|
11
35
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"engines": {
|
|
16
|
-
"homebridge": "^1.5.0",
|
|
17
|
-
"node": "^14.20.0 || ^16.17.0 || ^18.8.0"
|
|
18
|
-
},
|
|
19
|
-
"main": "dist/index.js",
|
|
20
|
-
"scripts": {
|
|
21
|
-
"check": "npm install && npm outdated",
|
|
22
|
-
"update": "ncu -u && npm update && npm install",
|
|
23
|
-
"lint": "eslint src/**.ts",
|
|
24
|
-
"watch": "npm run build && npm link && nodemon",
|
|
25
|
-
"build": "rimraf ./dist && tsc",
|
|
26
|
-
"prepublishOnly": "npm run lint && npm run build",
|
|
27
|
-
"postpublish": "npm run clean",
|
|
28
|
-
"clean": "rimraf ./dist",
|
|
29
|
-
"test": "eslint src/**.ts"
|
|
30
|
-
},
|
|
31
|
-
"funding": [
|
|
32
|
-
{
|
|
33
|
-
"type": "Paypal",
|
|
34
|
-
"url": "https://paypal.me/donavanbecker"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"type": "GitHub",
|
|
38
|
-
"url": "https://github.com/sponsors/donavanbecker"
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
"publishConfig": {
|
|
42
|
-
"access": "public"
|
|
43
|
-
},
|
|
44
|
-
"keywords": [
|
|
45
|
-
"homebridge-plugin",
|
|
46
|
-
"switchbot",
|
|
47
|
-
"humidifier",
|
|
48
|
-
"humidity",
|
|
49
|
-
"temperature",
|
|
50
|
-
"bot",
|
|
51
|
-
"curtains",
|
|
52
|
-
"windows",
|
|
53
|
-
"ble",
|
|
54
|
-
"ir"
|
|
55
|
-
],
|
|
56
|
-
"dependencies": {
|
|
57
|
-
"@homebridge/plugin-ui-utils": "^0.0.19",
|
|
58
|
-
"async-mqtt": "^2.6.3",
|
|
59
|
-
"crypto-js": "^4.1.1",
|
|
60
|
-
"fakegato-history": "^0.6.3",
|
|
61
|
-
"rxjs": "^7.5.6"
|
|
62
|
-
},
|
|
63
|
-
"devDependencies": {
|
|
64
|
-
"@types/node": "^18.7.18",
|
|
65
|
-
"@types/crypto-js": "^4.1.1",
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
|
67
|
-
"@typescript-eslint/parser": "^5.38.0",
|
|
68
|
-
"eslint": "^8.23.1",
|
|
69
|
-
"eslint-config-prettier": "8.5.0",
|
|
70
|
-
"eslint-plugin-prettier": "4.2.1",
|
|
71
|
-
"homebridge": "^1.5.0",
|
|
72
|
-
"nodemon": "^2.0.20",
|
|
73
|
-
"npm-check-updates": "^16.2.1",
|
|
74
|
-
"prettier": "2.7.1",
|
|
75
|
-
"rimraf": "^3.0.2",
|
|
76
|
-
"ts-node": "^10.9.1",
|
|
77
|
-
"typescript": "^4.8.3"
|
|
78
|
-
},
|
|
79
|
-
"optionalDependencies": {
|
|
80
|
-
"@abandonware/noble": "^1.9.2-15",
|
|
81
|
-
"node-switchbot": "^1.4.2-beta.0"
|
|
36
|
+
{
|
|
37
|
+
"type": "GitHub",
|
|
38
|
+
"url": "https://github.com/sponsors/donavanbecker"
|
|
82
39
|
}
|
|
40
|
+
],
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"homebridge-plugin",
|
|
46
|
+
"switchbot",
|
|
47
|
+
"humidifier",
|
|
48
|
+
"humidity",
|
|
49
|
+
"temperature",
|
|
50
|
+
"bot",
|
|
51
|
+
"curtains",
|
|
52
|
+
"windows",
|
|
53
|
+
"ble",
|
|
54
|
+
"ir"
|
|
55
|
+
],
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@homebridge/plugin-ui-utils": "^0.0.19",
|
|
58
|
+
"async-mqtt": "^2.6.3",
|
|
59
|
+
"crypto-js": "^4.1.1",
|
|
60
|
+
"fakegato-history": "^0.6.3",
|
|
61
|
+
"rxjs": "^7.5.6"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@types/node": "^18.7.18",
|
|
65
|
+
"@types/crypto-js": "^4.1.1",
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
|
67
|
+
"@typescript-eslint/parser": "^5.38.0",
|
|
68
|
+
"eslint": "^8.23.1",
|
|
69
|
+
"eslint-config-prettier": "8.5.0",
|
|
70
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
71
|
+
"homebridge": "^1.5.0",
|
|
72
|
+
"nodemon": "^2.0.20",
|
|
73
|
+
"npm-check-updates": "^16.2.1",
|
|
74
|
+
"prettier": "2.7.1",
|
|
75
|
+
"rimraf": "^3.0.2",
|
|
76
|
+
"ts-node": "^10.9.1",
|
|
77
|
+
"typescript": "^4.8.3"
|
|
78
|
+
},
|
|
79
|
+
"optionalDependencies": {
|
|
80
|
+
"@abandonware/noble": "^1.9.2-15",
|
|
81
|
+
"node-switchbot": "^1.4.2-beta.7"
|
|
82
|
+
}
|
|
83
83
|
}
|
package/src/device/bot.ts
CHANGED
|
@@ -544,7 +544,7 @@ export class Bot {
|
|
|
544
544
|
});
|
|
545
545
|
// Set an event handler
|
|
546
546
|
switchbot.onadvertisement = (ad: any) => {
|
|
547
|
-
this.warnLog(JSON.stringify(ad, null, ' '));
|
|
547
|
+
this.warnLog(`Bot: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
548
548
|
};
|
|
549
549
|
await switchbot.wait(10000);
|
|
550
550
|
// Stop to monitor
|
package/src/device/colorbulb.ts
CHANGED
|
@@ -34,7 +34,7 @@ export class ColorBulb {
|
|
|
34
34
|
color: deviceStatus['color'];
|
|
35
35
|
brightness: deviceStatus['brightness'];
|
|
36
36
|
colorTemperature?: deviceStatus['colorTemperature'];
|
|
37
|
-
deviceStatus!: any;
|
|
37
|
+
deviceStatus!: any;
|
|
38
38
|
|
|
39
39
|
// BLE Others
|
|
40
40
|
connected?: boolean;
|
|
@@ -68,6 +68,7 @@ export class ColorBulb {
|
|
|
68
68
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: device & devicesConfig) {
|
|
69
69
|
// default placeholders
|
|
70
70
|
this.logs(device);
|
|
71
|
+
this.scan(device);
|
|
71
72
|
this.refreshRate(device);
|
|
72
73
|
this.adaptiveLighting(device);
|
|
73
74
|
this.config(device);
|
|
@@ -316,7 +317,10 @@ export class ColorBulb {
|
|
|
316
317
|
})
|
|
317
318
|
.then(() => {
|
|
318
319
|
// Set an event hander
|
|
320
|
+
this.errorLog(`Color Bulb: ${this.accessory.displayName} then switchbot: ${JSON.stringify(switchbot)}`);
|
|
319
321
|
switchbot.onadvertisement = (ad: any) => {
|
|
322
|
+
this.errorLog(`Color Bulb: ${this.accessory.displayName} switchbot: ${JSON.stringify(switchbot.onadvertisement)}`);
|
|
323
|
+
this.errorLog(`Color Bulb: ${this.accessory.displayName} ad: ${JSON.stringify(ad)}`);
|
|
320
324
|
this.address = ad.address;
|
|
321
325
|
if (this.deviceLogging.includes('debug')) {
|
|
322
326
|
this.infoLog(this.address);
|
|
@@ -325,19 +329,19 @@ export class ColorBulb {
|
|
|
325
329
|
this.infoLog(`Color Bulb: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
|
|
326
330
|
}
|
|
327
331
|
this.serviceData = ad.serviceData;
|
|
328
|
-
this.state = ad.serviceData.state;
|
|
329
|
-
this.delay = ad.serviceData.delay;
|
|
332
|
+
//this.state = ad.serviceData.state;
|
|
333
|
+
//this.delay = ad.serviceData.delay;
|
|
330
334
|
//this.timer = ad.serviceData.timer;
|
|
331
335
|
//this.syncUtcTime = ad.serviceData.syncUtcTime;
|
|
332
|
-
this.wifiRssi = ad.serviceData.wifiRssi;
|
|
336
|
+
//this.wifiRssi = ad.serviceData.wifiRssi;
|
|
333
337
|
//this.overload = ad.serviceData.overload;
|
|
334
338
|
//this.currentPower = ad.serviceData.currentPower;
|
|
335
339
|
this.debugLog(`Color Bulb: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
336
|
-
this.debugLog(
|
|
340
|
+
/*this.debugLog(
|
|
337
341
|
`Color Bulb: ${this.accessory.displayName} state: ${ad.serviceData.state}, ` +
|
|
338
342
|
`delay: ${ad.serviceData.delay}, timer: ${ad.serviceData.timer}, syncUtcTime: ${ad.serviceData.syncUtcTime} ` +
|
|
339
343
|
`wifiRssi: ${ad.serviceData.wifiRssi}, overload: ${ad.serviceData.overload}, currentPower: ${ad.serviceData.currentPower}`,
|
|
340
|
-
)
|
|
344
|
+
);*/
|
|
341
345
|
|
|
342
346
|
if (this.serviceData) {
|
|
343
347
|
this.connected = true;
|
|
@@ -351,13 +355,18 @@ export class ColorBulb {
|
|
|
351
355
|
return switchbot.wait(this.scanDuration * 1000);
|
|
352
356
|
})
|
|
353
357
|
.then(async () => {
|
|
354
|
-
|
|
358
|
+
// Stop to monitor
|
|
355
359
|
switchbot.stopScan();
|
|
356
360
|
if (this.connected) {
|
|
357
361
|
this.parseStatus();
|
|
358
362
|
this.updateHomeKitCharacteristics();
|
|
359
363
|
} else {
|
|
360
|
-
|
|
364
|
+
this.errorLog(`Color Bulb: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
|
|
365
|
+
if (this.platform.config.credentials?.token) {
|
|
366
|
+
this.warnLog(`Color Bulb: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
367
|
+
this.SwitchToOpenAPI = true;
|
|
368
|
+
await this.openAPIRefreshStatus();
|
|
369
|
+
}
|
|
361
370
|
}
|
|
362
371
|
})
|
|
363
372
|
.catch(async (e: any) => {
|
|
@@ -381,6 +390,7 @@ export class ColorBulb {
|
|
|
381
390
|
|
|
382
391
|
async getCustomBLEAddress(switchbot: any) {
|
|
383
392
|
if (this.device.customBLEaddress && this.deviceLogging.includes('debug')) {
|
|
393
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} customBLEaddress: ${this.device.customBLEaddress}`);
|
|
384
394
|
(async () => {
|
|
385
395
|
// Start to monitor advertisement packets
|
|
386
396
|
await switchbot.startScan({
|
|
@@ -388,7 +398,7 @@ export class ColorBulb {
|
|
|
388
398
|
});
|
|
389
399
|
// Set an event handler
|
|
390
400
|
switchbot.onadvertisement = (ad: any) => {
|
|
391
|
-
this.warnLog(JSON.stringify(ad, null, ' '));
|
|
401
|
+
this.warnLog(`Color Bulb: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
392
402
|
};
|
|
393
403
|
await switchbot.wait(10000);
|
|
394
404
|
// Stop to monitor
|
|
@@ -941,6 +951,20 @@ export class ColorBulb {
|
|
|
941
951
|
}
|
|
942
952
|
}
|
|
943
953
|
|
|
954
|
+
async scan(device: device & devicesConfig): Promise<void> {
|
|
955
|
+
if (device.scanDuration) {
|
|
956
|
+
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
|
957
|
+
if (device.ble) {
|
|
958
|
+
this.debugLog(`Bot: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
959
|
+
}
|
|
960
|
+
} else {
|
|
961
|
+
this.scanDuration = this.accessory.context.scanDuration = 1;
|
|
962
|
+
if (this.device.ble) {
|
|
963
|
+
this.debugLog(`Bot: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
944
968
|
async logs(device: device & devicesConfig): Promise<void> {
|
|
945
969
|
if (this.platform.debugMode) {
|
|
946
970
|
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
package/src/device/contact.ts
CHANGED
|
@@ -354,7 +354,7 @@ export class Contact {
|
|
|
354
354
|
});
|
|
355
355
|
// Set an event handler
|
|
356
356
|
switchbot.onadvertisement = (ad: any) => {
|
|
357
|
-
this.warnLog(JSON.stringify(ad, null, ' '));
|
|
357
|
+
this.warnLog(`Contact Sensor: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
358
358
|
};
|
|
359
359
|
await switchbot.wait(10000);
|
|
360
360
|
// Stop to monitor
|
package/src/device/curtain.ts
CHANGED
|
@@ -436,6 +436,7 @@ export class Curtain {
|
|
|
436
436
|
this.debugLog(`Curtain: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
|
|
437
437
|
this.getCustomBLEAddress(switchbot);
|
|
438
438
|
// Start to monitor advertisement packets
|
|
439
|
+
this.errorLog(`Color Bulb: ${this.accessory.displayName} switchbot: ${JSON.stringify(switchbot)}`);
|
|
439
440
|
if (switchbot !== false) {
|
|
440
441
|
switchbot
|
|
441
442
|
.startScan({
|
|
@@ -481,7 +482,12 @@ export class Curtain {
|
|
|
481
482
|
this.parseStatus();
|
|
482
483
|
this.updateHomeKitCharacteristics();
|
|
483
484
|
} else {
|
|
484
|
-
|
|
485
|
+
this.errorLog(`Curtain: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
|
|
486
|
+
if (this.platform.config.credentials?.token) {
|
|
487
|
+
this.warnLog(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
488
|
+
this.SwitchToOpenAPI = true;
|
|
489
|
+
await this.openAPIRefreshStatus();
|
|
490
|
+
}
|
|
485
491
|
}
|
|
486
492
|
})
|
|
487
493
|
.catch(async (e: any) => {
|
|
@@ -512,7 +518,7 @@ export class Curtain {
|
|
|
512
518
|
});
|
|
513
519
|
// Set an event handler
|
|
514
520
|
switchbot.onadvertisement = (ad: any) => {
|
|
515
|
-
this.warnLog(JSON.stringify(ad, null, ' '));
|
|
521
|
+
this.warnLog(`Curtain: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
516
522
|
};
|
|
517
523
|
await switchbot.wait(10000);
|
|
518
524
|
// Stop to monitor
|
package/src/device/humidifier.ts
CHANGED
|
@@ -369,7 +369,7 @@ export class Humidifier {
|
|
|
369
369
|
});
|
|
370
370
|
// Set an event handler
|
|
371
371
|
switchbot.onadvertisement = (ad: any) => {
|
|
372
|
-
this.warnLog(JSON.stringify(ad, null, ' '));
|
|
372
|
+
this.warnLog(`Humidifier: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
373
373
|
};
|
|
374
374
|
await switchbot.wait(10000);
|
|
375
375
|
// Stop to monitor
|
package/src/device/meter.ts
CHANGED
|
@@ -387,7 +387,7 @@ export class Meter {
|
|
|
387
387
|
});
|
|
388
388
|
// Set an event handler
|
|
389
389
|
switchbot.onadvertisement = (ad: any) => {
|
|
390
|
-
this.warnLog(JSON.stringify(ad, null, ' '));
|
|
390
|
+
this.warnLog(`Meter: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
391
391
|
};
|
|
392
392
|
await switchbot.wait(10000);
|
|
393
393
|
// Stop to monitor
|
package/src/device/meterplus.ts
CHANGED
|
@@ -324,7 +324,7 @@ export class MeterPlus {
|
|
|
324
324
|
});
|
|
325
325
|
// Set an event handler
|
|
326
326
|
switchbot.onadvertisement = (ad: any) => {
|
|
327
|
-
this.warnLog(JSON.stringify(ad, null, ' '));
|
|
327
|
+
this.warnLog(`Meter Plus: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
328
328
|
};
|
|
329
329
|
await switchbot.wait(10000);
|
|
330
330
|
// Stop to monitor
|
package/src/device/motion.ts
CHANGED
|
@@ -306,7 +306,7 @@ export class Motion {
|
|
|
306
306
|
});
|
|
307
307
|
// Set an event handler
|
|
308
308
|
switchbot.onadvertisement = (ad: any) => {
|
|
309
|
-
this.warnLog(JSON.stringify(ad, null, ' '));
|
|
309
|
+
this.warnLog(`Motion Sensor: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
310
310
|
};
|
|
311
311
|
await switchbot.wait(10000);
|
|
312
312
|
// Stop to monitor
|
package/src/device/plug.ts
CHANGED
|
@@ -263,7 +263,7 @@ export class Plug {
|
|
|
263
263
|
});
|
|
264
264
|
// Set an event handler
|
|
265
265
|
switchbot.onadvertisement = (ad: any) => {
|
|
266
|
-
this.warnLog(JSON.stringify(ad, null, ' '));
|
|
266
|
+
this.warnLog(`Plug: ${this.accessory.displayName} ad: ${JSON.stringify(ad, null, ' ')}`);
|
|
267
267
|
};
|
|
268
268
|
await switchbot.wait(10000);
|
|
269
269
|
// Stop to monitor
|