@switchbot/homebridge-switchbot 2.8.2-beta.1 → 2.8.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 +10 -0
- package/config.schema.json +1 -1
- package/dist/device/blindtilt.d.ts +2 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +39 -14
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +2 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +23 -17
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +2 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +16 -14
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +2 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +21 -14
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +2 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +16 -14
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +4 -3
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +36 -18
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +2 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +16 -14
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +5 -4
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +16 -14
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +2 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +29 -14
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +2 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +21 -14
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +2 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +18 -15
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +3 -2
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +48 -26
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -2
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +46 -23
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +5 -4
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +22 -19
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +2 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +17 -14
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +2 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +19 -13
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +7 -19
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +36 -18
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +4 -7
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +26 -12
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +4 -7
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +24 -12
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +4 -7
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +23 -12
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +4 -7
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +24 -12
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +4 -7
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +24 -12
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +5 -10
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +27 -14
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +4 -7
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +24 -12
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +6 -16
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +28 -16
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +3 -3
- package/src/device/blindtilt.ts +41 -16
- package/src/device/bot.ts +25 -17
- package/src/device/ceilinglight.ts +20 -14
- package/src/device/colorbulb.ts +23 -14
- package/src/device/contact.ts +20 -14
- package/src/device/curtain.ts +41 -21
- package/src/device/hub.ts +20 -14
- package/src/device/humidifier.ts +23 -17
- package/src/device/iosensor.ts +33 -14
- package/src/device/lightstrip.ts +23 -14
- package/src/device/lock.ts +22 -15
- package/src/device/meter.ts +52 -27
- package/src/device/meterplus.ts +51 -26
- package/src/device/motion.ts +31 -30
- package/src/device/plug.ts +20 -14
- package/src/device/robotvacuumcleaner.ts +21 -13
- package/src/irdevice/airconditioner.ts +36 -18
- package/src/irdevice/airpurifier.ts +26 -12
- package/src/irdevice/camera.ts +24 -12
- package/src/irdevice/fan.ts +23 -12
- package/src/irdevice/light.ts +24 -12
- package/src/irdevice/other.ts +24 -12
- package/src/irdevice/tv.ts +27 -14
- package/src/irdevice/vacuumcleaner.ts +24 -12
- package/src/irdevice/waterheater.ts +28 -16
- package/.github/npm-version-script.js +0 -81
|
@@ -14,6 +14,7 @@ export class WaterHeater {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
|
+
FirmwareRevision!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
deviceLogging!: string;
|
|
@@ -26,11 +27,11 @@ export class WaterHeater {
|
|
|
26
27
|
public device: irdevice & irDevicesConfig,
|
|
27
28
|
) {
|
|
28
29
|
// default placeholders
|
|
29
|
-
this.logs(
|
|
30
|
+
this.logs(device);
|
|
30
31
|
this.context();
|
|
31
|
-
this.disablePushOnChanges(
|
|
32
|
-
this.disablePushOffChanges(
|
|
33
|
-
this.config(
|
|
32
|
+
this.disablePushOnChanges(device);
|
|
33
|
+
this.disablePushOffChanges(device);
|
|
34
|
+
this.config(device);
|
|
34
35
|
|
|
35
36
|
// set accessory information
|
|
36
37
|
accessory
|
|
@@ -38,9 +39,9 @@ export class WaterHeater {
|
|
|
38
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
39
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
40
41
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
42
43
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
43
|
-
.updateValue(this.
|
|
44
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
44
45
|
|
|
45
46
|
// get the Television service if it exists, otherwise create a new Television service
|
|
46
47
|
// you can create multiple services for each accessory
|
|
@@ -153,6 +154,7 @@ export class WaterHeater {
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
157
|
+
// Active
|
|
156
158
|
if (this.Active === undefined) {
|
|
157
159
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
158
160
|
} else {
|
|
@@ -160,9 +162,19 @@ export class WaterHeater {
|
|
|
160
162
|
this.valveService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
161
163
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
162
164
|
}
|
|
165
|
+
// FirmwareRevision
|
|
166
|
+
if (this.FirmwareRevision === undefined) {
|
|
167
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
168
|
+
} else {
|
|
169
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
170
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
171
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
172
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
173
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
174
|
+
}
|
|
163
175
|
}
|
|
164
176
|
|
|
165
|
-
async disablePushOnChanges(
|
|
177
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
166
178
|
if (device.disablePushOn === undefined) {
|
|
167
179
|
this.disablePushOn = false;
|
|
168
180
|
} else {
|
|
@@ -170,7 +182,7 @@ export class WaterHeater {
|
|
|
170
182
|
}
|
|
171
183
|
}
|
|
172
184
|
|
|
173
|
-
async disablePushOffChanges(
|
|
185
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
174
186
|
if (device.disablePushOff === undefined) {
|
|
175
187
|
this.disablePushOff = false;
|
|
176
188
|
} else {
|
|
@@ -252,21 +264,21 @@ export class WaterHeater {
|
|
|
252
264
|
this.valveService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
253
265
|
}
|
|
254
266
|
|
|
255
|
-
|
|
256
|
-
let FirmwareRevision: string;
|
|
267
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
257
268
|
this.debugLog(
|
|
258
269
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
259
270
|
);
|
|
260
271
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
261
272
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
262
273
|
if (accessory.context.FirmwareRevision) {
|
|
263
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
274
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
264
275
|
} else if (device.firmware) {
|
|
265
|
-
FirmwareRevision = device.firmware;
|
|
276
|
+
this.FirmwareRevision = device.firmware;
|
|
266
277
|
} else {
|
|
267
|
-
FirmwareRevision = this.platform.version!;
|
|
278
|
+
this.FirmwareRevision = this.platform.version!;
|
|
268
279
|
}
|
|
269
|
-
|
|
280
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
281
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
270
282
|
}
|
|
271
283
|
|
|
272
284
|
async context(): Promise<void> {
|
|
@@ -277,7 +289,7 @@ export class WaterHeater {
|
|
|
277
289
|
}
|
|
278
290
|
}
|
|
279
291
|
|
|
280
|
-
async config(
|
|
292
|
+
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
|
281
293
|
let config = {};
|
|
282
294
|
if (device.irwh) {
|
|
283
295
|
config = device.irwh;
|
|
@@ -311,7 +323,7 @@ export class WaterHeater {
|
|
|
311
323
|
}
|
|
312
324
|
}
|
|
313
325
|
|
|
314
|
-
async logs(
|
|
326
|
+
async logs(device: irdevice & irDevicesConfig): Promise<void> {
|
|
315
327
|
if (this.platform.debugMode) {
|
|
316
328
|
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
317
329
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
@@ -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));
|