isy-nodejs 1.0.1-alpha.5 → 1.0.1-alpha.9
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/cjs/Converters.js +66 -30
- package/dist/cjs/Converters.js.map +1 -1
- package/dist/cjs/Definitions/Global/Drivers.js +10 -3
- package/dist/cjs/Definitions/Global/Drivers.js.map +1 -1
- package/dist/cjs/Definitions/Global/Events.js +1 -2
- package/dist/cjs/Definitions/Global/Events.js.map +1 -1
- package/dist/cjs/Devices/Elk/ElkAlarmPanelDevice.js +3 -3
- package/dist/cjs/Devices/Elk/ElkAlarmSensorDevice.js +9 -6
- package/dist/cjs/Devices/Elk/ElkAlarmSensorDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/InsteonBaseDevice.js +1 -1
- package/dist/cjs/Devices/Insteon/InsteonBaseDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/InsteonFanDevice.js +5 -3
- package/dist/cjs/Devices/Insteon/InsteonFanDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/InsteonMotionSensorDevice.js +5 -5
- package/dist/cjs/Devices/Insteon/InsteonRelayDevice.js +3 -9
- package/dist/cjs/Devices/Insteon/InsteonRelayDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/RelayLampSwitch.js +72 -0
- package/dist/cjs/Devices/Insteon/RelayLampSwitch.js.map +1 -0
- package/dist/cjs/ISY.js +36 -27
- package/dist/cjs/ISY.js.map +1 -1
- package/dist/cjs/ISYNode.js +12 -9
- package/dist/cjs/ISYNode.js.map +1 -1
- package/dist/cjs/ISYScene.js +3 -3
- package/dist/cjs/ISYScene.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYBridgedDeviceBehavior.js +11 -4
- package/dist/cjs/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYClusterBehavior.js +26 -7
- package/dist/cjs/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYOnOffBehavior.js +9 -7
- package/dist/cjs/Matter/Behaviors/ISYOnOffBehavior.js.map +1 -1
- package/dist/cjs/Matter/{Server → Bridge}/Server.js +31 -45
- package/dist/cjs/Matter/Bridge/Server.js.map +1 -0
- package/dist/cjs/Matter/Mappings/Insteon.js +19 -15
- package/dist/cjs/Matter/Mappings/Insteon.js.map +1 -1
- package/dist/cjs/Matter/Mappings/register.js +1 -0
- package/dist/cjs/Matter/Mappings/register.js.map +1 -0
- package/dist/cjs/Model/ClusterMap.js +12 -9
- package/dist/cjs/Model/ClusterMap.js.map +1 -1
- package/dist/cjs/Utils.js +0 -9
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/types/Converters.d.ts +28 -8
- package/dist/cjs/types/Converters.d.ts.map +1 -1
- package/dist/cjs/types/Definitions/Global/Drivers.d.ts +4 -3
- package/dist/cjs/types/Definitions/Global/Drivers.d.ts.map +1 -1
- package/dist/cjs/types/Definitions/Global/Events.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Elk/ElkAlarmSensorDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/EndpointFor.d.ts +2 -2
- package/dist/cjs/types/Devices/Insteon/InsteonDevice.d.ts +4 -4
- package/dist/cjs/types/Devices/Insteon/InsteonFanDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/InsteonRelayDevice.d.ts +2 -4
- package/dist/cjs/types/Devices/Insteon/InsteonRelayDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/RelayLampSwitch.d.ts +93 -0
- package/dist/cjs/types/Devices/Insteon/RelayLampSwitch.d.ts.map +1 -0
- package/dist/cjs/types/ISY.d.ts +21 -18
- package/dist/cjs/types/ISY.d.ts.map +1 -1
- package/dist/cjs/types/ISYNode.d.ts +4 -4
- package/dist/cjs/types/ISYNode.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts +16 -6
- package/dist/cjs/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYClusterBehavior.d.ts +13 -11
- package/dist/cjs/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYOnOffBehavior.d.ts +4 -4
- package/dist/cjs/types/Matter/Behaviors/ISYOnOffBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Bridge/Server.d.ts +17 -0
- package/dist/cjs/types/Matter/Bridge/Server.d.ts.map +1 -0
- package/dist/cjs/types/Matter/Mappings/register.d.ts +1 -0
- package/dist/cjs/types/Matter/Mappings/register.d.ts.map +1 -0
- package/dist/cjs/types/Model/ClusterMap.d.ts +19 -11
- package/dist/cjs/types/Model/ClusterMap.d.ts.map +1 -1
- package/dist/cjs/types/Utils.d.ts +0 -5
- package/dist/cjs/types/Utils.d.ts.map +1 -1
- package/dist/esm/Converters.js +63 -28
- package/dist/esm/Converters.js.map +1 -1
- package/dist/esm/Definitions/Global/Drivers.js +10 -3
- package/dist/esm/Definitions/Global/Drivers.js.map +1 -1
- package/dist/esm/Definitions/Global/Events.js +1 -2
- package/dist/esm/Definitions/Global/Events.js.map +1 -1
- package/dist/esm/Devices/Brultech/index.js +4 -0
- package/dist/esm/Devices/Brultech/index.js.map +1 -0
- package/dist/esm/Devices/Constructor.js +2 -0
- package/dist/esm/Devices/Constructor.js.map +1 -0
- package/dist/esm/Devices/DeviceFactory.js +13 -0
- package/dist/esm/Devices/DeviceFactory.js.map +1 -0
- package/dist/esm/Devices/DeviceMap.js +4 -0
- package/dist/esm/Devices/DeviceMap.js.map +1 -0
- package/dist/esm/Devices/Elk/ElkAlarmPanelDevice.js +181 -0
- package/dist/esm/Devices/Elk/ElkAlarmPanelDevice.js.map +1 -0
- package/dist/esm/Devices/Elk/ElkAlarmSensorDevice.js +110 -0
- package/dist/esm/Devices/Elk/ElkAlarmSensorDevice.js.map +1 -0
- package/dist/esm/Devices/EndpointFor.js +31 -0
- package/dist/esm/Devices/EndpointFor.js.map +1 -0
- package/dist/esm/Devices/ISYDevice.js +35 -0
- package/dist/esm/Devices/ISYDevice.js.map +1 -0
- package/dist/esm/Devices/ISYDeviceNode.js +62 -0
- package/dist/esm/Devices/ISYDeviceNode.js.map +1 -0
- package/dist/esm/Devices/ISYMultiNodeDevice.js +89 -0
- package/dist/esm/Devices/ISYMultiNodeDevice.js.map +1 -0
- package/dist/esm/Devices/Insteon/InsteonBallastDimmerDevice.js +8 -0
- package/dist/esm/Devices/Insteon/InsteonBallastDimmerDevice.js.map +1 -0
- package/dist/esm/Devices/Insteon/InsteonBaseDevice.js +2 -2
- package/dist/esm/Devices/Insteon/InsteonBaseDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonDimmerOutletDevice.js +7 -0
- package/dist/esm/Devices/Insteon/InsteonDimmerOutletDevice.js.map +1 -0
- package/dist/esm/Devices/Insteon/InsteonDimmerSwitchDevice.js +8 -0
- package/dist/esm/Devices/Insteon/InsteonDimmerSwitchDevice.js.map +1 -0
- package/dist/esm/Devices/Insteon/InsteonFanDevice.js +5 -3
- package/dist/esm/Devices/Insteon/InsteonFanDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonKeypadDimmerDevice.js +8 -0
- package/dist/esm/Devices/Insteon/InsteonKeypadDimmerDevice.js.map +1 -0
- package/dist/esm/Devices/Insteon/InsteonMotionSensorDevice.js +5 -5
- package/dist/esm/Devices/Insteon/InsteonRelayDevice.js +3 -9
- package/dist/esm/Devices/Insteon/InsteonRelayDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/RelayLampSwitch.js +68 -0
- package/dist/esm/Devices/Insteon/RelayLampSwitch.js.map +1 -0
- package/dist/esm/Devices/Lutron/index.js +4 -0
- package/dist/esm/Devices/Lutron/index.js.map +1 -0
- package/dist/esm/Devices/MapsTo.js +2 -0
- package/dist/esm/Devices/MapsTo.js.map +1 -0
- package/dist/esm/Devices/NCD/index.js +4 -0
- package/dist/esm/Devices/NCD/index.js.map +1 -0
- package/dist/esm/Devices/NodeFactory.js +48 -0
- package/dist/esm/Devices/NodeFactory.js.map +1 -0
- package/dist/esm/Devices/Poly/index.js +4 -0
- package/dist/esm/Devices/Poly/index.js.map +1 -0
- package/dist/esm/Devices/Scene/index.js +4 -0
- package/dist/esm/Devices/Scene/index.js.map +1 -0
- package/dist/esm/Devices/UDI/index.js +4 -0
- package/dist/esm/Devices/UDI/index.js.map +1 -0
- package/dist/esm/Devices/ZWave/ZWaveBaseDevice.js +38 -0
- package/dist/esm/Devices/ZWave/ZWaveBaseDevice.js.map +1 -0
- package/dist/esm/Devices/ZWave/ZWaveDimmerSwitchDevice.js +8 -0
- package/dist/esm/Devices/ZWave/ZWaveDimmerSwitchDevice.js.map +1 -0
- package/dist/esm/Devices/ZWave/ZWaveLockDevice.js +35 -0
- package/dist/esm/Devices/ZWave/ZWaveLockDevice.js.map +1 -0
- package/dist/esm/Devices/ZWave/index.js +20 -0
- package/dist/esm/Devices/ZWave/index.js.map +1 -0
- package/dist/esm/Devices/index.js +9 -0
- package/dist/esm/Devices/index.js.map +1 -0
- package/dist/esm/ISY.js +35 -26
- package/dist/esm/ISY.js.map +1 -1
- package/dist/esm/ISYNode.js +13 -10
- package/dist/esm/ISYNode.js.map +1 -1
- package/dist/esm/ISYScene.js +3 -3
- package/dist/esm/ISYScene.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js +11 -4
- package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js +26 -7
- package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYOnOffBehavior.js +10 -8
- package/dist/esm/Matter/Behaviors/ISYOnOffBehavior.js.map +1 -1
- package/dist/esm/Matter/{Server → Bridge}/Server.js +29 -44
- package/dist/esm/Matter/Bridge/Server.js.map +1 -0
- package/dist/esm/Matter/Mappings/Insteon.js +22 -18
- package/dist/esm/Matter/Mappings/Insteon.js.map +1 -1
- package/dist/esm/Matter/Mappings/register.js +2 -0
- package/dist/esm/Matter/Mappings/register.js.map +1 -0
- package/dist/esm/Model/ClusterMap.js +12 -9
- package/dist/esm/Model/ClusterMap.js.map +1 -1
- package/dist/esm/Utils.js +0 -8
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/types/Converters.d.ts +28 -8
- package/dist/esm/types/Converters.d.ts.map +1 -1
- package/dist/esm/types/Definitions/Global/Drivers.d.ts +4 -3
- package/dist/esm/types/Definitions/Global/Drivers.d.ts.map +1 -1
- package/dist/esm/types/Definitions/Global/Events.d.ts.map +1 -1
- package/dist/esm/types/Devices/Elk/ElkAlarmSensorDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/EndpointFor.d.ts +2 -2
- package/dist/esm/types/Devices/Insteon/InsteonDevice.d.ts +4 -4
- package/dist/esm/types/Devices/Insteon/InsteonFanDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonRelayDevice.d.ts +2 -4
- package/dist/esm/types/Devices/Insteon/InsteonRelayDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/RelayLampSwitch.d.ts +93 -0
- package/dist/esm/types/Devices/Insteon/RelayLampSwitch.d.ts.map +1 -0
- package/dist/esm/types/ISY.d.ts +21 -18
- package/dist/esm/types/ISY.d.ts.map +1 -1
- package/dist/esm/types/ISYNode.d.ts +4 -4
- package/dist/esm/types/ISYNode.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts +16 -6
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts +13 -11
- package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYOnOffBehavior.d.ts +4 -4
- package/dist/esm/types/Matter/Behaviors/ISYOnOffBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Bridge/Server.d.ts +17 -0
- package/dist/esm/types/Matter/Bridge/Server.d.ts.map +1 -0
- package/dist/esm/types/Matter/Mappings/register.d.ts +2 -0
- package/dist/esm/types/Matter/Mappings/register.d.ts.map +1 -0
- package/dist/esm/types/Model/ClusterMap.d.ts +19 -11
- package/dist/esm/types/Model/ClusterMap.d.ts.map +1 -1
- package/dist/esm/types/Utils.d.ts +0 -5
- package/dist/esm/types/Utils.d.ts.map +1 -1
- package/package.json +4 -7
- package/src/Converters.ts +137 -69
- package/src/Definitions/Global/Drivers.ts +16 -7
- package/src/Definitions/Global/Events.ts +4 -3
- package/src/Devices/Elk/ElkAlarmPanelDevice.ts +3 -3
- package/src/Devices/Elk/ElkAlarmSensorDevice.ts +15 -21
- package/src/Devices/Insteon/Generated/RelayLamp.ts +8 -7
- package/src/Devices/Insteon/InsteonBaseDevice.ts +2 -2
- package/src/Devices/Insteon/InsteonFanDevice.ts +12 -10
- package/src/Devices/Insteon/InsteonMotionSensorDevice.ts +5 -5
- package/src/Devices/Insteon/InsteonRelayDevice.ts +3 -6
- package/src/Devices/Insteon/RelayLampSwitch.ts +131 -0
- package/src/ISY.ts +57 -42
- package/src/ISYNode.ts +14 -11
- package/src/ISYScene.ts +3 -3
- package/src/Matter/Behaviors/ISYBridgedDeviceBehavior.ts +29 -11
- package/src/Matter/Behaviors/ISYClusterBehavior.ts +46 -28
- package/src/Matter/Behaviors/ISYOnOffBehavior.ts +49 -60
- package/src/Matter/{Server → Bridge}/Server.ts +50 -50
- package/src/Matter/Mappings/Insteon.ts +53 -60
- package/src/Matter/Mappings/register.ts +0 -0
- package/src/Model/ClassDefinition.ts +1 -1
- package/src/Model/ClusterMap.ts +31 -22
- package/src/Utils.ts +1 -19
- package/tsconfig.json +2 -2
- package/LICENSE +0 -22
- package/dist/cjs/Matter/Server/Server.js.map +0 -1
- package/dist/cjs/types/Matter/Server/Server.d.ts +0 -4
- package/dist/cjs/types/Matter/Server/Server.d.ts.map +0 -1
- package/dist/esm/Matter/Server/Server.js.map +0 -1
- package/dist/esm/types/Matter/Server/Server.d.ts +0 -4
- package/dist/esm/types/Matter/Server/Server.d.ts.map +0 -1
- package/dist/tsconfig.cjs.tsbuildinfo +0 -1
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
|
@@ -1,38 +1,50 @@
|
|
|
1
|
-
import type { ClusterBehavior, ClusterInterface } from '@project-chip/matter.js/behavior/cluster';
|
|
2
|
-
|
|
3
|
-
import type { DriversOf, ISYNode } from '../../ISYNode.js';
|
|
4
|
-
|
|
5
1
|
import type { Behavior } from '@project-chip/matter.js/behavior';
|
|
2
|
+
import type { ClusterBehavior, ClusterInterface } from '@project-chip/matter.js/behavior/cluster';
|
|
6
3
|
import { BridgedDeviceBasicInformationServer } from '@project-chip/matter.js/behaviors/bridged-device-basic-information';
|
|
7
4
|
import type { LevelControlBehavior } from '@project-chip/matter.js/behaviors/level-control';
|
|
8
5
|
import type { OnOffBehavior, OnOffServer } from '@project-chip/matter.js/behaviors/on-off';
|
|
9
6
|
import type { Cluster, ClusterServerHandlers, ClusterType as CT } from '@project-chip/matter.js/cluster';
|
|
10
7
|
import '@project-chip/matter.js/device';
|
|
11
8
|
import { OnOffLightRequirements } from '@project-chip/matter.js/devices/OnOffLightDevice';
|
|
12
|
-
import {
|
|
9
|
+
import { Converter } from '../../Converters.js';
|
|
10
|
+
import { Driver, DriverType } from '../../Definitions/Global/Drivers.js';
|
|
13
11
|
import type { Constructor } from '../../Devices/Constructor.js';
|
|
14
12
|
import type { RelaxTypes } from '../../Devices/MapsTo.js';
|
|
15
13
|
import { ISY, type ISYDevice } from '../../ISY.js';
|
|
16
|
-
import {
|
|
17
|
-
|
|
14
|
+
import type { DriversOf, ISYNode } from '../../ISYNode.js';
|
|
15
|
+
import { BehaviorMapping, MappingRegistry, type ClusterMapping, type DeviceToClusterMap } from '../../Model/ClusterMap.js';
|
|
18
16
|
import { ISYBridgedDeviceBehavior } from './ISYBridgedDeviceBehavior.js';
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
// #region Type aliases (6)
|
|
21
19
|
|
|
20
|
+
export type ClusterForBehavior<B> = B extends ClusterBehavior.Type<infer C, infer D, infer E> ? C : never;
|
|
22
21
|
export type ConstructedType<B extends Constructor<any>> = B extends Constructor<infer C> ? C : never;
|
|
22
|
+
// <reference path="MatterDevice.js" />
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
export type DeviceBehavior<P extends ISYNode, T extends { cluster? }> = {
|
|
25
|
+
device: P;
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
bridgedDeviceBehavior: ISYBridgedDeviceBehavior<P>;
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
//ts-ignore
|
|
30
|
+
map: BehaviorMapping<T, P>;
|
|
27
31
|
|
|
32
|
+
handlePropertyChange(chg: PropertyChange<P>): void;
|
|
33
|
+
};
|
|
34
|
+
type NotUnknown<T extends ClusterBehavior> = T extends { cluster: { name: 'Unknown' } } ? never : T;
|
|
28
35
|
export type PropertyChange<P extends ISYNode<any, any, any, any>> = {
|
|
29
36
|
driver: keyof DriversOf<P>;
|
|
30
37
|
newValue: any;
|
|
31
38
|
oldValue: any;
|
|
32
39
|
formattedValue: string;
|
|
33
40
|
};
|
|
41
|
+
type t = ClusterForBehavior<LevelControlBehavior>;
|
|
42
|
+
|
|
43
|
+
// #endregion Type aliases (6)
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
// #region Functions (1)
|
|
46
|
+
|
|
47
|
+
export function ISYClusterBehavior<T extends Constructor<ClusterBehavior> & { cluster }, P extends ISYNode<any, any, any, any>>(
|
|
36
48
|
base: T,
|
|
37
49
|
p: Constructor<P>
|
|
38
50
|
): typeof base & { new (...args: any[]): DeviceBehavior<P, T> } {
|
|
@@ -41,30 +53,44 @@ export function ISYClusterBehavior<T extends Constructor<ClusterBehavior> & { cl
|
|
|
41
53
|
|
|
42
54
|
handlers: { [x in keyof DriversOf<P>]: (newValue, oldValue, formattedValue) => void } = {} as any;
|
|
43
55
|
|
|
56
|
+
bridgedDeviceBehavior: ISYBridgedDeviceBehavior<P>;
|
|
44
57
|
///public map: ClusterMapping<ToClusterTypeByName<ClusterForBehavior<ConstructedType<typeof base>>["name"]>,ISYDeviceNode<any, any, any>>;
|
|
45
58
|
|
|
46
|
-
map:
|
|
59
|
+
map: BehaviorMapping<T, P>;
|
|
47
60
|
|
|
48
61
|
override async initialize(_options?: {}) {
|
|
49
62
|
await super.initialize(_options);
|
|
50
|
-
var behavior = await this.agent.load(ISYBridgedDeviceBehavior)
|
|
63
|
+
var behavior = (await this.agent.load(ISYBridgedDeviceBehavior)) as ISYBridgedDeviceBehavior<P>;
|
|
64
|
+
this.bridgedDeviceBehavior = behavior;
|
|
51
65
|
//var behavior = this.agent.get(ISYBridgedDeviceBehavior);
|
|
52
66
|
this._device = behavior.device as P;
|
|
67
|
+
//@ts-ignore
|
|
53
68
|
this.map = behavior.mapForBehavior<T>(this as unknown as T);
|
|
54
69
|
for (const key2 in this.map.attributes) {
|
|
55
|
-
|
|
56
|
-
|
|
70
|
+
let val = this.map.attributes[key2];
|
|
71
|
+
let driverObj = null;
|
|
72
|
+
if (typeof val === 'string' || typeof val === 'symbol' || typeof val === 'number') {
|
|
73
|
+
driverObj = this._device.drivers[val];
|
|
74
|
+
this.handlers[val] = (newValue, oldValue, formattedValue) => {
|
|
57
75
|
this.state[key2 as string] = newValue;
|
|
58
76
|
};
|
|
59
|
-
} else if (
|
|
60
|
-
|
|
77
|
+
} else if (val.driver as DriversOf<P>) {
|
|
78
|
+
driverObj = this._device.drivers[val.driver as string];
|
|
79
|
+
|
|
80
|
+
let { driver, converter } = val;
|
|
81
|
+
const convFunc = Converter.get(converter)?.from;
|
|
61
82
|
this.handlers[driver] = (newValue, oldValue, formattedValue) => {
|
|
62
|
-
this.state[key2 as string] =
|
|
83
|
+
if (convFunc) this.state[key2 as string] = convFunc(newValue);
|
|
84
|
+
else this.state[key2 as string] = newValue;
|
|
63
85
|
};
|
|
64
86
|
}
|
|
87
|
+
if (driverObj) {
|
|
88
|
+
let evt = `${driverObj.name}Changed`;
|
|
89
|
+
this.reactTo(behavior.events[evt], this.handlePropertyChange.bind(this), { lock: false });
|
|
90
|
+
}
|
|
65
91
|
}
|
|
66
92
|
|
|
67
|
-
this.reactTo(behavior.events.propertyChanged, this.handlePropertyChange, { lock: false });
|
|
93
|
+
//this.reactTo(behavior.events.propertyChanged, this.handlePropertyChange, { lock: false });
|
|
68
94
|
|
|
69
95
|
//this._device.on("PropertyChanged", this.handlePropertyChange.bind(this));
|
|
70
96
|
}
|
|
@@ -95,13 +121,5 @@ export function ISYClusterBehavior<T extends Constructor<ClusterBehavior> & { cl
|
|
|
95
121
|
}
|
|
96
122
|
};
|
|
97
123
|
}
|
|
98
|
-
// <reference path="MatterDevice.js" />
|
|
99
|
-
// @ts-ignore
|
|
100
|
-
|
|
101
|
-
export type DeviceBehavior<P extends ISYNode, T extends { cluster }> = {
|
|
102
|
-
device: P;
|
|
103
124
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
handlePropertyChange(chg: PropertyChange<P>): void;
|
|
107
|
-
};
|
|
125
|
+
// #endregion Functions (1)
|
|
@@ -1,80 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { LevelControlInterface, LevelControlServer } from '@project-chip/matter.js/behaviors/level-control';
|
|
2
|
+
import type { OnOffBehavior, OnOffServer } from '@project-chip/matter.js/behaviors/on-off';
|
|
3
|
+
import type { MutableCluster, OnOffCluster } from '@project-chip/matter.js/cluster';
|
|
4
|
+
import { DimmableLightRequirements } from '@project-chip/matter.js/devices/DimmableLightDevice';
|
|
5
|
+
import { OnOffLightRequirements } from '@project-chip/matter.js/devices/OnOffLightDevice';
|
|
4
6
|
import { OnOffLightSwitchDevice } from '@project-chip/matter.js/devices/OnOffLightSwitchDevice';
|
|
5
7
|
import type { MaybePromise } from '@project-chip/matter.js/util';
|
|
6
|
-
import { MappingRegistry } from '../../Model/ClusterMap.js';
|
|
7
|
-
import type { MutableCluster, OnOffCluster } from '@project-chip/matter.js/cluster';
|
|
8
|
-
import type { OnOffBehavior, OnOffServer } from '@project-chip/matter.js/behaviors/on-off';
|
|
9
|
-
import type { LevelControlServer, LevelControlInterface } from '@project-chip/matter.js/behaviors/level-control';
|
|
10
8
|
import { DriverType } from '../../Definitions/Global/Drivers.js';
|
|
11
|
-
import { DimmableLightRequirements } from '@project-chip/matter.js/devices/DimmableLightDevice';
|
|
12
9
|
import { InsteonDimmableDevice } from '../../Devices/Insteon/InsteonDimmableDevice.js';
|
|
10
|
+
import { InsteonRelayDevice } from '../../Devices/Insteon/InsteonRelayDevice.js';
|
|
11
|
+
import { MappingRegistry } from '../../Model/ClusterMap.js';
|
|
12
|
+
import { ClusterForBehavior, ISYClusterBehavior, type PropertyChange } from './ISYClusterBehavior.js';
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export class ISYOnOffBehavior extends ISYClusterBehavior(OnOffLightRequirements.OnOffServer, InsteonRelayDevice)
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
override async initialize(_options?: {}) {
|
|
24
|
-
await super.initialize(_options);
|
|
25
|
-
//this.state.onOff = await this.device.state;
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
import { Converter } from '../../Converters.js';
|
|
28
15
|
|
|
29
|
-
|
|
16
|
+
export class ISYOnOffBehavior extends ISYClusterBehavior(OnOffLightRequirements.OnOffServer, InsteonRelayDevice) {
|
|
17
|
+
override async initialize(_options?: {}) {
|
|
18
|
+
await super.initialize(_options);
|
|
19
|
+
//this.state.onOff = await this.device.state;
|
|
20
|
+
}
|
|
30
21
|
|
|
22
|
+
override on = async () => {
|
|
23
|
+
await super.on();
|
|
24
|
+
await this.device.on();
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
//this.device.commands.DON = true;
|
|
27
|
+
};
|
|
34
28
|
|
|
29
|
+
override async off() {
|
|
30
|
+
await super.off();
|
|
31
|
+
await this.device.off();
|
|
35
32
|
|
|
36
|
-
//this.device.commands.DON = true;
|
|
37
|
-
}
|
|
38
33
|
|
|
39
|
-
override async off() {
|
|
40
|
-
//await super.off();
|
|
41
|
-
// this.device.drivers = false;
|
|
42
|
-
}
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
35
|
+
// this.device.drivers = false;
|
|
36
|
+
}
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
if (driver === "ST") {
|
|
50
|
-
this.state.onOff = newValue;
|
|
38
|
+
override toggle = async () => {
|
|
51
39
|
|
|
52
|
-
|
|
40
|
+
//this.device.state = !(await this.device.state);
|
|
41
|
+
};
|
|
53
42
|
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
override async handlePropertyChange({ driver, newValue, oldValue, formattedValue }: PropertyChange<InsteonRelayDevice>) {
|
|
44
|
+
/*if (driver === 'ST') {
|
|
45
|
+
this.state.onOff = newValue;
|
|
46
|
+
}*/
|
|
56
47
|
|
|
57
48
|
|
|
49
|
+
return super.handlePropertyChange({ driver, newValue, oldValue, formattedValue });
|
|
50
|
+
}
|
|
58
51
|
}
|
|
59
52
|
|
|
60
|
-
|
|
61
53
|
export class ISYDimmableBehavior extends ISYClusterBehavior(DimmableLightRequirements.LevelControlServer, InsteonDimmableDevice) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
54
|
+
override async initialize(_options?: {}) {
|
|
55
|
+
await super.initialize(_options);
|
|
56
|
+
this.state.currentLevel = this.device.drivers.ST.value;
|
|
57
|
+
|
|
58
|
+
//this.state.onLevel = this.device.drivers.OL;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override setLevel(level: number): MaybePromise<void> {
|
|
62
|
+
level = Converter.Matter.LevelFrom0To255.LightingLevel.from(level);
|
|
63
|
+
if (level > 0) {
|
|
64
|
+
return this.device.sendCommand('DON', level);
|
|
65
|
+
} else {
|
|
66
|
+
return this.device.sendCommand('DOF');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import '@project-chip/matter-node.js';
|
|
1
2
|
import { NodeJsEnvironment } from '@project-chip/matter-node.js/environment';
|
|
2
3
|
import { StorageBackendDisk } from '@project-chip/matter-node.js/storage';
|
|
4
|
+
import { CommissioningOptions } from '@project-chip/matter.js/behavior/system/commissioning';
|
|
3
5
|
import { BridgedDeviceBasicInformationServer } from '@project-chip/matter.js/behaviors/bridged-device-basic-information';
|
|
4
6
|
import { VendorId } from '@project-chip/matter.js/datatype';
|
|
5
7
|
import { logEndpoint, OnOffBaseDevice } from '@project-chip/matter.js/device';
|
|
@@ -8,42 +10,47 @@ import { DimmableLightDevice, OnOffLightDevice } from '@project-chip/matter.js/e
|
|
|
8
10
|
import type { SupportedBehaviors } from '@project-chip/matter.js/endpoint/properties';
|
|
9
11
|
import { EndpointType, MutableEndpoint } from '@project-chip/matter.js/endpoint/type';
|
|
10
12
|
import { AggregatorEndpoint } from '@project-chip/matter.js/endpoints/AggregatorEndpoint';
|
|
11
|
-
import {
|
|
13
|
+
import { StorageService } from '@project-chip/matter.js/environment';
|
|
12
14
|
import { Level, levelFromString, Logger as MatterLogger } from '@project-chip/matter.js/log';
|
|
13
15
|
import { ServerNode } from '@project-chip/matter.js/node';
|
|
14
16
|
import { QrCode } from '@project-chip/matter.js/schema';
|
|
15
17
|
import { resolve } from 'path';
|
|
16
|
-
import { config } from 'winston';
|
|
17
18
|
import { InsteonDimmableDevice, InsteonKeypadButtonDevice, InsteonRelayDevice, ISY } from '../../ISY.js';
|
|
18
19
|
import { ISYBridgedDeviceBehavior } from '../Behaviors/ISYBridgedDeviceBehavior.js';
|
|
19
20
|
import { ISYDimmableBehavior, ISYOnOffBehavior } from '../Behaviors/ISYOnOffBehavior.js';
|
|
21
|
+
import '../Mappings/Insteon.js';
|
|
22
|
+
import type { ISYDeviceNode } from '../../Devices/ISYDeviceNode.js';
|
|
20
23
|
|
|
21
|
-
// #region
|
|
24
|
+
// #region Interfaces (1)
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
//
|
|
26
|
+
export interface Config {
|
|
27
|
+
// #region Properties (8)
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
discriminator: number;
|
|
30
|
+
passcode: number;
|
|
31
|
+
port: number;
|
|
32
|
+
productId: number;
|
|
33
|
+
productName?: string;
|
|
34
|
+
uniqueId: string;
|
|
35
|
+
vendorId: number;
|
|
36
|
+
vendorName?: string;
|
|
28
37
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
// strong: producer => creator.text(`*${producer()}*`),
|
|
34
|
-
// weak: producer => creator.text(producer()),
|
|
35
|
-
// status: (status, producer) => `${creator.text(statusIcon(status))}${producer()}`,
|
|
36
|
-
// via: text => creator.text(text),
|
|
37
|
-
// });
|
|
38
|
+
// #endregion Properties (8)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// #endregion Interfaces (1)
|
|
38
42
|
|
|
39
|
-
//
|
|
40
|
-
//
|
|
43
|
+
// #region Functions (3)
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
export function create(isy?: ISY, config?: Config): Promise<ServerNode> {
|
|
46
|
+
return createMatterServer(isy, config);
|
|
47
|
+
}
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
export async function createServerNode(isy: ISY = ISY.instance): Promise<ServerNode> {
|
|
49
|
+
export async function createMatterServer(isy?: ISY, config?: Config): Promise<ServerNode> {
|
|
46
50
|
var logger = isy.logger;
|
|
51
|
+
if (isy === undefined) {
|
|
52
|
+
isy = ISY.instance;
|
|
53
|
+
}
|
|
47
54
|
|
|
48
55
|
try {
|
|
49
56
|
MatterLogger.addLogger(
|
|
@@ -58,7 +65,7 @@ export async function createServerNode(isy: ISY = ISY.instance): Promise<ServerN
|
|
|
58
65
|
MatterLogger.defaultLogLevel = levelFromString(logger.level);
|
|
59
66
|
}
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
config = await initializeConfiguration(isy, config);
|
|
62
69
|
|
|
63
70
|
logger.info(`Matter config read: ${JSON.stringify(config)}`);
|
|
64
71
|
|
|
@@ -70,6 +77,7 @@ export async function createServerNode(isy: ISY = ISY.instance): Promise<ServerN
|
|
|
70
77
|
// Optional when operating only one device on a host, Default port is 5540
|
|
71
78
|
network: {
|
|
72
79
|
port: config.port,
|
|
80
|
+
|
|
73
81
|
//ipv4: false,
|
|
74
82
|
discoveryCapabilities: {
|
|
75
83
|
onIpNetwork: true
|
|
@@ -124,7 +132,8 @@ export async function createServerNode(isy: ISY = ISY.instance): Promise<ServerN
|
|
|
124
132
|
|
|
125
133
|
const endpoints: { 0: Endpoint; 1: InsteonRelayDevice }[] = [];
|
|
126
134
|
|
|
127
|
-
for (const
|
|
135
|
+
for (const node of isy.nodeMap.values()) {
|
|
136
|
+
let device = node as ISYDeviceNode<any, any, any>;
|
|
128
137
|
let serialNumber = `${device.address.replaceAll(' ', '_').replaceAll('.', '_')}`;
|
|
129
138
|
if (device.enabled && !(device instanceof InsteonKeypadButtonDevice)) {
|
|
130
139
|
//const name = `OnOff ${isASocket ? "Socket" : "Light"} ${i}`;
|
|
@@ -147,6 +156,7 @@ export async function createServerNode(isy: ISY = ISY.instance): Promise<ServerN
|
|
|
147
156
|
}
|
|
148
157
|
|
|
149
158
|
if (baseBehavior !== undefined) {
|
|
159
|
+
//@ts-ignore
|
|
150
160
|
const endpoint = new Endpoint(baseBehavior, {
|
|
151
161
|
id: serialNumber,
|
|
152
162
|
isyNode: {
|
|
@@ -190,9 +200,13 @@ export async function createServerNode(isy: ISY = ISY.instance): Promise<ServerN
|
|
|
190
200
|
* offline again because we do not need anything more here. See the Full example for other starting options.
|
|
191
201
|
* The QR Code is printed automatically.
|
|
192
202
|
*/
|
|
203
|
+
process.on('SIGINT', async () => {
|
|
204
|
+
logger.info('Bringing server offline');
|
|
205
|
+
server.close();
|
|
206
|
+
});
|
|
193
207
|
|
|
194
208
|
logger.info('Bringing server online');
|
|
195
|
-
await server.
|
|
209
|
+
await server.start();
|
|
196
210
|
|
|
197
211
|
logger.info('Matter Server is online');
|
|
198
212
|
/**
|
|
@@ -216,34 +230,20 @@ export async function createServerNode(isy: ISY = ISY.instance): Promise<ServerN
|
|
|
216
230
|
logger.info(`Manual pairing code: ${manualPairingCode}`);
|
|
217
231
|
}
|
|
218
232
|
/*for(let e of endpoints)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
233
|
+
{
|
|
234
|
+
e[1].initialize(e[0] as any);
|
|
235
|
+
}*/
|
|
222
236
|
|
|
223
237
|
return server;
|
|
224
|
-
|
|
225
|
-
function createBaseBehavior(): any {
|
|
226
|
-
let baseBehavior: any;
|
|
227
|
-
return baseBehavior;
|
|
228
|
-
}
|
|
229
238
|
}
|
|
230
239
|
|
|
231
|
-
async function
|
|
240
|
+
async function initializeConfiguration(isy: ISY, config?: Config): Promise<Config> {
|
|
232
241
|
var logger = isy.logger;
|
|
233
|
-
/**
|
|
234
|
-
* Collect all needed data
|
|
235
|
-
*
|
|
236
|
-
* This block collects all needed data from cli, environment or storage. Replace this with where ever your data come from.
|
|
237
|
-
*
|
|
238
|
-
* Note: This example uses the matter.js process storage system to store the device parameter data for convenience
|
|
239
|
-
* and easy reuse. When you also do that be careful to not overlap with Matter-Server own storage contexts
|
|
240
|
-
* (so maybe better not do it ;-)).
|
|
241
|
-
*/
|
|
242
242
|
|
|
243
243
|
const environment = NodeJsEnvironment();
|
|
244
244
|
|
|
245
245
|
const storageService = environment.get(StorageService);
|
|
246
|
-
environment.vars.set('storage.path', ISY.instance.storagePath
|
|
246
|
+
environment.vars.set('storage.path', `${ISY.instance.storagePath}matter`);
|
|
247
247
|
environment.vars.use(() => {
|
|
248
248
|
const location = environment.vars.get('storage.path', environment.vars.get('path.root', '.'));
|
|
249
249
|
storageService.location = location;
|
|
@@ -254,15 +254,15 @@ async function getConfiguration(isy: ISY) {
|
|
|
254
254
|
const deviceStorage = (await storageService.open('device')).createContext('data');
|
|
255
255
|
|
|
256
256
|
const vendorName = isy.vendorName;
|
|
257
|
-
const passcode = environment.vars.number('passcode') ?? (await deviceStorage.get('passcode', 20202021));
|
|
258
|
-
const discriminator = environment.vars.number('discriminator') ?? (await deviceStorage.get('discriminator', 3840));
|
|
257
|
+
const passcode = config.passcode ?? environment.vars.number('passcode') ?? (await deviceStorage.get('passcode', 20202021));
|
|
258
|
+
const discriminator = config.discriminator ?? environment.vars.number('discriminator') ?? (await deviceStorage.get('discriminator', 3840));
|
|
259
259
|
// product name / id and vendor id should match what is in the device certificate
|
|
260
|
-
const vendorId = environment.vars.number('vendorid') ?? (await deviceStorage.get('vendorid', 0xfff1));
|
|
261
|
-
const productId = environment.vars.number('productid') ?? (await deviceStorage.get('productid', 0x8000));
|
|
260
|
+
const vendorId = config.vendorId ?? environment.vars.number('vendorid') ?? (await deviceStorage.get('vendorid', 0xfff1));
|
|
261
|
+
const productId = config.productId ?? environment.vars.number('productid') ?? (await deviceStorage.get('productid', 0x8000));
|
|
262
262
|
const productName = isy.productName;
|
|
263
|
-
const port = environment.vars.number('port') ?? 5540;
|
|
263
|
+
const port = config.port ?? environment.vars.number('port') ?? 5540;
|
|
264
264
|
|
|
265
|
-
const uniqueId = isy.id;
|
|
265
|
+
const uniqueId = isy.id.replaceAll(':', '_');
|
|
266
266
|
//environment.vars.string("uniqueid") ?? (await deviceStorage.get("uniqueid", Time.nowMs().toString()));
|
|
267
267
|
|
|
268
268
|
// Persist basic data to keep them also on restart
|
|
@@ -287,4 +287,4 @@ async function getConfiguration(isy: ISY) {
|
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
// #endregion Functions (
|
|
290
|
+
// #endregion Functions (3)
|
|
@@ -1,68 +1,61 @@
|
|
|
1
|
-
import { OnOffCluster } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type DeviceToClusterMap,
|
|
10
|
-
type EndpointMapping
|
|
11
|
-
} from "../../Model/ClusterMap.js";
|
|
12
|
-
import { DeviceTypeDefinition, DeviceTypes, OnOffBaseDevice } from "@project-chip/matter.js/device";
|
|
13
|
-
import { OnOffLightDevice } from "@project-chip/matter.js/devices/OnOffLightDevice";
|
|
1
|
+
import { OnOffCluster } from '@project-chip/matter.js/cluster';
|
|
2
|
+
import { DeviceTypeDefinition, DeviceTypes, OnOffBaseDevice } from '@project-chip/matter.js/device';
|
|
3
|
+
import { OnOffLightDevice } from '@project-chip/matter.js/devices/OnOffLightDevice';
|
|
4
|
+
import { DriverType } from '../../Definitions/Global/Drivers.js';
|
|
5
|
+
import { Family, type t } from '../../Definitions/Global/Families.js';
|
|
6
|
+
import { Insteon } from '../../Devices/Insteon/index.js';
|
|
7
|
+
import { Devices } from '../../Devices/index.js';
|
|
8
|
+
import { MappingRegistry, type DeviceToClusterMap, type EndpointMapping, type FamilyToClusterMap } from '../../Model/ClusterMap.js';
|
|
14
9
|
|
|
15
10
|
//import InsteonMap from "./Insteon.json";
|
|
16
|
-
import { DimmableLightDevice } from
|
|
17
|
-
import {
|
|
11
|
+
import { DimmableLightDevice } from '@project-chip/matter.js/devices/DimmableLightDevice';
|
|
12
|
+
import { Converter } from '../../Converters.js';
|
|
18
13
|
import type { InsteonRelaySwitchDevice } from '../../Devices/Insteon/InsteonRelaySwitchDevice.js';
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
15
|
const map: FamilyToClusterMap<Family.Insteon> = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
16
|
+
Family: Family.Insteon,
|
|
17
|
+
Relay: {
|
|
18
|
+
deviceType: OnOffLightDevice,
|
|
19
|
+
mapping: {
|
|
20
|
+
OnOff: {
|
|
21
|
+
attributes: {
|
|
22
|
+
onOff: { driver: 'ST', converter: 'Percent.Boolean' }
|
|
23
|
+
},
|
|
24
|
+
commands: { on: 'DON' }
|
|
25
|
+
}
|
|
26
|
+
} as EndpointMapping<OnOffLightDevice, Insteon.Relay>
|
|
27
|
+
},
|
|
28
|
+
RelaySwitch: {
|
|
29
|
+
deviceType: OnOffLightDevice,
|
|
30
|
+
mapping: {
|
|
31
|
+
OnOff: {
|
|
32
|
+
attributes: {
|
|
33
|
+
onOff: 'ST'
|
|
34
|
+
},
|
|
35
|
+
commands: { on: 'DON' }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
Dimmer: {
|
|
40
|
+
deviceType: DimmableLightDevice,
|
|
41
|
+
mapping: {
|
|
42
|
+
OnOff: {
|
|
43
|
+
attributes: {
|
|
44
|
+
onOff: { driver: 'ST', converter: 'LevelFrom0To255.Boolean' }
|
|
45
|
+
},
|
|
46
|
+
commands: { on: 'DON' }
|
|
47
|
+
},
|
|
48
|
+
LevelControl: {
|
|
49
|
+
attributes: {
|
|
50
|
+
currentLevel: { driver: DriverType.Status, converter: 'LevelFrom0To255.LightingLevel' }
|
|
51
|
+
},
|
|
52
|
+
commands: { moveToLevel: { command: 'DON' } }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
66
56
|
};
|
|
67
57
|
|
|
58
|
+
map.KeypadDimmer = map.Dimmer;
|
|
59
|
+
map.DimmerSwitch = map.Dimmer;
|
|
60
|
+
|
|
68
61
|
MappingRegistry.register(map);
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { camelize, capitalize } from '@project-chip/matter.js/util';
|
|
2
2
|
import camelcase from 'camelcase';
|
|
3
3
|
import { getRandomValues } from 'crypto';
|
|
4
|
-
import { detailedDiff } from 'deep-object-diff';
|
|
4
|
+
//import { detailedDiff } from 'deep-object-diff';
|
|
5
5
|
import { create } from 'domain';
|
|
6
6
|
import * as fs from 'fs';
|
|
7
7
|
import diff from 'microdiff';
|