@switchbot/homebridge-switchbot 4.1.4-beta.1 → 4.1.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 +11 -0
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +1 -1
- package/dist/device/fan.js.map +1 -1
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/docs/functions/default.html +1 -1
- package/package.json +4 -4
- package/src/device/blindtilt.ts +1 -1
- package/src/device/bot.ts +2 -2
- package/src/device/ceilinglight.ts +2 -2
- package/src/device/colorbulb.ts +3 -3
- package/src/device/curtain.ts +1 -1
- package/src/device/fan.ts +1 -1
- package/src/device/humidifier.ts +1 -1
- package/src/device/lightstrip.ts +1 -1
- package/src/device/plug.ts +1 -1
- package/src/device/robotvacuumcleaner.ts +2 -2
- package/.github/npm-version-script.cjs +0 -81
package/src/device/colorbulb.ts
CHANGED
|
@@ -506,7 +506,7 @@ export class ColorBulb extends deviceBase {
|
|
|
506
506
|
switchBotBLE
|
|
507
507
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
508
508
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
509
|
-
const deviceList = device_list as
|
|
509
|
+
const deviceList = device_list as WoBulb[]
|
|
510
510
|
this.infoLog(`Target Brightness: ${this.LightBulb.Brightness}`)
|
|
511
511
|
return await deviceList[0].setBrightness(Number(this.LightBulb.Brightness))
|
|
512
512
|
})
|
|
@@ -545,7 +545,7 @@ export class ColorBulb extends deviceBase {
|
|
|
545
545
|
switchBotBLE
|
|
546
546
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
547
547
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
548
|
-
const deviceList = device_list as
|
|
548
|
+
const deviceList = device_list as WoBulb[]
|
|
549
549
|
this.infoLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`)
|
|
550
550
|
return await deviceList[0].setColorTemperature(kelvin)
|
|
551
551
|
})
|
|
@@ -585,7 +585,7 @@ export class ColorBulb extends deviceBase {
|
|
|
585
585
|
switchBotBLE
|
|
586
586
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
587
587
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
588
|
-
const deviceList = device_list as
|
|
588
|
+
const deviceList = device_list as WoBulb[]
|
|
589
589
|
this.infoLog(`RGB: ${(this.LightBulb.Brightness, red, green, blue)}`)
|
|
590
590
|
return await deviceList[0].setRGB(Number(this.LightBulb.Brightness), red, green, blue)
|
|
591
591
|
})
|
package/src/device/curtain.ts
CHANGED
|
@@ -608,7 +608,7 @@ export class Curtain extends deviceBase {
|
|
|
608
608
|
switchBotBLE
|
|
609
609
|
.discover({ model: this.device.bleModel, quick: true, id: this.device.bleMac })
|
|
610
610
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
611
|
-
const deviceList = device_list as
|
|
611
|
+
const deviceList = device_list as WoCurtain[]
|
|
612
612
|
return await this.retryBLE({
|
|
613
613
|
max: this.maxRetryBLE(),
|
|
614
614
|
fn: async () => {
|
package/src/device/fan.ts
CHANGED
|
@@ -460,7 +460,7 @@ export class Fan extends deviceBase {
|
|
|
460
460
|
switchBotBLE
|
|
461
461
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
462
462
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
463
|
-
const deviceList = device_list as
|
|
463
|
+
const deviceList = device_list as SwitchbotDevice[]
|
|
464
464
|
return await this.retryBLE({
|
|
465
465
|
max: this.maxRetryBLE(),
|
|
466
466
|
fn: async () => {
|
package/src/device/humidifier.ts
CHANGED
|
@@ -438,7 +438,7 @@ export class Humidifier extends deviceBase {
|
|
|
438
438
|
switchBotBLE
|
|
439
439
|
.discover({ model: this.device.bleModel, quick: true, id: this.device.bleMac })
|
|
440
440
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
441
|
-
const deviceList = device_list as
|
|
441
|
+
const deviceList = device_list as WoHumi[]
|
|
442
442
|
return await deviceList[0].percentage(this.HumidifierDehumidifier.RelativeHumidityHumidifierThreshold)
|
|
443
443
|
})
|
|
444
444
|
.then(async () => {
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -465,7 +465,7 @@ export class StripLight extends deviceBase {
|
|
|
465
465
|
switchBotBLE
|
|
466
466
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
467
467
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
468
|
-
const deviceList = device_list as
|
|
468
|
+
const deviceList = device_list as WoStrip[]
|
|
469
469
|
this.infoLog(`On: ${this.LightBulb.On}`)
|
|
470
470
|
return await this.retryBLE({
|
|
471
471
|
max: this.maxRetryBLE(),
|
package/src/device/plug.ts
CHANGED
|
@@ -307,7 +307,7 @@ export class Plug extends deviceBase {
|
|
|
307
307
|
switchBotBLE
|
|
308
308
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
309
309
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
310
|
-
const deviceList = device_list as
|
|
310
|
+
const deviceList = device_list as WoPlugMiniUS[]
|
|
311
311
|
this.infoLog(`On: ${this.Outlet.On}`)
|
|
312
312
|
return await this.retryBLE({
|
|
313
313
|
max: this.maxRetryBLE(),
|
|
@@ -273,7 +273,7 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
273
273
|
// Start to monitor advertisement packets
|
|
274
274
|
(async () => {
|
|
275
275
|
// Start to monitor advertisement packets
|
|
276
|
-
const serviceData = await this.monitorAdvertisementPackets(switchBotBLE) as
|
|
276
|
+
const serviceData = await this.monitorAdvertisementPackets(switchBotBLE) as robotVacuumCleanerServiceData
|
|
277
277
|
// Update HomeKit
|
|
278
278
|
if (serviceData.model === SwitchBotBLEModel.Unknown && serviceData.modelName === SwitchBotBLEModelName.Unknown) {
|
|
279
279
|
this.serviceData = serviceData
|
|
@@ -392,7 +392,7 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
392
392
|
switchBotBLE
|
|
393
393
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
394
394
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
395
|
-
const deviceList = device_list as
|
|
395
|
+
const deviceList = device_list as SwitchbotDevice[]
|
|
396
396
|
this.infoLog(`On: ${this.LightBulb.On}`)
|
|
397
397
|
return await this.retryBLE({
|
|
398
398
|
max: this.maxRetryBLE(),
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
#!/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This scripts queries the npm registry to pull out the latest version for a given tag.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const semver = require("semver");
|
|
9
|
-
const child_process = require("child_process");
|
|
10
|
-
const assert = require("assert");
|
|
11
|
-
|
|
12
|
-
const BRANCH_VERSION_PATTERN = /^([A-Za-z]*)-(\d+.\d+.\d+)$/
|
|
13
|
-
|
|
14
|
-
// Load the contents of the package.json file
|
|
15
|
-
const packageJSON = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
|
16
|
-
|
|
17
|
-
let refArgument = process.argv[2];
|
|
18
|
-
let tagArgument = process.argv[3] || "latest";
|
|
19
|
-
|
|
20
|
-
if (refArgument == null) {
|
|
21
|
-
console.error("ref argument is missing");
|
|
22
|
-
console.error("Usage: npm-version-script.cjs <ref> [tag]");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Queries the NPM registry for the latest version for the provided tag.
|
|
28
|
-
* @param tag The tag to query for.
|
|
29
|
-
* @returns {string} Returns the version.
|
|
30
|
-
*/
|
|
31
|
-
function getTagVersionFromNpm(tag) {
|
|
32
|
-
try {
|
|
33
|
-
return child_process.execSync(`npm info ${packageJSON.name} version --tag="${tag}"`).toString("utf8").trim();
|
|
34
|
-
} catch (e) {
|
|
35
|
-
throw e;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function desiredTargetVersion(ref) {
|
|
40
|
-
// ref is a GitHub action ref string
|
|
41
|
-
if (ref.startsWith("refs/pull/")) {
|
|
42
|
-
throw Error("The version script was executed inside a PR!");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
assert(ref.startsWith("refs/heads/"))
|
|
46
|
-
let branchName = ref.slice("refs/heads/".length);
|
|
47
|
-
|
|
48
|
-
let results = branchName.match(BRANCH_VERSION_PATTERN);
|
|
49
|
-
if (results != null) {
|
|
50
|
-
if (results[1] !== tagArgument) {
|
|
51
|
-
console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return results[2];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// legacy mode were we use the `betaVersion` property in the package.json
|
|
58
|
-
if (branchName === "beta" && packageJSON.betaVersion) {
|
|
59
|
-
return packageJSON.betaVersion
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
throw new Error("Malformed branch name for ref: " + ref + ". Can't derive the base version. Use a branch name like: beta-x.x.x!");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// derive the base version from the branch ref
|
|
66
|
-
const baseVersion = desiredTargetVersion(refArgument);
|
|
67
|
-
|
|
68
|
-
// query the npm registry for the latest version of the provided tag name
|
|
69
|
-
const latestReleasedVersion = getTagVersionFromNpm(tagArgument); // e.g. 0.7.0-beta.12
|
|
70
|
-
const latestReleaseBase = semver.inc(latestReleasedVersion, "patch"); // will produce 0.7.0 (removing the preid, needed for the equality check below)
|
|
71
|
-
|
|
72
|
-
let publishTag;
|
|
73
|
-
if (semver.eq(baseVersion, latestReleaseBase)) { // check if we are releasing another version for the latest beta
|
|
74
|
-
publishTag = latestReleasedVersion; // set the current latest beta to be incremented
|
|
75
|
-
} else {
|
|
76
|
-
publishTag = baseVersion; // start of with a new beta version
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// save the package.json
|
|
80
|
-
packageJSON.version = publishTag;
|
|
81
|
-
fs.writeFileSync("package.json", JSON.stringify(packageJSON, null, 2));
|