@switchbot/homebridge-switchbot 2.5.0-beta.3 → 2.5.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/CHANGELOG.md +6 -2
- package/config.schema.json +47 -0
- package/dist/device/blindtilt.d.ts +39 -7
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +333 -159
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/settings.d.ts +6 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +3 -3
- package/src/device/blindtilt.ts +367 -155
- package/src/settings.ts +12 -5
- package/.github/npm-version-script.js +0 -81
package/src/settings.ts
CHANGED
|
@@ -65,6 +65,7 @@ export interface devicesConfig extends device {
|
|
|
65
65
|
meter?: meter;
|
|
66
66
|
humidifier?: humidifier;
|
|
67
67
|
curtain?: curtain;
|
|
68
|
+
blindTilt?: blindTilt;
|
|
68
69
|
contact?: contact;
|
|
69
70
|
motion?: motion;
|
|
70
71
|
colorbulb?: colorbulb;
|
|
@@ -105,6 +106,11 @@ export type curtain = {
|
|
|
105
106
|
setOpenMode?: string;
|
|
106
107
|
};
|
|
107
108
|
|
|
109
|
+
export type blindTilt = {
|
|
110
|
+
mappingMode?: string;
|
|
111
|
+
updateRate?: number;
|
|
112
|
+
};
|
|
113
|
+
|
|
108
114
|
export type contact = {
|
|
109
115
|
hide_lightsensor?: boolean;
|
|
110
116
|
set_minLux?: number;
|
|
@@ -259,13 +265,14 @@ deviceName?: string; //device name. (Used by the following deviceTypes: Robot Va
|
|
|
259
265
|
nebulizationEfficiency?: number; //atomization efficiency percentage. (Used by the following deviceTypes: Humidifier)
|
|
260
266
|
auto?: boolean; //determines if a Humidifier is in Auto Mode or not. (Used by the following deviceTypes: Humidifier)
|
|
261
267
|
childLock?: boolean; //determines if a Humidifier's safety lock is on or not. (Used by the following deviceTypes: Humidifier)
|
|
262
|
-
sound?: boolean
|
|
263
|
-
lackWater?: boolean
|
|
264
|
-
version?: number
|
|
265
|
-
direction?: string
|
|
268
|
+
sound?: boolean;//determines if a Humidifier is muted or not. (Used by the following deviceTypes: Humidifier)
|
|
269
|
+
lackWater?: boolean;//determines if the water tank is empty or not. (Used by the following deviceTypes: Humidifier)
|
|
270
|
+
version?: number;//the version of the device. (Used by the following deviceTypes: Blind Tilt)
|
|
271
|
+
direction?: string;//the opening direction of a Blind Tilt device. (Used by the following deviceTypes: Blind Tilt)
|
|
272
|
+
runStatus?: string;//'static' when not moving. (Used by the following deviceTypes: Blind Tilt)
|
|
266
273
|
mode?: number; //available for devices. the fan mode. (Used by the following deviceTypes: Smart Fan)
|
|
267
274
|
speed?: number;//the fan speed. (Used by the following deviceTypes: Smart Fan)
|
|
268
|
-
shaking?: boolean
|
|
275
|
+
shaking?: boolean;//determines if the fan is swinging or not. (Used by the following deviceTypes: Smart Fan)
|
|
269
276
|
shakeCenter?: string;//the fan's swing direciton. (Used by the following deviceTypes: Smart Fan)
|
|
270
277
|
shakeRange?: string;//the fan's swing range, 0~120°. (Used by the following deviceTypes: Smart Fan)
|
|
271
278
|
};
|
|
@@ -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.js <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));
|