@switchbot/homebridge-switchbot 4.1.8-beta.7 → 4.2.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/workflows/build.yml +1 -1
- package/CHANGELOG.md +8 -0
- package/config.schema.json +265 -0
- package/dist/device/blindtilt.js +1 -1
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +1 -1
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js +1 -1
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +1 -1
- 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.js +1 -1
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/fan.js +1 -1
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.js +1 -1
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.js +1 -1
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.js +1 -1
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.js +1 -1
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +1 -1
- package/dist/device/lock.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/meterpro.js +1 -1
- package/dist/device/meterpro.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/device/robotvacuumcleaner.js +1 -1
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.js +1 -1
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/docs/functions/default.html +1 -1
- package/package.json +12 -12
- package/src/device/blindtilt.ts +2 -2
- package/src/device/bot.ts +1 -1
- package/src/device/ceilinglight.ts +1 -1
- package/src/device/colorbulb.ts +1 -1
- package/src/device/contact.ts +1 -1
- package/src/device/curtain.ts +2 -2
- package/src/device/fan.ts +1 -1
- package/src/device/hub.ts +1 -1
- package/src/device/humidifier.ts +1 -1
- package/src/device/iosensor.ts +1 -1
- package/src/device/lightstrip.ts +1 -1
- package/src/device/lock.ts +1 -1
- package/src/device/meter.ts +1 -1
- package/src/device/meterplus.ts +1 -1
- package/src/device/meterpro.ts +1 -1
- package/src/device/motion.ts +1 -1
- package/src/device/plug.ts +1 -1
- package/src/device/robotvacuumcleaner.ts +1 -1
- package/src/device/waterdetector.ts +1 -1
- package/src/settings.ts +1 -0
- package/.github/npm-version-script.cjs +0 -81
package/src/device/humidifier.ts
CHANGED
|
@@ -345,7 +345,7 @@ export class Humidifier extends deviceBase {
|
|
|
345
345
|
|
|
346
346
|
async registerPlatformBLE(): Promise<void> {
|
|
347
347
|
this.debugLog('registerPlatformBLE')
|
|
348
|
-
if (this.config.options?.BLE) {
|
|
348
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
349
349
|
this.debugLog('is listening to Platform BLE.')
|
|
350
350
|
try {
|
|
351
351
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
package/src/device/iosensor.ts
CHANGED
|
@@ -309,7 +309,7 @@ export class IOSensor extends deviceBase {
|
|
|
309
309
|
|
|
310
310
|
async registerPlatformBLE(): Promise<void> {
|
|
311
311
|
this.debugLog('registerPlatformBLE')
|
|
312
|
-
if (this.config.options?.BLE) {
|
|
312
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
313
313
|
this.debugLog('is listening to Platform BLE.')
|
|
314
314
|
try {
|
|
315
315
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -347,7 +347,7 @@ export class StripLight extends deviceBase {
|
|
|
347
347
|
|
|
348
348
|
async registerPlatformBLE(): Promise<void> {
|
|
349
349
|
this.debugLog('registerPlatformBLE')
|
|
350
|
-
if (this.config.options?.BLE) {
|
|
350
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
351
351
|
this.debugLog('is listening to Platform BLE.')
|
|
352
352
|
try {
|
|
353
353
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
package/src/device/lock.ts
CHANGED
|
@@ -351,7 +351,7 @@ export class Lock extends deviceBase {
|
|
|
351
351
|
|
|
352
352
|
async registerPlatformBLE(): Promise<void> {
|
|
353
353
|
this.debugLog('registerPlatformBLE')
|
|
354
|
-
if (this.config.options?.BLE) {
|
|
354
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
355
355
|
this.debugLog('is listening to Platform BLE.')
|
|
356
356
|
try {
|
|
357
357
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
package/src/device/meter.ts
CHANGED
|
@@ -306,7 +306,7 @@ export class Meter extends deviceBase {
|
|
|
306
306
|
|
|
307
307
|
async registerPlatformBLE(): Promise<void> {
|
|
308
308
|
this.debugLog('registerPlatformBLE')
|
|
309
|
-
if (this.config.options?.BLE) {
|
|
309
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
310
310
|
this.debugLog('is listening to Platform BLE.')
|
|
311
311
|
try {
|
|
312
312
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
package/src/device/meterplus.ts
CHANGED
|
@@ -310,7 +310,7 @@ export class MeterPlus extends deviceBase {
|
|
|
310
310
|
|
|
311
311
|
async registerPlatformBLE(): Promise<void> {
|
|
312
312
|
this.debugLog('registerPlatformBLE')
|
|
313
|
-
if (this.config.options?.BLE) {
|
|
313
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
314
314
|
this.debugLog('is listening to Platform BLE.')
|
|
315
315
|
try {
|
|
316
316
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
package/src/device/meterpro.ts
CHANGED
|
@@ -386,7 +386,7 @@ export class MeterPro extends deviceBase {
|
|
|
386
386
|
|
|
387
387
|
async registerPlatformBLE(): Promise<void> {
|
|
388
388
|
this.debugLog('registerPlatformBLE')
|
|
389
|
-
if (this.config.options?.BLE) {
|
|
389
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
390
390
|
this.debugLog('is listening to Platform BLE.')
|
|
391
391
|
try {
|
|
392
392
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
package/src/device/motion.ts
CHANGED
|
@@ -281,7 +281,7 @@ export class Motion extends deviceBase {
|
|
|
281
281
|
|
|
282
282
|
async registerPlatformBLE(): Promise<void> {
|
|
283
283
|
this.debugLog('registerPlatformBLE')
|
|
284
|
-
if (this.config.options?.BLE) {
|
|
284
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
285
285
|
this.debugLog('is listening to Platform BLE.')
|
|
286
286
|
try {
|
|
287
287
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
package/src/device/plug.ts
CHANGED
|
@@ -206,7 +206,7 @@ export class Plug extends deviceBase {
|
|
|
206
206
|
|
|
207
207
|
async registerPlatformBLE(): Promise<void> {
|
|
208
208
|
this.debugLog('registerPlatformBLE')
|
|
209
|
-
if (this.config.options?.BLE) {
|
|
209
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
210
210
|
this.debugLog('is listening to Platform BLE.')
|
|
211
211
|
try {
|
|
212
212
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
|
@@ -294,7 +294,7 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
294
294
|
|
|
295
295
|
async registerPlatformBLE(): Promise<void> {
|
|
296
296
|
this.debugLog('registerPlatformBLE')
|
|
297
|
-
if (this.config.options?.BLE) {
|
|
297
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
298
298
|
this.debugLog('is listening to Platform BLE.')
|
|
299
299
|
try {
|
|
300
300
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
|
@@ -288,7 +288,7 @@ export class WaterDetector extends deviceBase {
|
|
|
288
288
|
|
|
289
289
|
async registerPlatformBLE(): Promise<void> {
|
|
290
290
|
this.debugLog('registerPlatformBLE')
|
|
291
|
-
if (this.config.options?.BLE) {
|
|
291
|
+
if (this.config.options?.BLE && !this.device.disablePlatformBLE) {
|
|
292
292
|
this.debugLog('is listening to Platform BLE.')
|
|
293
293
|
try {
|
|
294
294
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
package/src/settings.ts
CHANGED
|
@@ -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));
|