@switchbot/homebridge-switchbot 5.0.0-beta.1 → 5.0.0-beta.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/dist/devices-matter/ColorLightAccessory.d.ts +3 -1
- package/dist/devices-matter/ColorLightAccessory.d.ts.map +1 -1
- package/dist/devices-matter/ColorLightAccessory.js +35 -36
- package/dist/devices-matter/ColorLightAccessory.js.map +1 -1
- package/dist/devices-matter/ColorTemperatureLightAccessory.d.ts +3 -1
- package/dist/devices-matter/ColorTemperatureLightAccessory.d.ts.map +1 -1
- package/dist/devices-matter/ColorTemperatureLightAccessory.js +32 -37
- package/dist/devices-matter/ColorTemperatureLightAccessory.js.map +1 -1
- package/dist/devices-matter/ContactSensorAccessory.d.ts +3 -1
- package/dist/devices-matter/ContactSensorAccessory.d.ts.map +1 -1
- package/dist/devices-matter/ContactSensorAccessory.js +16 -13
- package/dist/devices-matter/ContactSensorAccessory.js.map +1 -1
- package/dist/devices-matter/DimmableLightAccessory.d.ts +3 -1
- package/dist/devices-matter/DimmableLightAccessory.d.ts.map +1 -1
- package/dist/devices-matter/DimmableLightAccessory.js +24 -27
- package/dist/devices-matter/DimmableLightAccessory.js.map +1 -1
- package/dist/devices-matter/DoorLockAccessory.d.ts +3 -1
- package/dist/devices-matter/DoorLockAccessory.d.ts.map +1 -1
- package/dist/devices-matter/DoorLockAccessory.js +25 -22
- package/dist/devices-matter/DoorLockAccessory.js.map +1 -1
- package/dist/devices-matter/ExtendedColorLightAccessory.d.ts +3 -1
- package/dist/devices-matter/ExtendedColorLightAccessory.d.ts.map +1 -1
- package/dist/devices-matter/ExtendedColorLightAccessory.js +40 -41
- package/dist/devices-matter/ExtendedColorLightAccessory.js.map +1 -1
- package/dist/devices-matter/FanAccessory.d.ts +3 -1
- package/dist/devices-matter/FanAccessory.d.ts.map +1 -1
- package/dist/devices-matter/FanAccessory.js +31 -23
- package/dist/devices-matter/FanAccessory.js.map +1 -1
- package/dist/devices-matter/HumiditySensorAccessory.d.ts +3 -1
- package/dist/devices-matter/HumiditySensorAccessory.d.ts.map +1 -1
- package/dist/devices-matter/HumiditySensorAccessory.js +16 -15
- package/dist/devices-matter/HumiditySensorAccessory.js.map +1 -1
- package/dist/devices-matter/LeakSensorAccessory.d.ts +3 -1
- package/dist/devices-matter/LeakSensorAccessory.d.ts.map +1 -1
- package/dist/devices-matter/LeakSensorAccessory.js +16 -13
- package/dist/devices-matter/LeakSensorAccessory.js.map +1 -1
- package/dist/devices-matter/LightSensorAccessory.d.ts +3 -1
- package/dist/devices-matter/LightSensorAccessory.d.ts.map +1 -1
- package/dist/devices-matter/LightSensorAccessory.js +16 -15
- package/dist/devices-matter/LightSensorAccessory.js.map +1 -1
- package/dist/devices-matter/OccupancySensorAccessory.d.ts +3 -1
- package/dist/devices-matter/OccupancySensorAccessory.d.ts.map +1 -1
- package/dist/devices-matter/OccupancySensorAccessory.js +17 -21
- package/dist/devices-matter/OccupancySensorAccessory.js.map +1 -1
- package/dist/devices-matter/OnOffLightAccessory.d.ts +3 -1
- package/dist/devices-matter/OnOffLightAccessory.d.ts.map +1 -1
- package/dist/devices-matter/OnOffLightAccessory.js +22 -21
- package/dist/devices-matter/OnOffLightAccessory.js.map +1 -1
- package/dist/devices-matter/OnOffOutletAccessory.d.ts +3 -3
- package/dist/devices-matter/OnOffOutletAccessory.d.ts.map +1 -1
- package/dist/devices-matter/OnOffOutletAccessory.js +24 -27
- package/dist/devices-matter/OnOffOutletAccessory.js.map +1 -1
- package/dist/devices-matter/OnOffSwitchAccessory.d.ts +3 -1
- package/dist/devices-matter/OnOffSwitchAccessory.d.ts.map +1 -1
- package/dist/devices-matter/OnOffSwitchAccessory.js +18 -19
- package/dist/devices-matter/OnOffSwitchAccessory.js.map +1 -1
- package/dist/devices-matter/RoboticVacuumAccessory.d.ts +3 -1
- package/dist/devices-matter/RoboticVacuumAccessory.d.ts.map +1 -1
- package/dist/devices-matter/RoboticVacuumAccessory.js +77 -145
- package/dist/devices-matter/RoboticVacuumAccessory.js.map +1 -1
- package/dist/devices-matter/TemperatureSensorAccessory.d.ts +3 -1
- package/dist/devices-matter/TemperatureSensorAccessory.d.ts.map +1 -1
- package/dist/devices-matter/TemperatureSensorAccessory.js +18 -15
- package/dist/devices-matter/TemperatureSensorAccessory.js.map +1 -1
- package/dist/devices-matter/ThermostatAccessory.d.ts +3 -1
- package/dist/devices-matter/ThermostatAccessory.d.ts.map +1 -1
- package/dist/devices-matter/ThermostatAccessory.js +37 -29
- package/dist/devices-matter/ThermostatAccessory.js.map +1 -1
- package/dist/devices-matter/VenetianBlindAccessory.d.ts +3 -1
- package/dist/devices-matter/VenetianBlindAccessory.d.ts.map +1 -1
- package/dist/devices-matter/VenetianBlindAccessory.js +39 -40
- package/dist/devices-matter/VenetianBlindAccessory.js.map +1 -1
- package/dist/devices-matter/WindowBlindAccessory.d.ts +3 -1
- package/dist/devices-matter/WindowBlindAccessory.d.ts.map +1 -1
- package/dist/devices-matter/WindowBlindAccessory.js +36 -37
- package/dist/devices-matter/WindowBlindAccessory.js.map +1 -1
- package/docs/variables/default.html +1 -1
- package/package.json +1 -1
- package/src/devices-matter/ColorLightAccessory.ts +37 -40
- package/src/devices-matter/ColorTemperatureLightAccessory.ts +35 -41
- package/src/devices-matter/ContactSensorAccessory.ts +18 -14
- package/src/devices-matter/DimmableLightAccessory.ts +26 -30
- package/src/devices-matter/DoorLockAccessory.ts +28 -24
- package/src/devices-matter/ExtendedColorLightAccessory.ts +43 -47
- package/src/devices-matter/FanAccessory.ts +33 -25
- package/src/devices-matter/HumiditySensorAccessory.ts +18 -16
- package/src/devices-matter/LeakSensorAccessory.ts +18 -14
- package/src/devices-matter/LightSensorAccessory.ts +18 -16
- package/src/devices-matter/OccupancySensorAccessory.ts +18 -22
- package/src/devices-matter/OnOffLightAccessory.ts +23 -23
- package/src/devices-matter/OnOffOutletAccessory.ts +25 -31
- package/src/devices-matter/OnOffSwitchAccessory.ts +20 -21
- package/src/devices-matter/RoboticVacuumAccessory.ts +79 -156
- package/src/devices-matter/TemperatureSensorAccessory.ts +20 -16
- package/src/devices-matter/ThermostatAccessory.ts +39 -34
- package/src/devices-matter/VenetianBlindAccessory.ts +41 -44
- package/src/devices-matter/WindowBlindAccessory.ts +37 -39
|
@@ -4,49 +4,48 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js';
|
|
6
6
|
export class VenetianBlindAccessory extends BaseMatterAccessory {
|
|
7
|
-
constructor(api, log) {
|
|
8
|
-
const serialNumber = 'BLIND-002';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
global: 0,
|
|
26
|
-
lift: 0,
|
|
27
|
-
tilt: 0,
|
|
28
|
-
},
|
|
29
|
-
endProductType: 8,
|
|
30
|
-
configStatus: {
|
|
31
|
-
operational: true,
|
|
32
|
-
onlineReserved: true,
|
|
33
|
-
liftMovementReversed: false,
|
|
34
|
-
liftPositionAware: true,
|
|
35
|
-
tiltPositionAware: true,
|
|
36
|
-
liftEncoderControlled: true,
|
|
37
|
-
tiltEncoderControlled: true,
|
|
38
|
-
},
|
|
7
|
+
constructor(api, log, opts) {
|
|
8
|
+
const serialNumber = opts?.serialNumber ?? 'BLIND-002';
|
|
9
|
+
const clusters = opts?.clusters ?? {
|
|
10
|
+
windowCovering: {
|
|
11
|
+
targetPositionLiftPercent100ths: 5000,
|
|
12
|
+
currentPositionLiftPercent100ths: 5000,
|
|
13
|
+
targetPositionTiltPercent100ths: 5000,
|
|
14
|
+
currentPositionTiltPercent100ths: 5000,
|
|
15
|
+
operationalStatus: { global: 0, lift: 0, tilt: 0 },
|
|
16
|
+
endProductType: 8,
|
|
17
|
+
configStatus: {
|
|
18
|
+
operational: true,
|
|
19
|
+
onlineReserved: true,
|
|
20
|
+
liftMovementReversed: false,
|
|
21
|
+
liftPositionAware: true,
|
|
22
|
+
tiltPositionAware: true,
|
|
23
|
+
liftEncoderControlled: true,
|
|
24
|
+
tiltEncoderControlled: true,
|
|
39
25
|
},
|
|
40
26
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
};
|
|
28
|
+
const handlers = opts?.handlers ?? {
|
|
29
|
+
windowCovering: {
|
|
30
|
+
goToLiftPercentage: async (request) => this.handleGoToLift(request),
|
|
31
|
+
goToTiltPercentage: async (request) => this.handleGoToTilt(request),
|
|
32
|
+
upOrOpen: async () => this.handleUpOrOpen(),
|
|
33
|
+
downOrClose: async () => this.handleDownOrClose(),
|
|
34
|
+
stopMotion: async () => this.handleStop(),
|
|
49
35
|
},
|
|
36
|
+
};
|
|
37
|
+
super(api, log, {
|
|
38
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
39
|
+
displayName: opts?.displayName ?? 'Venetian Blind (Tilt)',
|
|
40
|
+
deviceType: api.matter.deviceTypes.WindowCovering,
|
|
41
|
+
serialNumber,
|
|
42
|
+
manufacturer: opts?.manufacturer ?? 'Homebridge Matter',
|
|
43
|
+
model: opts?.model ?? 'HB-MATTER-BLIND-VENETIAN',
|
|
44
|
+
firmwareRevision: opts?.firmwareRevision ?? '2.0.0',
|
|
45
|
+
hardwareRevision: opts?.hardwareRevision ?? '1.0.0',
|
|
46
|
+
clusters,
|
|
47
|
+
handlers,
|
|
48
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
50
49
|
});
|
|
51
50
|
this.logInfo('initialized.');
|
|
52
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VenetianBlindAccessory.js","sourceRoot":"","sources":["../../src/devices-matter/VenetianBlindAccessory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IAC7D,YAAY,GAAQ,EAAE,GAAW;
|
|
1
|
+
{"version":3,"file":"VenetianBlindAccessory.js","sourceRoot":"","sources":["../../src/devices-matter/VenetianBlindAccessory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IAC7D,YAAY,GAAQ,EAAE,GAAW,EAAE,IAAiG;QAClI,MAAM,YAAY,GAAG,IAAI,EAAE,YAAY,IAAI,WAAW,CAAA;QAEtD,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI;YACjC,cAAc,EAAE;gBACd,+BAA+B,EAAE,IAAI;gBACrC,gCAAgC,EAAE,IAAI;gBACtC,+BAA+B,EAAE,IAAI;gBACrC,gCAAgC,EAAE,IAAI;gBACtC,iBAAiB,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;gBAClD,cAAc,EAAE,CAAC;gBACjB,YAAY,EAAE;oBACZ,WAAW,EAAE,IAAI;oBACjB,cAAc,EAAE,IAAI;oBACpB,oBAAoB,EAAE,KAAK;oBAC3B,iBAAiB,EAAE,IAAI;oBACvB,iBAAiB,EAAE,IAAI;oBACvB,qBAAqB,EAAE,IAAI;oBAC3B,qBAAqB,EAAE,IAAI;iBAC5B;aACF;SACF,CAAA;QAED,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI;YACjC,cAAc,EAAE;gBACd,kBAAkB,EAAE,KAAK,EAAE,OAA0C,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACtG,kBAAkB,EAAE,KAAK,EAAE,OAA0C,E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QACpF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,CAAA;QAChD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,EAAE;YAC5D,gCAAgC,EAAE,KAAK;YACvC,+BAA+B,EAAE,KAAK;SACvC,CAAC,CAAA;QACF,IAAI,CAAC,OAAO,CAAC,kBAAkB,OAAO,IAAI,CAAC,CAAA;IAC7C,CAAC;CACF"}
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
import type { API, Logger } from 'homebridge';
|
|
6
6
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js';
|
|
7
7
|
export declare class WindowBlindAccessory extends BaseMatterAccessory {
|
|
8
|
-
constructor(api: API, log: Logger)
|
|
8
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & {
|
|
9
|
+
deviceId?: string;
|
|
10
|
+
}>);
|
|
9
11
|
private handleGoToLift;
|
|
10
12
|
private handleUpOrOpen;
|
|
11
13
|
private handleDownOrClose;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WindowBlindAccessory.d.ts","sourceRoot":"","sources":["../../src/devices-matter/WindowBlindAccessory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAkB,MAAM,YAAY,CAAA;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,qBAAa,oBAAqB,SAAQ,mBAAmB;gBAC/C,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"WindowBlindAccessory.d.ts","sourceRoot":"","sources":["../../src/devices-matter/WindowBlindAccessory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAkB,MAAM,YAAY,CAAA;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,qBAAa,oBAAqB,SAAQ,mBAAmB;gBAC/C,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,OAAO,uBAAuB,EAAE,yBAAyB,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;YA+CtH,cAAc;YASd,cAAc;YAKd,iBAAiB;YAKjB,UAAU;IAKjB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAUrD"}
|
|
@@ -4,46 +4,45 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js';
|
|
6
6
|
export class WindowBlindAccessory extends BaseMatterAccessory {
|
|
7
|
-
constructor(api, log) {
|
|
8
|
-
const serialNumber = 'BLIND-001';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
global: 0,
|
|
24
|
-
lift: 0,
|
|
25
|
-
tilt: 0,
|
|
26
|
-
},
|
|
27
|
-
endProductType: 0,
|
|
28
|
-
configStatus: {
|
|
29
|
-
operational: true,
|
|
30
|
-
onlineReserved: true,
|
|
31
|
-
liftMovementReversed: false,
|
|
32
|
-
liftPositionAware: true,
|
|
33
|
-
tiltPositionAware: false,
|
|
34
|
-
liftEncoderControlled: true,
|
|
35
|
-
tiltEncoderControlled: false,
|
|
36
|
-
},
|
|
7
|
+
constructor(api, log, opts) {
|
|
8
|
+
const serialNumber = opts?.serialNumber ?? 'BLIND-001';
|
|
9
|
+
const clusters = opts?.clusters ?? {
|
|
10
|
+
windowCovering: {
|
|
11
|
+
targetPositionLiftPercent100ths: 5000,
|
|
12
|
+
currentPositionLiftPercent100ths: 5000,
|
|
13
|
+
operationalStatus: { global: 0, lift: 0, tilt: 0 },
|
|
14
|
+
endProductType: 0,
|
|
15
|
+
configStatus: {
|
|
16
|
+
operational: true,
|
|
17
|
+
onlineReserved: true,
|
|
18
|
+
liftMovementReversed: false,
|
|
19
|
+
liftPositionAware: true,
|
|
20
|
+
tiltPositionAware: false,
|
|
21
|
+
liftEncoderControlled: true,
|
|
22
|
+
tiltEncoderControlled: false,
|
|
37
23
|
},
|
|
38
24
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
};
|
|
26
|
+
const handlers = opts?.handlers ?? {
|
|
27
|
+
windowCovering: {
|
|
28
|
+
goToLiftPercentage: async (request) => this.handleGoToLift(request),
|
|
29
|
+
upOrOpen: async () => this.handleUpOrOpen(),
|
|
30
|
+
downOrClose: async () => this.handleDownOrClose(),
|
|
31
|
+
stopMotion: async () => this.handleStop(),
|
|
46
32
|
},
|
|
33
|
+
};
|
|
34
|
+
super(api, log, {
|
|
35
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
36
|
+
displayName: opts?.displayName ?? 'Window Blind',
|
|
37
|
+
deviceType: api.matter.deviceTypes.WindowCovering,
|
|
38
|
+
serialNumber,
|
|
39
|
+
manufacturer: opts?.manufacturer ?? 'Homebridge Matter',
|
|
40
|
+
model: opts?.model ?? 'HB-MATTER-BLIND-WINDOW',
|
|
41
|
+
firmwareRevision: opts?.firmwareRevision ?? '2.0.0',
|
|
42
|
+
hardwareRevision: opts?.hardwareRevision ?? '1.0.0',
|
|
43
|
+
clusters,
|
|
44
|
+
handlers,
|
|
45
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
47
46
|
});
|
|
48
47
|
this.logInfo('initialized.');
|
|
49
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WindowBlindAccessory.js","sourceRoot":"","sources":["../../src/devices-matter/WindowBlindAccessory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,MAAM,OAAO,oBAAqB,SAAQ,mBAAmB;IAC3D,YAAY,GAAQ,EAAE,GAAW;
|
|
1
|
+
{"version":3,"file":"WindowBlindAccessory.js","sourceRoot":"","sources":["../../src/devices-matter/WindowBlindAccessory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,MAAM,OAAO,oBAAqB,SAAQ,mBAAmB;IAC3D,YAAY,GAAQ,EAAE,GAAW,EAAE,IAAiG;QAClI,MAAM,YAAY,GAAG,IAAI,EAAE,YAAY,IAAI,WAAW,CAAA;QAEtD,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI;YACjC,cAAc,EAAE;gBACd,+BAA+B,EAAE,IAAI;gBACrC,gCAAgC,EAAE,IAAI;gBACtC,iBAAiB,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;gBAClD,cAAc,EAAE,CAAC;gBACjB,YAAY,EAAE;oBACZ,WAAW,EAAE,IAAI;oBACjB,cAAc,EAAE,IAAI;oBACpB,oBAAoB,EAAE,KAAK;oBAC3B,iBAAiB,EAAE,IAAI;oBACvB,iBAAiB,EAAE,KAAK;oBACxB,qBAAqB,EAAE,IAAI;oBAC3B,qBAAqB,EAAE,KAAK;iBAC7B;aACF;SACF,CAAA;QAED,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI;YACjC,cAAc,EAAE;gBACd,kBAAkB,EAAE,KAAK,EAAE,OAA0C,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACtG,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI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C,kDAAkD;IACpD,CAAC;IAEO,KAAK,CAAC,cAAc;QAC1B,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;QAC7B,gCAAgC;IAClC,CAAC;IAEO,KAAK,CAAC,iBAAiB;QAC7B,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;QAC7B,iCAAiC;IACnC,CAAC;IAEO,KAAK,CAAC,UAAU;QACtB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;QAC9B,gCAAgC;IAClC,CAAC;IAEM,kBAAkB,CAAC,WAAmB;QAC3C,+EAA+E;QAC/E,MAAM,aAAa,GAAG,GAAG,GAAG,WAAW,CAAA;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,GAAG,CAAC,CAAA;QAC7C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,EAAE;YAC5D,gCAAgC,EAAE,KAAK;YACvC,+BAA+B,EAAE,KAAK;SACvC,CAAC,CAAA;QACF,IAAI,CAAC,OAAO,CAAC,kBAAkB,WAAW,SAAS,CAAC,CAAA;IACtD,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/56f6da4f42b660e2ff5b9a231f1f0c632265fc7f/src/index.ts#L12">index.ts:12</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@switchbot/homebridge-switchbot",
|
|
3
3
|
"displayName": "SwitchBot",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "5.0.0-beta.
|
|
5
|
+
"version": "5.0.0-beta.2",
|
|
6
6
|
"description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
|
|
7
7
|
"author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
|
|
8
8
|
"contributors": [
|
|
@@ -8,50 +8,47 @@ import type { API, Logger, MatterRequests } from 'homebridge'
|
|
|
8
8
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js'
|
|
9
9
|
|
|
10
10
|
export class ColorLightAccessory extends BaseMatterAccessory {
|
|
11
|
-
constructor(api: API, log: Logger) {
|
|
12
|
-
const serialNumber = 'LIGHT-004'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
manufacturer: 'Homebridge Matter',
|
|
19
|
-
model: 'HB-MATTER-LIGHT-COLOUR-HS',
|
|
20
|
-
firmwareRevision: '2.0.0',
|
|
21
|
-
hardwareRevision: '1.0.0',
|
|
11
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
12
|
+
const serialNumber = opts?.serialNumber ?? 'LIGHT-004'
|
|
13
|
+
const displayName = opts?.displayName ?? 'Colour Light (HS)'
|
|
14
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
15
|
+
const model = opts?.model ?? 'HB-MATTER-LIGHT-COLOUR-HS'
|
|
16
|
+
const firmwareRevision = opts?.firmwareRevision ?? '2.0.0'
|
|
17
|
+
const hardwareRevision = opts?.hardwareRevision ?? '1.0.0'
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
currentHue: 0,
|
|
33
|
-
currentSaturation: 254,
|
|
34
|
-
currentX: 41942,
|
|
35
|
-
currentY: 21626,
|
|
36
|
-
},
|
|
19
|
+
const clusters = opts?.clusters ?? {
|
|
20
|
+
onOff: { onOff: false },
|
|
21
|
+
levelControl: { currentLevel: 127, minLevel: 1, maxLevel: 254 },
|
|
22
|
+
colorControl: {
|
|
23
|
+
colorMode: api.matter.types.ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
24
|
+
currentHue: 0,
|
|
25
|
+
currentSaturation: 254,
|
|
26
|
+
currentX: 41942,
|
|
27
|
+
currentY: 21626,
|
|
37
28
|
},
|
|
29
|
+
}
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
moveToLevelWithOnOff: async (request: MatterRequests.MoveToLevel) =>
|
|
46
|
-
this.handleSetLevel(request),
|
|
47
|
-
},
|
|
48
|
-
colorControl: {
|
|
49
|
-
moveToColorLogic: async (request: MatterRequests.MoveToColor) =>
|
|
50
|
-
this.handleSetColor(request),
|
|
51
|
-
moveToHueAndSaturationLogic: async (request: MatterRequests.MoveToHueAndSaturation) =>
|
|
52
|
-
this.handleSetHueSaturation(request),
|
|
53
|
-
},
|
|
31
|
+
const handlers = opts?.handlers ?? {
|
|
32
|
+
onOff: { on: async () => this.handleOn(), off: async () => this.handleOff() },
|
|
33
|
+
levelControl: { moveToLevelWithOnOff: async (request: MatterRequests.MoveToLevel) => this.handleSetLevel(request) },
|
|
34
|
+
colorControl: {
|
|
35
|
+
moveToColorLogic: async (request: MatterRequests.MoveToColor) => this.handleSetColor(request),
|
|
36
|
+
moveToHueAndSaturationLogic: async (request: MatterRequests.MoveToHueAndSaturation) => this.handleSetHueSaturation(request),
|
|
54
37
|
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
super(api, log, {
|
|
41
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
42
|
+
displayName,
|
|
43
|
+
deviceType: api.matter.deviceTypes.ExtendedColorLight,
|
|
44
|
+
serialNumber,
|
|
45
|
+
manufacturer,
|
|
46
|
+
model,
|
|
47
|
+
firmwareRevision,
|
|
48
|
+
hardwareRevision,
|
|
49
|
+
clusters,
|
|
50
|
+
handlers,
|
|
51
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
55
52
|
})
|
|
56
53
|
|
|
57
54
|
this.logInfo('initialized.')
|
|
@@ -7,50 +7,44 @@ import type { API, Logger, MatterRequests } from 'homebridge'
|
|
|
7
7
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js'
|
|
8
8
|
|
|
9
9
|
export class ColorTemperatureLightAccessory extends BaseMatterAccessory {
|
|
10
|
-
constructor(api: API, log: Logger) {
|
|
11
|
-
const serialNumber = 'LIGHT-003'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
manufacturer: 'Homebridge Matter',
|
|
18
|
-
model: 'HB-MATTER-LIGHT-COLOUR-TEMP',
|
|
19
|
-
firmwareRevision: '2.0.0',
|
|
20
|
-
hardwareRevision: '1.0.0',
|
|
10
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
11
|
+
const serialNumber = opts?.serialNumber ?? 'LIGHT-003'
|
|
12
|
+
const displayName = opts?.displayName ?? 'Colour Temperature Light'
|
|
13
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
14
|
+
const model = opts?.model ?? 'HB-MATTER-LIGHT-COLOUR-TEMP'
|
|
15
|
+
const firmwareRevision = opts?.firmwareRevision ?? '2.0.0'
|
|
16
|
+
const hardwareRevision = opts?.hardwareRevision ?? '1.0.0'
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
colorControl: {
|
|
32
|
-
colorMode: api.matter.types.ColorControl.ColorMode.ColorTemperatureMireds,
|
|
33
|
-
colorTemperatureMireds: 250,
|
|
34
|
-
colorTempPhysicalMinMireds: 147,
|
|
35
|
-
colorTempPhysicalMaxMireds: 454,
|
|
36
|
-
coupleColorTempToLevelMinMireds: 147,
|
|
37
|
-
},
|
|
18
|
+
const clusters = opts?.clusters ?? {
|
|
19
|
+
onOff: { onOff: false },
|
|
20
|
+
levelControl: { currentLevel: 127, minLevel: 1, maxLevel: 254 },
|
|
21
|
+
colorControl: {
|
|
22
|
+
colorMode: api.matter.types.ColorControl.ColorMode.ColorTemperatureMireds,
|
|
23
|
+
colorTemperatureMireds: 250,
|
|
24
|
+
colorTempPhysicalMinMireds: 147,
|
|
25
|
+
colorTempPhysicalMaxMireds: 454,
|
|
26
|
+
coupleColorTempToLevelMinMireds: 147,
|
|
38
27
|
},
|
|
28
|
+
}
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
const handlers = opts?.handlers ?? {
|
|
31
|
+
onOff: { on: async () => this.handleOn(), off: async () => this.handleOff() },
|
|
32
|
+
levelControl: { moveToLevelWithOnOff: async (request: MatterRequests.MoveToLevel) => this.handleSetLevel(request) },
|
|
33
|
+
colorControl: { moveToColorTemperatureLogic: async (request: MatterRequests.MoveToColorTemperature) => this.handleSetColorTemperature(request) },
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
super(api, log, {
|
|
37
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
38
|
+
displayName,
|
|
39
|
+
deviceType: api.matter.deviceTypes.ColorTemperatureLight,
|
|
40
|
+
serialNumber,
|
|
41
|
+
manufacturer,
|
|
42
|
+
model,
|
|
43
|
+
firmwareRevision,
|
|
44
|
+
hardwareRevision,
|
|
45
|
+
clusters,
|
|
46
|
+
handlers,
|
|
47
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
54
48
|
})
|
|
55
49
|
|
|
56
50
|
this.logInfo('initialized.')
|
|
@@ -7,23 +7,27 @@ import type { API, Logger } from 'homebridge'
|
|
|
7
7
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js'
|
|
8
8
|
|
|
9
9
|
export class ContactSensorAccessory extends BaseMatterAccessory {
|
|
10
|
-
constructor(api: API, log: Logger) {
|
|
11
|
-
const serialNumber = 'SENSOR-001'
|
|
10
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
11
|
+
const serialNumber = opts?.serialNumber ?? 'SENSOR-001'
|
|
12
|
+
const displayName = opts?.displayName ?? 'Contact Sensor'
|
|
13
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
14
|
+
const model = opts?.model ?? 'HB-MATTER-SENSOR-CONTACT'
|
|
15
|
+
const firmwareRevision = opts?.firmwareRevision ?? '2.0.0'
|
|
16
|
+
const hardwareRevision = opts?.hardwareRevision ?? '1.0.0'
|
|
17
|
+
|
|
18
|
+
const clusters = opts?.clusters ?? { booleanState: { stateValue: true } }
|
|
19
|
+
|
|
12
20
|
super(api, log, {
|
|
13
|
-
uuid: api.matter.uuid.generate(serialNumber),
|
|
14
|
-
displayName
|
|
21
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
22
|
+
displayName,
|
|
15
23
|
deviceType: api.matter.deviceTypes.ContactSensor,
|
|
16
24
|
serialNumber,
|
|
17
|
-
manufacturer
|
|
18
|
-
model
|
|
19
|
-
firmwareRevision
|
|
20
|
-
hardwareRevision
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
booleanState: {
|
|
24
|
-
stateValue: true, // matter: true = closed/normal, false = open/triggered
|
|
25
|
-
},
|
|
26
|
-
},
|
|
25
|
+
manufacturer,
|
|
26
|
+
model,
|
|
27
|
+
firmwareRevision,
|
|
28
|
+
hardwareRevision,
|
|
29
|
+
clusters,
|
|
30
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
27
31
|
})
|
|
28
32
|
|
|
29
33
|
this.logInfo('initialized.')
|
|
@@ -22,16 +22,31 @@ export class DimmableLightAccessory extends BaseMatterAccessory {
|
|
|
22
22
|
// Track current state
|
|
23
23
|
private currentLevel: number = 127 // 50% brightness
|
|
24
24
|
|
|
25
|
-
constructor(api: API, log: Logger) {
|
|
26
|
-
const serialNumber = 'LIGHT-002'
|
|
27
|
-
const displayName = 'Dimmable Light'
|
|
28
|
-
const manufacturer = 'Homebridge Matter'
|
|
29
|
-
const model = 'HB-MATTER-LIGHT-DIMMABLE'
|
|
30
|
-
const firmwareRevision = '2.0.0'
|
|
31
|
-
const hardwareRevision = '1.0.0'
|
|
25
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
26
|
+
const serialNumber = opts?.serialNumber ?? 'LIGHT-002'
|
|
27
|
+
const displayName = opts?.displayName ?? 'Dimmable Light'
|
|
28
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
29
|
+
const model = opts?.model ?? 'HB-MATTER-LIGHT-DIMMABLE'
|
|
30
|
+
const firmwareRevision = opts?.firmwareRevision ?? '2.0.0'
|
|
31
|
+
const hardwareRevision = opts?.hardwareRevision ?? '1.0.0'
|
|
32
|
+
|
|
33
|
+
const clusters = opts?.clusters ?? {
|
|
34
|
+
onOff: { onOff: false },
|
|
35
|
+
levelControl: { currentLevel: 127, minLevel: 1, maxLevel: 254 },
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const handlers = opts?.handlers ?? {
|
|
39
|
+
onOff: {
|
|
40
|
+
on: async () => this.handleOn(),
|
|
41
|
+
off: async () => this.handleOff(),
|
|
42
|
+
},
|
|
43
|
+
levelControl: {
|
|
44
|
+
moveToLevelWithOnOff: async (request: MatterRequests.MoveToLevel) => this.handleSetLevel(request),
|
|
45
|
+
},
|
|
46
|
+
}
|
|
32
47
|
|
|
33
48
|
super(api, log, {
|
|
34
|
-
uuid: api.matter.uuid.generate(serialNumber),
|
|
49
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
35
50
|
displayName,
|
|
36
51
|
deviceType: api.matter.deviceTypes.DimmableLight,
|
|
37
52
|
serialNumber,
|
|
@@ -39,28 +54,9 @@ export class DimmableLightAccessory extends BaseMatterAccessory {
|
|
|
39
54
|
model,
|
|
40
55
|
firmwareRevision,
|
|
41
56
|
hardwareRevision,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onOff: false,
|
|
46
|
-
},
|
|
47
|
-
levelControl: {
|
|
48
|
-
currentLevel: 127, // 50% brightness (range 1-254)
|
|
49
|
-
minLevel: 1,
|
|
50
|
-
maxLevel: 254,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
handlers: {
|
|
55
|
-
onOff: {
|
|
56
|
-
on: async () => this.handleOn(),
|
|
57
|
-
off: async () => this.handleOff(),
|
|
58
|
-
},
|
|
59
|
-
levelControl: {
|
|
60
|
-
moveToLevelWithOnOff: async (request: MatterRequests.MoveToLevel) =>
|
|
61
|
-
this.handleSetLevel(request),
|
|
62
|
-
},
|
|
63
|
-
},
|
|
57
|
+
clusters,
|
|
58
|
+
handlers,
|
|
59
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
64
60
|
})
|
|
65
61
|
|
|
66
62
|
this.logInfo('initialized.')
|
|
@@ -7,33 +7,37 @@ import type { API, Logger } from 'homebridge'
|
|
|
7
7
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js'
|
|
8
8
|
|
|
9
9
|
export class DoorLockAccessory extends BaseMatterAccessory {
|
|
10
|
-
constructor(api: API, log: Logger) {
|
|
11
|
-
const serialNumber = 'LOCK-001'
|
|
10
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
11
|
+
const serialNumber = opts?.serialNumber ?? 'LOCK-001'
|
|
12
|
+
const displayName = opts?.displayName ?? 'Door Lock'
|
|
13
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
14
|
+
const model = opts?.model ?? 'HB-MATTER-LOCK-DOOR'
|
|
15
|
+
const firmwareRevision = opts?.firmwareRevision ?? '2.0.0'
|
|
16
|
+
const hardwareRevision = opts?.hardwareRevision ?? '1.0.0'
|
|
17
|
+
|
|
18
|
+
const clusters = opts?.clusters ?? {
|
|
19
|
+
doorLock: {
|
|
20
|
+
lockState: api.matter.types.DoorLock.LockState.Unlocked,
|
|
21
|
+
lockType: api.matter.types.DoorLock.LockType.DeadBolt,
|
|
22
|
+
actuatorEnabled: true,
|
|
23
|
+
operatingMode: api.matter.types.DoorLock.OperatingMode.Normal,
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const handlers = opts?.handlers ?? { doorLock: { lockDoor: async () => this.handleLock(), unlockDoor: async () => this.handleUnlock() } }
|
|
28
|
+
|
|
12
29
|
super(api, log, {
|
|
13
|
-
uuid: api.matter.uuid.generate(serialNumber),
|
|
14
|
-
displayName
|
|
30
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
31
|
+
displayName,
|
|
15
32
|
deviceType: api.matter.deviceTypes.DoorLock,
|
|
16
33
|
serialNumber,
|
|
17
|
-
manufacturer
|
|
18
|
-
model
|
|
19
|
-
firmwareRevision
|
|
20
|
-
hardwareRevision
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
lockState: api.matter.types.DoorLock.LockState.Unlocked,
|
|
25
|
-
lockType: api.matter.types.DoorLock.LockType.DeadBolt,
|
|
26
|
-
actuatorEnabled: true,
|
|
27
|
-
operatingMode: api.matter.types.DoorLock.OperatingMode.Normal,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
handlers: {
|
|
32
|
-
doorLock: {
|
|
33
|
-
lockDoor: async () => this.handleLock(),
|
|
34
|
-
unlockDoor: async () => this.handleUnlock(),
|
|
35
|
-
},
|
|
36
|
-
},
|
|
34
|
+
manufacturer,
|
|
35
|
+
model,
|
|
36
|
+
firmwareRevision,
|
|
37
|
+
hardwareRevision,
|
|
38
|
+
clusters,
|
|
39
|
+
handlers,
|
|
40
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
37
41
|
})
|
|
38
42
|
|
|
39
43
|
this.logInfo('initialized.')
|