@switchbot/homebridge-switchbot 5.0.0-beta.1 → 5.0.0-beta.3
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/dist/platform-matter.d.ts +15 -0
- package/dist/platform-matter.d.ts.map +1 -1
- package/dist/platform-matter.js +82 -1
- package/dist/platform-matter.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
- package/src/platform-matter.ts +92 -1
|
@@ -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.')
|
|
@@ -8,56 +8,52 @@ import type { API, Logger, MatterRequests } from 'homebridge'
|
|
|
8
8
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js'
|
|
9
9
|
|
|
10
10
|
export class ExtendedColorLightAccessory extends BaseMatterAccessory {
|
|
11
|
-
constructor(api: API, log: Logger) {
|
|
12
|
-
const serialNumber = 'LIGHT-005'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
currentHue: 0,
|
|
33
|
-
currentSaturation: 254,
|
|
34
|
-
currentX: 41942,
|
|
35
|
-
currentY: 21626,
|
|
36
|
-
colorTemperatureMireds: 250,
|
|
37
|
-
colorTempPhysicalMinMireds: 147,
|
|
38
|
-
colorTempPhysicalMaxMireds: 454,
|
|
39
|
-
coupleColorTempToLevelMinMireds: 147,
|
|
40
|
-
},
|
|
11
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
12
|
+
const serialNumber = opts?.serialNumber ?? 'LIGHT-005'
|
|
13
|
+
const displayName = opts?.displayName ?? 'Extended Colour Light (HS+CCT)'
|
|
14
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
15
|
+
const model = opts?.model ?? 'HB-MATTER-LIGHT-EXTENDED-COLOUR'
|
|
16
|
+
const firmwareRevision = opts?.firmwareRevision ?? '2.0.0'
|
|
17
|
+
const hardwareRevision = opts?.hardwareRevision ?? '1.0.0'
|
|
18
|
+
|
|
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,
|
|
28
|
+
colorTemperatureMireds: 250,
|
|
29
|
+
colorTempPhysicalMinMireds: 147,
|
|
30
|
+
colorTempPhysicalMaxMireds: 454,
|
|
31
|
+
coupleColorTempToLevelMinMireds: 147,
|
|
41
32
|
},
|
|
33
|
+
}
|
|
42
34
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.handleSetLevel(request),
|
|
51
|
-
},
|
|
52
|
-
colorControl: {
|
|
53
|
-
moveToColorLogic: async (request: MatterRequests.MoveToColor) =>
|
|
54
|
-
this.handleSetColor(request),
|
|
55
|
-
moveToHueAndSaturationLogic: async (request: MatterRequests.MoveToHueAndSaturation) =>
|
|
56
|
-
this.handleSetHueSaturation(request),
|
|
57
|
-
moveToColorTemperatureLogic: async (request: MatterRequests.MoveToColorTemperature) =>
|
|
58
|
-
this.handleSetColorTemperature(request),
|
|
59
|
-
},
|
|
35
|
+
const handlers = opts?.handlers ?? {
|
|
36
|
+
onOff: { on: async () => this.handleOn(), off: async () => this.handleOff() },
|
|
37
|
+
levelControl: { moveToLevelWithOnOff: async (request: MatterRequests.MoveToLevel) => this.handleSetLevel(request) },
|
|
38
|
+
colorControl: {
|
|
39
|
+
moveToColorLogic: async (request: MatterRequests.MoveToColor) => this.handleSetColor(request),
|
|
40
|
+
moveToHueAndSaturationLogic: async (request: MatterRequests.MoveToHueAndSaturation) => this.handleSetHueSaturation(request),
|
|
41
|
+
moveToColorTemperatureLogic: async (request: MatterRequests.MoveToColorTemperature) => this.handleSetColorTemperature(request),
|
|
60
42
|
},
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
super(api, log, {
|
|
46
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
47
|
+
displayName,
|
|
48
|
+
deviceType: api.matter.deviceTypes.ExtendedColorLight,
|
|
49
|
+
serialNumber,
|
|
50
|
+
manufacturer,
|
|
51
|
+
model,
|
|
52
|
+
firmwareRevision,
|
|
53
|
+
hardwareRevision,
|
|
54
|
+
clusters,
|
|
55
|
+
handlers,
|
|
56
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
61
57
|
})
|
|
62
58
|
|
|
63
59
|
this.logInfo('initialized.')
|
|
@@ -7,35 +7,43 @@ import type { API, Logger, MatterRequests } from 'homebridge'
|
|
|
7
7
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js'
|
|
8
8
|
|
|
9
9
|
export class FanAccessory extends BaseMatterAccessory {
|
|
10
|
-
constructor(api: API, log: Logger) {
|
|
11
|
-
const serialNumber = 'FAN-001'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
manufacturer: 'Homebridge Matter',
|
|
18
|
-
model: 'HB-MATTER-FAN',
|
|
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 ?? 'FAN-001'
|
|
12
|
+
const displayName = opts?.displayName ?? 'Fan'
|
|
13
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
14
|
+
const model = opts?.model ?? 'HB-MATTER-FAN'
|
|
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
|
-
},
|
|
18
|
+
const clusters = opts?.clusters ?? {
|
|
19
|
+
fanControl: {
|
|
20
|
+
fanMode: api.matter.types.FanControl.FanMode.Off,
|
|
21
|
+
fanModeSequence: api.matter.types.FanControl.FanModeSequence.OffLowMedHigh,
|
|
22
|
+
percentSetting: 0,
|
|
23
|
+
percentCurrent: 0,
|
|
29
24
|
},
|
|
25
|
+
}
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.handlePercentSettingChange(request),
|
|
37
|
-
},
|
|
27
|
+
const handlers = opts?.handlers ?? {
|
|
28
|
+
fanControl: {
|
|
29
|
+
step: async (request: MatterRequests.FanStep) => this.handleStep(request),
|
|
30
|
+
fanModeChange: async (request: { fanMode: number, oldFanMode: number }) => this.handleFanModeChange(request),
|
|
31
|
+
percentSettingChange: async (request: { percentSetting: number | null, oldPercentSetting: number | null }) => this.handlePercentSettingChange(request),
|
|
38
32
|
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
super(api, log, {
|
|
36
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
37
|
+
displayName,
|
|
38
|
+
deviceType: api.matter.deviceTypes.Fan,
|
|
39
|
+
serialNumber,
|
|
40
|
+
manufacturer,
|
|
41
|
+
model,
|
|
42
|
+
firmwareRevision,
|
|
43
|
+
hardwareRevision,
|
|
44
|
+
clusters,
|
|
45
|
+
handlers,
|
|
46
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
39
47
|
})
|
|
40
48
|
|
|
41
49
|
this.logInfo('initialized.')
|
|
@@ -7,25 +7,27 @@ import type { API, Logger } from 'homebridge'
|
|
|
7
7
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js'
|
|
8
8
|
|
|
9
9
|
export class HumiditySensorAccessory extends BaseMatterAccessory {
|
|
10
|
-
constructor(api: API, log: Logger) {
|
|
11
|
-
const serialNumber = 'SENSOR-005'
|
|
10
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
11
|
+
const serialNumber = opts?.serialNumber ?? 'SENSOR-005'
|
|
12
|
+
const displayName = opts?.displayName ?? 'Humidity Sensor'
|
|
13
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
14
|
+
const model = opts?.model ?? 'HB-MATTER-SENSOR-HUMIDITY'
|
|
15
|
+
const firmwareRevision = opts?.firmwareRevision ?? '2.0.0'
|
|
16
|
+
const hardwareRevision = opts?.hardwareRevision ?? '1.0.0'
|
|
17
|
+
|
|
18
|
+
const clusters = opts?.clusters ?? { relativeHumidityMeasurement: { measuredValue: 5500, minMeasuredValue: 0, maxMeasuredValue: 10000 } }
|
|
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.HumiditySensor,
|
|
16
24
|
serialNumber,
|
|
17
|
-
manufacturer
|
|
18
|
-
model
|
|
19
|
-
firmwareRevision
|
|
20
|
-
hardwareRevision
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
relativeHumidityMeasurement: {
|
|
24
|
-
measuredValue: 5500, // 55% (in hundredths of a percent)
|
|
25
|
-
minMeasuredValue: 0,
|
|
26
|
-
maxMeasuredValue: 10000,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
25
|
+
manufacturer,
|
|
26
|
+
model,
|
|
27
|
+
firmwareRevision,
|
|
28
|
+
hardwareRevision,
|
|
29
|
+
clusters,
|
|
30
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
29
31
|
})
|
|
30
32
|
|
|
31
33
|
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 LeakSensorAccessory extends BaseMatterAccessory {
|
|
10
|
-
constructor(api: API, log: Logger) {
|
|
11
|
-
const serialNumber = 'SENSOR-007'
|
|
10
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
11
|
+
const serialNumber = opts?.serialNumber ?? 'SENSOR-007'
|
|
12
|
+
const displayName = opts?.displayName ?? 'Leak Sensor'
|
|
13
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
14
|
+
const model = opts?.model ?? 'HB-MATTER-SENSOR-LEAK'
|
|
15
|
+
const firmwareRevision = opts?.firmwareRevision ?? '2.0.0'
|
|
16
|
+
const hardwareRevision = opts?.hardwareRevision ?? '1.0.0'
|
|
17
|
+
|
|
18
|
+
const clusters = opts?.clusters ?? { booleanState: { stateValue: false } }
|
|
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.LeakSensor,
|
|
16
24
|
serialNumber,
|
|
17
|
-
manufacturer
|
|
18
|
-
model
|
|
19
|
-
firmwareRevision
|
|
20
|
-
hardwareRevision
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
booleanState: {
|
|
24
|
-
stateValue: false, // false = dry, true = leak
|
|
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.')
|
|
@@ -7,25 +7,27 @@ import type { API, Logger } from 'homebridge'
|
|
|
7
7
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js'
|
|
8
8
|
|
|
9
9
|
export class LightSensorAccessory extends BaseMatterAccessory {
|
|
10
|
-
constructor(api: API, log: Logger) {
|
|
11
|
-
const serialNumber = 'SENSOR-002'
|
|
10
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
11
|
+
const serialNumber = opts?.serialNumber ?? 'SENSOR-002'
|
|
12
|
+
const displayName = opts?.displayName ?? 'Light Sensor'
|
|
13
|
+
const manufacturer = opts?.manufacturer ?? 'Homebridge Matter'
|
|
14
|
+
const model = opts?.model ?? 'HB-MATTER-SENSOR-LIGHT'
|
|
15
|
+
const firmwareRevision = opts?.firmwareRevision ?? '2.0.0'
|
|
16
|
+
const hardwareRevision = opts?.hardwareRevision ?? '1.0.0'
|
|
17
|
+
|
|
18
|
+
const clusters = opts?.clusters ?? { illuminanceMeasurement: { measuredValue: 5000, minMeasuredValue: 1, maxMeasuredValue: 65534 } }
|
|
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.LightSensor,
|
|
16
24
|
serialNumber,
|
|
17
|
-
manufacturer
|
|
18
|
-
model
|
|
19
|
-
firmwareRevision
|
|
20
|
-
hardwareRevision
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
illuminanceMeasurement: {
|
|
24
|
-
measuredValue: 5000,
|
|
25
|
-
minMeasuredValue: 1,
|
|
26
|
-
maxMeasuredValue: 65534,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
25
|
+
manufacturer,
|
|
26
|
+
model,
|
|
27
|
+
firmwareRevision,
|
|
28
|
+
hardwareRevision,
|
|
29
|
+
clusters,
|
|
30
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
29
31
|
})
|
|
30
32
|
|
|
31
33
|
this.logInfo('initialized.')
|
|
@@ -7,37 +7,33 @@ import type { API, Logger } from 'homebridge'
|
|
|
7
7
|
import { BaseMatterAccessory } from './BaseMatterAccessory.js'
|
|
8
8
|
|
|
9
9
|
export class OccupancySensorAccessory extends BaseMatterAccessory {
|
|
10
|
-
constructor(api: API, log: Logger) {
|
|
11
|
-
const serialNumber = 'SENSOR-003'
|
|
10
|
+
constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & { deviceId?: string }>) {
|
|
11
|
+
const serialNumber = opts?.serialNumber ?? 'SENSOR-003'
|
|
12
12
|
// Note: Matter.js API calls this "MotionSensor" but it's actually an Occupancy Sensor
|
|
13
13
|
const OccupancySensingServer = api.matter.deviceTypes.MotionSensor.requirements.OccupancySensingServer
|
|
14
14
|
const OccupancySensorWithPIR = api.matter.deviceTypes.MotionSensor.with(
|
|
15
15
|
OccupancySensingServer.with('PassiveInfrared'),
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
+
const clusters = opts?.clusters ?? {
|
|
19
|
+
occupancySensing: {
|
|
20
|
+
occupancy: { occupied: false },
|
|
21
|
+
occupancySensorType: 0,
|
|
22
|
+
occupancySensorTypeBitmap: { pir: true, ultrasonic: false, physicalContact: false },
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
super(api, log, {
|
|
19
|
-
uuid: api.matter.uuid.generate(serialNumber),
|
|
20
|
-
displayName: 'Occupancy Sensor',
|
|
27
|
+
uuid: opts?.uuid ?? api.matter.uuid.generate(serialNumber),
|
|
28
|
+
displayName: opts?.displayName ?? 'Occupancy Sensor',
|
|
21
29
|
deviceType: OccupancySensorWithPIR,
|
|
22
30
|
serialNumber,
|
|
23
|
-
manufacturer: 'Homebridge Matter',
|
|
24
|
-
model: 'HB-MATTER-SENSOR-OCCUPANCY',
|
|
25
|
-
firmwareRevision: '2.0.0',
|
|
26
|
-
hardwareRevision: '1.0.0',
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
occupancySensing: {
|
|
30
|
-
occupancy: {
|
|
31
|
-
occupied: false,
|
|
32
|
-
},
|
|
33
|
-
occupancySensorType: 0,
|
|
34
|
-
occupancySensorTypeBitmap: {
|
|
35
|
-
pir: true,
|
|
36
|
-
ultrasonic: false,
|
|
37
|
-
physicalContact: false,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
31
|
+
manufacturer: opts?.manufacturer ?? 'Homebridge Matter',
|
|
32
|
+
model: opts?.model ?? 'HB-MATTER-SENSOR-OCCUPANCY',
|
|
33
|
+
firmwareRevision: opts?.firmwareRevision ?? '2.0.0',
|
|
34
|
+
hardwareRevision: opts?.hardwareRevision ?? '1.0.0',
|
|
35
|
+
clusters,
|
|
36
|
+
context: { deviceId: opts?.deviceId, ...(opts?.context ?? {}) },
|
|
41
37
|
})
|
|
42
38
|
|
|
43
39
|
this.logInfo('initialized.')
|