isy-nodejs 1.0.1-alpha.25 → 1.0.1-alpha.27
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 +28 -20
- package/dist/cjs/Converters.js.map +1 -1
- package/dist/cjs/Definitions/Global/Commands.js.map +1 -1
- package/dist/cjs/Definitions/Global/Drivers.js +19 -7
- package/dist/cjs/Definitions/Global/Drivers.js.map +1 -1
- package/dist/cjs/Devices/Insteon/DimmerLampSwitch.js +23 -23
- package/dist/cjs/Devices/Insteon/DimmerLampSwitch.js.map +1 -1
- package/dist/cjs/Devices/Insteon/RelayLampSwitch.js +6 -6
- package/dist/cjs/Devices/Insteon/RelayLampSwitch.js.map +1 -1
- package/dist/cjs/ISY.js +11 -5
- package/dist/cjs/ISY.js.map +1 -1
- package/dist/cjs/ISYScene.js +1 -1
- package/dist/cjs/ISYScene.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYClusterBehavior.js +11 -7
- package/dist/cjs/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYOnOffBehavior.js +1 -3
- package/dist/cjs/Matter/Behaviors/ISYOnOffBehavior.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/Insteon/ISYOnOffBehavior.js +47 -0
- package/dist/cjs/Matter/Behaviors/Insteon/ISYOnOffBehavior.js.map +1 -0
- package/dist/cjs/Matter/Bridge/Server.js +1 -1
- package/dist/cjs/Matter/Bridge/Server.js.map +1 -1
- package/dist/cjs/Matter/Mappings/Insteon.js +3 -4
- package/dist/cjs/Matter/Mappings/Insteon.js.map +1 -1
- package/dist/cjs/Model/NodeInfo.js.map +1 -1
- package/dist/cjs/types/Converters.d.ts +16 -3
- package/dist/cjs/types/Converters.d.ts.map +1 -1
- package/dist/cjs/types/Definitions/Global/Commands.d.ts +1 -1
- package/dist/cjs/types/Definitions/Global/Commands.d.ts.map +1 -1
- package/dist/cjs/types/Definitions/Global/Drivers.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/DimmerLampSwitch.d.ts +44 -44
- package/dist/cjs/types/Devices/Insteon/DimmerLampSwitch.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/RelayLampSwitch.d.ts +32 -32
- package/dist/cjs/types/Devices/Insteon/RelayLampSwitch.d.ts.map +1 -1
- package/dist/cjs/types/ISY.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYClusterBehavior.d.ts +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYOnOffBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/Insteon/ISYOnOffBehavior.d.ts +54 -0
- package/dist/cjs/types/Matter/Behaviors/Insteon/ISYOnOffBehavior.d.ts.map +1 -0
- package/dist/cjs/types/Model/EnumDefinition.d.ts +1 -1
- package/dist/cjs/types/Model/NodeInfo.d.ts +5 -1
- package/dist/cjs/types/Model/NodeInfo.d.ts.map +1 -1
- package/dist/esm/Converters.js +28 -20
- package/dist/esm/Converters.js.map +1 -1
- package/dist/esm/Definitions/Global/Commands.js.map +1 -1
- package/dist/esm/Definitions/Global/Drivers.js +19 -7
- package/dist/esm/Definitions/Global/Drivers.js.map +1 -1
- package/dist/esm/Devices/Insteon/DimmerLampSwitch.js +23 -23
- package/dist/esm/Devices/Insteon/DimmerLampSwitch.js.map +1 -1
- package/dist/esm/Devices/Insteon/RelayLampSwitch.js +8 -8
- package/dist/esm/Devices/Insteon/RelayLampSwitch.js.map +1 -1
- package/dist/esm/ISY.js +11 -5
- package/dist/esm/ISY.js.map +1 -1
- package/dist/esm/ISYScene.js +1 -1
- package/dist/esm/ISYScene.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js +11 -7
- package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYOnOffBehavior.js +1 -3
- package/dist/esm/Matter/Behaviors/ISYOnOffBehavior.js.map +1 -1
- package/dist/esm/Matter/Behaviors/Insteon/ISYOnOffBehavior.js +42 -0
- package/dist/esm/Matter/Behaviors/Insteon/ISYOnOffBehavior.js.map +1 -0
- package/dist/esm/Matter/Bridge/Server.js +1 -1
- package/dist/esm/Matter/Bridge/Server.js.map +1 -1
- package/dist/esm/Matter/Mappings/Insteon.js +3 -4
- package/dist/esm/Matter/Mappings/Insteon.js.map +1 -1
- package/dist/esm/Model/NodeInfo.js.map +1 -1
- package/dist/esm/types/Converters.d.ts +16 -3
- package/dist/esm/types/Converters.d.ts.map +1 -1
- package/dist/esm/types/Definitions/Global/Commands.d.ts +1 -1
- package/dist/esm/types/Definitions/Global/Commands.d.ts.map +1 -1
- package/dist/esm/types/Definitions/Global/Drivers.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/DimmerLampSwitch.d.ts +44 -44
- package/dist/esm/types/Devices/Insteon/DimmerLampSwitch.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/RelayLampSwitch.d.ts +32 -32
- package/dist/esm/types/Devices/Insteon/RelayLampSwitch.d.ts.map +1 -1
- package/dist/esm/types/ISY.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYOnOffBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/Insteon/ISYOnOffBehavior.d.ts +54 -0
- package/dist/esm/types/Matter/Behaviors/Insteon/ISYOnOffBehavior.d.ts.map +1 -0
- package/dist/esm/types/Model/NodeInfo.d.ts +5 -1
- package/dist/esm/types/Model/NodeInfo.d.ts.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Converters.ts +31 -27
- package/src/Definitions/Global/Commands.ts +13 -1
- package/src/Definitions/Global/Drivers.ts +17 -8
- package/src/Devices/Insteon/DimmerLampSwitch.ts +69 -71
- package/src/Devices/Insteon/Generated/DimmerLampSwitch.ts +8 -7
- package/src/Devices/Insteon/RelayLampSwitch.ts +40 -40
- package/src/ISY.ts +14 -10
- package/src/ISYScene.ts +1 -1
- package/src/Matter/Behaviors/ISYBridgedDeviceBehavior.ts +9 -1
- package/src/Matter/Behaviors/ISYClusterBehavior.ts +16 -7
- package/src/Matter/Behaviors/{ISYOnOffBehavior.ts → Insteon/ISYOnOffBehavior.ts} +9 -16
- package/src/Matter/Bridge/Server.ts +1 -1
- package/src/Matter/Mappings/Insteon.ts +3 -3
- package/src/Model/NodeInfo.ts +2 -1
package/src/ISY.ts
CHANGED
|
@@ -41,10 +41,10 @@ import type { NodeInfo } from './Model/NodeInfo.js';
|
|
|
41
41
|
import * as Utils from './Utils.js';
|
|
42
42
|
|
|
43
43
|
import { X2jOptions, XMLParser } from 'fast-xml-parser';
|
|
44
|
+
import path from 'path';
|
|
44
45
|
import { NodeFactory } from './Devices/NodeFactory.js';
|
|
45
46
|
import type { Config } from './Model/Config.js';
|
|
46
47
|
import { findPackageJson } from './Utils.js';
|
|
47
|
-
import path from 'path';
|
|
48
48
|
|
|
49
49
|
export {
|
|
50
50
|
Category as Categories,
|
|
@@ -561,16 +561,13 @@ export class ISY extends EventEmitter implements Disposable {
|
|
|
561
561
|
let uriToUse = `nodes/${node.address}/cmd/${command}`;
|
|
562
562
|
if (parameters !== null && parameters !== undefined) {
|
|
563
563
|
if (typeof parameters == 'object') {
|
|
564
|
-
|
|
565
564
|
var q = parameters as Record<P, string | number>;
|
|
566
565
|
for (const paramName of Object.getOwnPropertyNames(q)) {
|
|
567
|
-
if(paramName === 'value')
|
|
568
|
-
{
|
|
566
|
+
if (paramName === 'value') {
|
|
569
567
|
uriToUse += `/${q[paramName]}`;
|
|
570
568
|
continue;
|
|
571
569
|
}
|
|
572
|
-
if(typeof q[paramName] === 'string' || typeof q[paramName] === 'number')
|
|
573
|
-
uriToUse += `/${paramName}/${q[paramName]}`;
|
|
570
|
+
if (typeof q[paramName] === 'string' || typeof q[paramName] === 'number') uriToUse += `/${paramName}/${q[paramName]}`;
|
|
574
571
|
}
|
|
575
572
|
|
|
576
573
|
//uriToUse += `/${q[((p : Record<string,number|number>) => `${p[]}/${p.paramValue}` ).join('/')}`;
|
|
@@ -752,17 +749,24 @@ export class ISY extends EventEmitter implements Disposable {
|
|
|
752
749
|
const enabled = nodeInfo.enabled ?? true;
|
|
753
750
|
const d = await NodeFactory.get(nodeInfo);
|
|
754
751
|
const m = DeviceFactory.getDeviceDetails(nodeInfo);
|
|
752
|
+
const cls = m?.class ?? d;
|
|
753
|
+
nodeInfo.property = Array.isArray(nodeInfo.property) ? nodeInfo.property : [nodeInfo.property];
|
|
754
|
+
nodeInfo.state = nodeInfo.property.reduce((acc, p) => {
|
|
755
|
+
if (p && p?.id) {
|
|
756
|
+
p.name = p.name == '' ? undefined : p.name;
|
|
757
|
+
acc[p.id] = p;
|
|
758
|
+
}
|
|
759
|
+
return acc;
|
|
760
|
+
}, {});
|
|
761
|
+
newDevice = new cls(this, nodeInfo) as ISYDeviceNode<any, any, any, any>;
|
|
755
762
|
|
|
756
|
-
if (d) {
|
|
757
|
-
newDevice = new d(this, nodeInfo) as ISYDeviceNode<any, any, any, any>;
|
|
758
|
-
}
|
|
759
763
|
if (m) {
|
|
760
|
-
newDevice = newDevice ?? (new m.class(this, nodeInfo) as unknown as ISYDeviceNode<any, any, any, any>);
|
|
761
764
|
newDevice.productName = m.name;
|
|
762
765
|
newDevice.model = `(${m.modelNumber}) ${m.name} v.${m.version}`;
|
|
763
766
|
newDevice.modelNumber = m.modelNumber;
|
|
764
767
|
newDevice.version = m.version;
|
|
765
768
|
}
|
|
769
|
+
|
|
766
770
|
if (enabled) {
|
|
767
771
|
if (newDevice === null) {
|
|
768
772
|
this.logger.warn(`Device type resolution failed for ${nodeInfo.name} with type: ${nodeInfo.type} and nodedef: ${nodeInfo.nodeDefId}`);
|
package/src/ISYScene.ts
CHANGED
|
@@ -77,7 +77,7 @@ export class ISYScene extends ISYNode<Family.Scene, Driver.Signatures<'ST'>,Comm
|
|
|
77
77
|
get isOn() {
|
|
78
78
|
for (const device of this.members) {
|
|
79
79
|
if (device instanceof Insteon.Relay) {
|
|
80
|
-
if (device.drivers.ST?.value
|
|
80
|
+
if (device.drivers.ST?.value) {
|
|
81
81
|
return true;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -12,6 +12,7 @@ import type { Driver } from '../../Definitions/Global/Drivers.js';
|
|
|
12
12
|
import { ISY, type Family, type ISYNode } from '../../ISY.js';
|
|
13
13
|
import type { ISYDevice } from '../../ISYDevice.js';
|
|
14
14
|
import { DeviceToClusterMap, MappingRegistry, type ClusterMapping, type BehaviorMapping } from '../../Model/ClusterMap.js';
|
|
15
|
+
import { server } from 'typescript';
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
type ClusterForBehavior<B extends ClusterBehavior> = B extends ClusterBehavior.Type<infer C> ? C : never;
|
|
@@ -31,9 +32,11 @@ export class ISYBridgedDeviceBehavior<N extends ISYNode<any, D, any, any>, D ext
|
|
|
31
32
|
const d = ISY.instance.nodeMap.get(this.state.address);
|
|
32
33
|
this.internal.device = d;
|
|
33
34
|
this.internal.map = MappingRegistry.getMapping(this.internal.device as unknown as ISYNode<Family, any, any, any>);
|
|
35
|
+
|
|
34
36
|
ISY.instance.logger.debug(`Initializing ${this.constructor.name} for ${this.internal.device.constructor.name} ${this.internal.device.name} with address ${address}`);
|
|
35
37
|
if (d) {
|
|
36
38
|
d.events.on('propertyChanged', this.handlePropertyChange.bind(this));
|
|
39
|
+
|
|
37
40
|
for(const f in d.drivers)
|
|
38
41
|
{
|
|
39
42
|
let evt = `${d.drivers[f].name}Changed`;
|
|
@@ -41,7 +44,8 @@ export class ISYBridgedDeviceBehavior<N extends ISYNode<any, D, any, any>, D ext
|
|
|
41
44
|
|
|
42
45
|
d.events.on(evt, (driver: string, newValue: any, oldValue: any, formattedValue: string) => obs.emit({ driver, newValue, oldValue, formattedValue }));
|
|
43
46
|
this.events[evt] = obs;
|
|
44
|
-
|
|
47
|
+
|
|
48
|
+
|
|
45
49
|
//@ts-ignore
|
|
46
50
|
//d.events.on(evt, (driver: string, newValue: any, oldValue: any, formattedValue: string) => this.events.emit(evt, { driver, newValue, oldValue, formattedValue } as unknown as any));
|
|
47
51
|
|
|
@@ -62,13 +66,17 @@ export class ISYBridgedDeviceBehavior<N extends ISYNode<any, D, any, any>, D ext
|
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
handlePropertyChange(driver: string, newValue: any, oldValue: any, formattedValue: string) {
|
|
69
|
+
|
|
65
70
|
this.events.propertyChanged.emit({ driver, newValue, oldValue, formattedValue });
|
|
71
|
+
|
|
72
|
+
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
override [Symbol.asyncDispose]() {
|
|
69
76
|
|
|
70
77
|
this.internal.device = null;
|
|
71
78
|
|
|
79
|
+
|
|
72
80
|
return super[Symbol.asyncDispose]();
|
|
73
81
|
}
|
|
74
82
|
}
|
|
@@ -6,6 +6,7 @@ import type { OnOffBehavior, OnOffServer } from '@project-chip/matter.js/behavio
|
|
|
6
6
|
import type { Cluster, ClusterServerHandlers, ClusterType as CT } from '@project-chip/matter.js/cluster';
|
|
7
7
|
import '@project-chip/matter.js/device';
|
|
8
8
|
import { OnOffLightRequirements } from '@project-chip/matter.js/devices/OnOffLightDevice';
|
|
9
|
+
import type { AnyMxRecord } from 'dns';
|
|
9
10
|
import { Converter } from '../../Converters.js';
|
|
10
11
|
import { Driver, DriverType } from '../../Definitions/Global/Drivers.js';
|
|
11
12
|
import type { Constructor } from '../../Devices/Constructor.js';
|
|
@@ -14,6 +15,7 @@ import { ISY, type ISYDevice } from '../../ISY.js';
|
|
|
14
15
|
import type { DriversOf, ISYNode } from '../../ISYNode.js';
|
|
15
16
|
import { BehaviorMapping, MappingRegistry, type ClusterMapping, type DeviceToClusterMap } from '../../Model/ClusterMap.js';
|
|
16
17
|
import { ISYBridgedDeviceBehavior } from './ISYBridgedDeviceBehavior.js';
|
|
18
|
+
import { loggers } from 'winston';
|
|
17
19
|
|
|
18
20
|
// #region Type aliases (6)
|
|
19
21
|
|
|
@@ -21,7 +23,7 @@ export type ClusterForBehavior<B> = B extends ClusterBehavior.Type<infer C, infe
|
|
|
21
23
|
export type ConstructedType<B extends Constructor<any>> = B extends Constructor<infer C> ? C : never;
|
|
22
24
|
// <reference path="MatterDevice.js" />
|
|
23
25
|
// @ts-ignore
|
|
24
|
-
export type DeviceBehavior<P extends ISYNode, T extends { cluster? }> = {
|
|
26
|
+
export type DeviceBehavior<P extends ISYNode<any, any, any, any>, T extends { cluster? }> = {
|
|
25
27
|
device: P;
|
|
26
28
|
|
|
27
29
|
bridgedDeviceBehavior: ISYBridgedDeviceBehavior<P>;
|
|
@@ -60,33 +62,40 @@ export function ISYClusterBehavior<T extends Constructor<ClusterBehavior> & { cl
|
|
|
60
62
|
|
|
61
63
|
override async initialize(_options?: {}) {
|
|
62
64
|
await super.initialize(_options);
|
|
65
|
+
|
|
63
66
|
var behavior = (await this.agent.load(ISYBridgedDeviceBehavior)) as ISYBridgedDeviceBehavior<P>;
|
|
64
67
|
this.bridgedDeviceBehavior = behavior;
|
|
65
68
|
//var behavior = this.agent.get(ISYBridgedDeviceBehavior);
|
|
66
69
|
this._device = behavior.device as P;
|
|
67
70
|
//@ts-ignore
|
|
71
|
+
|
|
68
72
|
this.map = behavior.mapForBehavior<T>(this as unknown as T);
|
|
69
73
|
for (const key2 in this.map.attributes) {
|
|
70
74
|
let val = this.map.attributes[key2];
|
|
71
75
|
let driverObj = null;
|
|
72
76
|
if (typeof val === 'string' || typeof val === 'symbol' || typeof val === 'number') {
|
|
73
77
|
driverObj = this._device.drivers[val];
|
|
78
|
+
this.state[key2 as string] = this._device.drivers[val].value;
|
|
74
79
|
this.handlers[val] = (newValue, oldValue, formattedValue) => {
|
|
75
80
|
this.state[key2 as string] = newValue;
|
|
76
81
|
};
|
|
82
|
+
|
|
77
83
|
} else if (val.driver as DriversOf<P>) {
|
|
78
84
|
driverObj = this._device.drivers[val.driver as string];
|
|
79
85
|
|
|
80
86
|
let { driver, converter } = val;
|
|
81
|
-
const convFunc = Converter.get(converter)?.
|
|
87
|
+
const convFunc = Converter.get(converter)?.to;
|
|
88
|
+
if(!convFunc) throw new Error(`Converter ${converter} not found`);
|
|
89
|
+
this.state[key2 as string] = convFunc(this._device.drivers[driver as string].value);
|
|
82
90
|
this.handlers[driver] = (newValue, oldValue, formattedValue) => {
|
|
83
|
-
if (convFunc) this.state[key2 as string] = convFunc(newValue);
|
|
84
|
-
|
|
91
|
+
//if (convFunc) this.state[key2 as string] = convFunc(newValue);
|
|
92
|
+
this.state[key2 as string] = convFunc(newValue);
|
|
85
93
|
};
|
|
86
94
|
}
|
|
87
95
|
if (driverObj) {
|
|
88
96
|
let evt = `${driverObj.name}Changed`;
|
|
89
|
-
this.
|
|
97
|
+
(this as any).evt = this.handlers[driverObj.name];
|
|
98
|
+
this.reactTo(behavior.events[evt], this.handlePropertyChange, { lock: false });
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
|
|
@@ -99,9 +108,9 @@ export function ISYClusterBehavior<T extends Constructor<ClusterBehavior> & { cl
|
|
|
99
108
|
return (this._device = this._device ?? (this.agent.get(ISYBridgedDeviceBehavior).device as P));
|
|
100
109
|
}
|
|
101
110
|
|
|
102
|
-
handlePropertyChange({ driver, newValue, oldValue, formattedValue }: PropertyChange<P>) {
|
|
111
|
+
async handlePropertyChange({ driver, newValue, oldValue, formattedValue }: PropertyChange<P>) {
|
|
103
112
|
// for (const key2 in this.map.attributes) {
|
|
104
|
-
|
|
113
|
+
await this.initialize();
|
|
105
114
|
if (this.handlers[driver]) {
|
|
106
115
|
this.handlers[driver](newValue, oldValue, formattedValue);
|
|
107
116
|
}
|
|
@@ -5,42 +5,34 @@ import { DimmableLightRequirements } from '@project-chip/matter.js/devices/Dimma
|
|
|
5
5
|
import { OnOffLightRequirements } from '@project-chip/matter.js/devices/OnOffLightDevice';
|
|
6
6
|
import { OnOffLightSwitchDevice } from '@project-chip/matter.js/devices/OnOffLightSwitchDevice';
|
|
7
7
|
import type { MaybePromise } from '@project-chip/matter.js/util';
|
|
8
|
-
import { DriverType } from '
|
|
9
|
-
import { InsteonDimmableDevice } from '
|
|
10
|
-
import { InsteonRelayDevice } from '
|
|
11
|
-
import { MappingRegistry } from '
|
|
12
|
-
import { ClusterForBehavior, ISYClusterBehavior, type PropertyChange } from '
|
|
8
|
+
import { DriverType } from '../../../Definitions/Global/Drivers.js';
|
|
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 { Converter } from '
|
|
14
|
+
import { Converter } from '../../../Converters.js';
|
|
15
15
|
|
|
16
16
|
export class ISYOnOffBehavior extends ISYClusterBehavior(OnOffLightRequirements.OnOffServer, InsteonRelayDevice) {
|
|
17
17
|
override async initialize(_options?: {}) {
|
|
18
18
|
await super.initialize(_options);
|
|
19
|
+
//this.state.onOff = this.device.status;
|
|
19
20
|
//this.state.onOff = await this.device.state;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
override on = async () => {
|
|
23
|
-
await super.on();
|
|
24
24
|
await this.device.on();
|
|
25
25
|
|
|
26
26
|
//this.device.commands.DON = true;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
override async off() {
|
|
30
|
-
await super.off();
|
|
31
30
|
await this.device.off();
|
|
32
31
|
|
|
33
32
|
// this.device.drivers = false;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
override toggle = async () => {
|
|
37
|
-
//this.device.state = !(await this.device.state);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
35
|
override async handlePropertyChange({ driver, newValue, oldValue, formattedValue }: PropertyChange<InsteonRelayDevice>) {
|
|
41
|
-
/*if (driver === 'ST') {
|
|
42
|
-
this.state.onOff = newValue;
|
|
43
|
-
}*/
|
|
44
36
|
|
|
45
37
|
return super.handlePropertyChange({ driver, newValue, oldValue, formattedValue });
|
|
46
38
|
}
|
|
@@ -58,9 +50,10 @@ export class ISYDimmableBehavior extends ISYClusterBehavior(DimmableLightRequire
|
|
|
58
50
|
override setLevel(level: number): MaybePromise<void> {
|
|
59
51
|
level = Converter.Matter.LevelFrom0To255.LightingLevel.from(level);
|
|
60
52
|
if (level > 0) {
|
|
61
|
-
return this.device.on();
|
|
53
|
+
return this.device.on(level);
|
|
62
54
|
} else {
|
|
63
55
|
return this.device.off();
|
|
64
56
|
}
|
|
57
|
+
|
|
65
58
|
}
|
|
66
59
|
}
|
|
@@ -20,7 +20,7 @@ import { format, loggers } from 'winston';
|
|
|
20
20
|
import type { ISYDeviceNode } from '../../Devices/ISYDeviceNode.js';
|
|
21
21
|
import { InsteonDimmableDevice, InsteonKeypadButtonDevice, InsteonRelayDevice, ISY } from '../../ISY.js';
|
|
22
22
|
import { ISYBridgedDeviceBehavior } from '../Behaviors/ISYBridgedDeviceBehavior.js';
|
|
23
|
-
import { ISYDimmableBehavior, ISYOnOffBehavior } from '../Behaviors/ISYOnOffBehavior.js';
|
|
23
|
+
import { ISYDimmableBehavior, ISYOnOffBehavior } from '../Behaviors/Insteon/ISYOnOffBehavior.js';
|
|
24
24
|
import '../Mappings/Insteon.js';
|
|
25
25
|
|
|
26
26
|
// #region Interfaces (1)
|
|
@@ -19,7 +19,7 @@ const map: FamilyToClusterMap<Family.Insteon> = {
|
|
|
19
19
|
mapping: {
|
|
20
20
|
OnOff: {
|
|
21
21
|
attributes: {
|
|
22
|
-
onOff:
|
|
22
|
+
onOff: 'ST'
|
|
23
23
|
},
|
|
24
24
|
commands: { on: 'DON' }
|
|
25
25
|
}
|
|
@@ -47,9 +47,9 @@ const map: FamilyToClusterMap<Family.Insteon> = {
|
|
|
47
47
|
},
|
|
48
48
|
LevelControl: {
|
|
49
49
|
attributes: {
|
|
50
|
-
currentLevel: { driver:
|
|
50
|
+
currentLevel: { driver: 'ST', converter: 'LevelFrom0To255.LightingLevel' }
|
|
51
51
|
},
|
|
52
|
-
commands: {
|
|
52
|
+
commands: { setLevel: { command: 'DON' } }
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/Model/NodeInfo.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { DriverState } from './DriverState.js';
|
|
|
4
4
|
|
|
5
5
|
// #region Type aliases (1)
|
|
6
6
|
|
|
7
|
-
export type NodeInfo<T extends Family = Family> = T extends Family.ZWave ? DynamicNodeInfo : StaticNodeInfo;
|
|
7
|
+
export type NodeInfo<T extends Family = Family> = (T extends Family.ZWave ? DynamicNodeInfo : StaticNodeInfo) & { state?: { [x: string]: DriverState } };
|
|
8
8
|
|
|
9
9
|
// #endregion Type aliases (1)
|
|
10
10
|
|
|
@@ -47,6 +47,7 @@ export interface DynamicNodeInfo {
|
|
|
47
47
|
parent?: Parent;
|
|
48
48
|
pnode: any;
|
|
49
49
|
property?: DriverState[] | DriverState;
|
|
50
|
+
|
|
50
51
|
rpnode: string;
|
|
51
52
|
sgid: string;
|
|
52
53
|
startDelay: number;
|