isy-nodejs 1.0.1-alpha.22 → 1.0.1-alpha.25
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/Devices/Insteon/DimmerLampSwitch.js +108 -0
- package/dist/cjs/Devices/Insteon/DimmerLampSwitch.js.map +1 -0
- package/dist/cjs/Devices/Insteon/InsteonDimmableDevice.js +2 -20
- package/dist/cjs/Devices/Insteon/InsteonDimmableDevice.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYBridgedDeviceBehavior.js +5 -3
- package/dist/cjs/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/cjs/Matter/Bridge/Server.js +4 -2
- package/dist/cjs/Matter/Bridge/Server.js.map +1 -1
- package/dist/cjs/types/CodeGeneration/EnumFactory.d.ts +1 -1
- package/dist/cjs/types/Devices/Insteon/DimmerLampSwitch.d.ts +149 -0
- package/dist/cjs/types/Devices/Insteon/DimmerLampSwitch.d.ts.map +1 -0
- package/dist/cjs/types/Devices/Insteon/InsteonDimmableDevice.d.ts +2 -10
- package/dist/cjs/types/Devices/Insteon/InsteonDimmableDevice.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Bridge/Server.d.ts +2 -0
- package/dist/cjs/types/Matter/Bridge/Server.d.ts.map +1 -1
- package/dist/esm/Devices/Insteon/DimmerLampSwitch.js +104 -0
- package/dist/esm/Devices/Insteon/DimmerLampSwitch.js.map +1 -0
- package/dist/esm/Devices/Insteon/InsteonDimmableDevice.js +2 -20
- package/dist/esm/Devices/Insteon/InsteonDimmableDevice.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js +5 -3
- package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/esm/Matter/Bridge/Server.js +4 -2
- package/dist/esm/Matter/Bridge/Server.js.map +1 -1
- package/dist/esm/types/CodeGeneration/EnumFactory.d.ts +1 -1
- package/dist/esm/types/Devices/Insteon/DimmerLampSwitch.d.ts +149 -0
- package/dist/esm/types/Devices/Insteon/DimmerLampSwitch.d.ts.map +1 -0
- package/dist/esm/types/Devices/Insteon/InsteonDimmableDevice.d.ts +2 -10
- package/dist/esm/types/Devices/Insteon/InsteonDimmableDevice.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Bridge/Server.d.ts +2 -0
- package/dist/esm/types/Matter/Bridge/Server.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/Devices/Insteon/DimmerLampSwitch.ts +209 -0
- package/src/Devices/Insteon/InsteonBaseDevice.ts +1 -1
- package/src/Devices/Insteon/InsteonDimmableDevice.ts +4 -3
- package/src/Matter/Behaviors/ISYBridgedDeviceBehavior.ts +11 -4
- package/src/Matter/Bridge/Server.ts +8 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "isy-nodejs",
|
|
3
3
|
"description": "Node.js wrapper for ISY interface including websockets for change notifications. Fork of isy-js by Rod Toll. Designed to be used in a node.js application.",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.0.1-alpha.
|
|
5
|
+
"version": "1.0.1-alpha.25",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Pradeep Mouli"
|
|
8
8
|
},
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "99f03336e2db40ef91e58b059969abba6534c74a"
|
|
73
73
|
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT DIRECTLY. */
|
|
2
|
+
|
|
3
|
+
import { UnitOfMeasure } from '../../Definitions/Global/UOM.js';
|
|
4
|
+
import { Family } from '../../Definitions/Global/Families.js';
|
|
5
|
+
import type { NodeInfo } from '../../Model/NodeInfo.js';
|
|
6
|
+
import type { ISY } from '../../ISY.js';
|
|
7
|
+
import type { ISYNode } from '../../ISYNode.js';
|
|
8
|
+
import { InsteonBaseDevice as Base } from './InsteonBaseDevice.js';
|
|
9
|
+
import { ISYDeviceNode } from '../ISYDeviceNode.js';
|
|
10
|
+
import { Driver } from '../../Definitions/Global/Drivers.js';
|
|
11
|
+
import { Insteon } from '../../Definitions/index.js';
|
|
12
|
+
import type { DriverState } from '../../Model/DriverState.js';
|
|
13
|
+
import { NodeFactory } from '../NodeFactory.js';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const nodeDefId = "DimmerLampSwitch";
|
|
17
|
+
|
|
18
|
+
type Commands = DimmerLampSwitch.Commands;
|
|
19
|
+
type Drivers = DimmerLampSwitch.Drivers;
|
|
20
|
+
|
|
21
|
+
export class DimmerLampSwitchNode extends Base<Drivers, Commands> implements DimmerLampSwitch.Interface {
|
|
22
|
+
public override readonly commands = {
|
|
23
|
+
DON: this.on,
|
|
24
|
+
DOF: this.off,
|
|
25
|
+
DFOF: this.fastOff,
|
|
26
|
+
DFON: this.fastOn,
|
|
27
|
+
BRT: this.brighten,
|
|
28
|
+
DIM: this.dim,
|
|
29
|
+
FDUP: this.fadeUp,
|
|
30
|
+
FDDOWN: this.fadeDown,
|
|
31
|
+
FDSTOP: this.fadeStop,
|
|
32
|
+
QUERY: this.query,
|
|
33
|
+
BEEP: this.beep,
|
|
34
|
+
OL: this.updateOnLevel,
|
|
35
|
+
RR: this.updateRampRate,
|
|
36
|
+
BL: this.backlight,
|
|
37
|
+
WDU: this.writeChanges
|
|
38
|
+
};
|
|
39
|
+
static override nodeDefId = "DimmerLampSwitch";
|
|
40
|
+
declare readonly nodeDefId: "DimmerLampSwitch";
|
|
41
|
+
constructor (isy: ISY, nodeInfo: NodeInfo) {
|
|
42
|
+
super(isy, nodeInfo);
|
|
43
|
+
this.drivers.ST = Driver.create("ST", this, nodeInfo.property as DriverState, { uom: UnitOfMeasure.Percent, label: "Status", name: "status" });
|
|
44
|
+
this.drivers.OL = Driver.create("OL", this, nodeInfo.property as DriverState, { uom: UnitOfMeasure.Percent, label: "On Level", name: "onLevel" });
|
|
45
|
+
this.drivers.RR = Driver.create("RR", this, nodeInfo.property as DriverState, { uom: UnitOfMeasure.Index, label: "Ramp Rate", name: "rampRate" });
|
|
46
|
+
this.drivers.ERR = Driver.create("ERR", this, nodeInfo.property as DriverState, { uom: UnitOfMeasure.Index, label: "Responding", name: "responding" });
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
async on(value?: number) {
|
|
50
|
+
return this.sendCommand("DON", { value: value });
|
|
51
|
+
}
|
|
52
|
+
async off() {
|
|
53
|
+
return this.sendCommand("DOF");
|
|
54
|
+
}
|
|
55
|
+
async fastOff() {
|
|
56
|
+
return this.sendCommand("DFOF");
|
|
57
|
+
}
|
|
58
|
+
async fastOn() {
|
|
59
|
+
return this.sendCommand("DFON");
|
|
60
|
+
}
|
|
61
|
+
async brighten() {
|
|
62
|
+
return this.sendCommand("BRT");
|
|
63
|
+
}
|
|
64
|
+
async dim() {
|
|
65
|
+
return this.sendCommand("DIM");
|
|
66
|
+
}
|
|
67
|
+
async fadeUp() {
|
|
68
|
+
return this.sendCommand("FDUP");
|
|
69
|
+
}
|
|
70
|
+
async fadeDown() {
|
|
71
|
+
return this.sendCommand("FDDOWN");
|
|
72
|
+
}
|
|
73
|
+
async fadeStop() {
|
|
74
|
+
return this.sendCommand("FDSTOP");
|
|
75
|
+
}
|
|
76
|
+
async query() {
|
|
77
|
+
return this.sendCommand("QUERY");
|
|
78
|
+
}
|
|
79
|
+
async beep(value?: number) {
|
|
80
|
+
return this.sendCommand("BEEP", { value: value });
|
|
81
|
+
}
|
|
82
|
+
async updateOnLevel(value: number) {
|
|
83
|
+
return this.sendCommand("OL", { value: value });
|
|
84
|
+
}
|
|
85
|
+
async updateRampRate(value: number) {
|
|
86
|
+
return this.sendCommand("RR", { value: value });
|
|
87
|
+
}
|
|
88
|
+
async backlight(value: number) {
|
|
89
|
+
return this.sendCommand("BL", { value: value });
|
|
90
|
+
}
|
|
91
|
+
async writeChanges() {
|
|
92
|
+
return this.sendCommand("WDU");
|
|
93
|
+
}
|
|
94
|
+
public get status(): number {
|
|
95
|
+
return this.drivers.ST?.value;
|
|
96
|
+
}
|
|
97
|
+
public get onLevel(): number {
|
|
98
|
+
return this.drivers.OL?.value;
|
|
99
|
+
}
|
|
100
|
+
public get rampRate(): number {
|
|
101
|
+
return this.drivers.RR?.value;
|
|
102
|
+
}
|
|
103
|
+
public get responding(): Insteon.Error {
|
|
104
|
+
return this.drivers.ERR?.value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
NodeFactory.register(DimmerLampSwitchNode);
|
|
109
|
+
|
|
110
|
+
export namespace DimmerLampSwitch {
|
|
111
|
+
export interface Interface extends Omit<InstanceType<typeof DimmerLampSwitchNode>, keyof ISYDeviceNode<any, any, any, any>> {
|
|
112
|
+
nodeDefId: "DimmerLampSwitch";
|
|
113
|
+
}
|
|
114
|
+
export function is(node: ISYNode<any, any, any, any>): node is DimmerLampSwitchNode {
|
|
115
|
+
return node.nodeDefId === nodeDefId;
|
|
116
|
+
}
|
|
117
|
+
export function create(isy: ISY, nodeInfo: NodeInfo) {
|
|
118
|
+
return new DimmerLampSwitchNode(isy, nodeInfo);
|
|
119
|
+
}
|
|
120
|
+
export const Node = DimmerLampSwitchNode;
|
|
121
|
+
export type Commands = {
|
|
122
|
+
DON: ((value?: number) => Promise<boolean>) & {
|
|
123
|
+
label: "On";
|
|
124
|
+
name: "on";
|
|
125
|
+
};
|
|
126
|
+
DOF: (() => Promise<boolean>) & {
|
|
127
|
+
label: "Off";
|
|
128
|
+
name: "off";
|
|
129
|
+
};
|
|
130
|
+
DFOF: (() => Promise<boolean>) & {
|
|
131
|
+
label: "Fast Off";
|
|
132
|
+
name: "fastOff";
|
|
133
|
+
};
|
|
134
|
+
DFON: (() => Promise<boolean>) & {
|
|
135
|
+
label: "Fast On";
|
|
136
|
+
name: "fastOn";
|
|
137
|
+
};
|
|
138
|
+
BRT: (() => Promise<boolean>) & {
|
|
139
|
+
label: "Brighten";
|
|
140
|
+
name: "brighten";
|
|
141
|
+
};
|
|
142
|
+
DIM: (() => Promise<boolean>) & {
|
|
143
|
+
label: "Dim";
|
|
144
|
+
name: "dim";
|
|
145
|
+
};
|
|
146
|
+
FDUP: (() => Promise<boolean>) & {
|
|
147
|
+
label: "Fade Up";
|
|
148
|
+
name: "fadeUp";
|
|
149
|
+
};
|
|
150
|
+
FDDOWN: (() => Promise<boolean>) & {
|
|
151
|
+
label: "Fade Down";
|
|
152
|
+
name: "fadeDown";
|
|
153
|
+
};
|
|
154
|
+
FDSTOP: (() => Promise<boolean>) & {
|
|
155
|
+
label: "Fade Stop";
|
|
156
|
+
name: "fadeStop";
|
|
157
|
+
};
|
|
158
|
+
QUERY: (() => Promise<boolean>) & {
|
|
159
|
+
label: "Query";
|
|
160
|
+
name: "query";
|
|
161
|
+
};
|
|
162
|
+
BEEP: ((value?: number) => Promise<boolean>) & {
|
|
163
|
+
label: "Beep";
|
|
164
|
+
name: "beep";
|
|
165
|
+
};
|
|
166
|
+
OL: ((value: number) => Promise<boolean>) & {
|
|
167
|
+
label: "On Level";
|
|
168
|
+
name: "updateOnLevel";
|
|
169
|
+
};
|
|
170
|
+
RR: ((value: number) => Promise<boolean>) & {
|
|
171
|
+
label: "Ramp Rate";
|
|
172
|
+
name: "updateRampRate";
|
|
173
|
+
};
|
|
174
|
+
BL: ((value: number) => Promise<boolean>) & {
|
|
175
|
+
label: "Backlight";
|
|
176
|
+
name: "backlight";
|
|
177
|
+
};
|
|
178
|
+
WDU: (() => Promise<boolean>) & {
|
|
179
|
+
label: "Write Changes";
|
|
180
|
+
name: "writeChanges";
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
export type Drivers = {
|
|
184
|
+
ST: {
|
|
185
|
+
uom: UnitOfMeasure.Percent;
|
|
186
|
+
value: number;
|
|
187
|
+
label: "Status";
|
|
188
|
+
name: "status";
|
|
189
|
+
};
|
|
190
|
+
OL: {
|
|
191
|
+
uom: UnitOfMeasure.Percent;
|
|
192
|
+
value: number;
|
|
193
|
+
label: "On Level";
|
|
194
|
+
name: "onLevel";
|
|
195
|
+
};
|
|
196
|
+
RR: {
|
|
197
|
+
uom: UnitOfMeasure.Index;
|
|
198
|
+
value: number;
|
|
199
|
+
label: "Ramp Rate";
|
|
200
|
+
name: "rampRate";
|
|
201
|
+
};
|
|
202
|
+
ERR: {
|
|
203
|
+
uom: UnitOfMeasure.Index;
|
|
204
|
+
value: Insteon.Error;
|
|
205
|
+
label: "Responding";
|
|
206
|
+
name: "responding";
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
}
|
|
@@ -11,6 +11,7 @@ import { OnOff, ClusterType } from '@project-chip/matter.js/cluster';
|
|
|
11
11
|
import 'winston';
|
|
12
12
|
import { UnitOfMeasure } from '../../Definitions/Global/UOM.js';
|
|
13
13
|
import type { NodeInfo } from '../../Model/NodeInfo.js';
|
|
14
|
+
import { DimmerLampSwitch } from './DimmerLampSwitch.js';
|
|
14
15
|
|
|
15
16
|
// #region Type aliases (2)
|
|
16
17
|
|
|
@@ -22,7 +23,7 @@ type OnOffBehavior = typeof OOB;
|
|
|
22
23
|
// #region Classes (1)
|
|
23
24
|
|
|
24
25
|
//@ts-ignore
|
|
25
|
-
export class InsteonDimmableDevice extends
|
|
26
|
+
export class InsteonDimmableDevice extends DimmerLampSwitch.Node{
|
|
26
27
|
// #region Constructors (1)
|
|
27
28
|
|
|
28
29
|
constructor(isy: ISY, node: NodeInfo) {
|
|
@@ -37,7 +38,7 @@ export class InsteonDimmableDevice extends InsteonRelayDevice implements MapsTo<
|
|
|
37
38
|
// public async updateBrightnessLevel(level: number): Promise<{}> {
|
|
38
39
|
// return super.(level);
|
|
39
40
|
// }
|
|
40
|
-
public override async initialize(endpoint: EndpointFor<LevelControlBehavior, OnOffBehavior>): Promise<void> {
|
|
41
|
+
/*public override async initialize(endpoint: EndpointFor<LevelControlBehavior, OnOffBehavior>): Promise<void> {
|
|
41
42
|
try {
|
|
42
43
|
await super.initialize(endpoint);
|
|
43
44
|
const that = this;
|
|
@@ -51,7 +52,7 @@ export class InsteonDimmableDevice extends InsteonRelayDevice implements MapsTo<
|
|
|
51
52
|
// //endpoint.events.levelCont
|
|
52
53
|
// endpoint.events.levelControl.maxLevel$Changed.on((value) => that.sendCommand("OL",value));
|
|
53
54
|
} catch (error) {}
|
|
54
|
-
}
|
|
55
|
+
}*/
|
|
55
56
|
|
|
56
57
|
// #endregion Public Methods (1)
|
|
57
58
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { ClusterBehavior } from '@project-chip/matter.js/behavior/cluster';
|
|
7
7
|
import type { StateType } from '@project-chip/matter.js/behavior/state';
|
|
8
8
|
import { Internal } from '@project-chip/matter.js/behavior/state/managed';
|
|
9
|
-
import { EventEmitter, Observable } from '@project-chip/matter.js/util';
|
|
9
|
+
import { EventEmitter, Observable, ObservableProxy } from '@project-chip/matter.js/util';
|
|
10
10
|
import internal from 'stream';
|
|
11
11
|
import type { Driver } from '../../Definitions/Global/Drivers.js';
|
|
12
12
|
import { ISY, type Family, type ISYNode } from '../../ISY.js';
|
|
@@ -33,13 +33,18 @@ export class ISYBridgedDeviceBehavior<N extends ISYNode<any, D, any, any>, D ext
|
|
|
33
33
|
this.internal.map = MappingRegistry.getMapping(this.internal.device as unknown as ISYNode<Family, any, any, any>);
|
|
34
34
|
ISY.instance.logger.debug(`Initializing ${this.constructor.name} for ${this.internal.device.constructor.name} ${this.internal.device.name} with address ${address}`);
|
|
35
35
|
if (d) {
|
|
36
|
-
d.events.on('
|
|
36
|
+
d.events.on('propertyChanged', this.handlePropertyChange.bind(this));
|
|
37
37
|
for(const f in d.drivers)
|
|
38
38
|
{
|
|
39
39
|
let evt = `${d.drivers[f].name}Changed`;
|
|
40
|
-
|
|
40
|
+
const obs = Observable<[{ driver: string; newValue: any; oldValue: any; formattedValue: string }]>();
|
|
41
|
+
|
|
42
|
+
d.events.on(evt, (driver: string, newValue: any, oldValue: any, formattedValue: string) => obs.emit({ driver, newValue, oldValue, formattedValue }));
|
|
43
|
+
this.events[evt] = obs;
|
|
44
|
+
|
|
41
45
|
//@ts-ignore
|
|
42
|
-
d.events.on(evt, (driver: string, newValue: any, oldValue: any, formattedValue: string) => this.events.emit(evt, { driver, newValue, oldValue, formattedValue } as unknown as any));
|
|
46
|
+
//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
|
+
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
}
|
|
@@ -61,7 +66,9 @@ export class ISYBridgedDeviceBehavior<N extends ISYNode<any, D, any, any>, D ext
|
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
override [Symbol.asyncDispose]() {
|
|
69
|
+
|
|
64
70
|
this.internal.device = null;
|
|
71
|
+
|
|
65
72
|
return super[Symbol.asyncDispose]();
|
|
66
73
|
}
|
|
67
74
|
}
|
|
@@ -41,6 +41,10 @@ export interface Config {
|
|
|
41
41
|
vendorId: number;
|
|
42
42
|
vendorName?: string;
|
|
43
43
|
|
|
44
|
+
ipv4?: boolean;
|
|
45
|
+
|
|
46
|
+
ipv6?: boolean;
|
|
47
|
+
|
|
44
48
|
// #endregion Properties (8)
|
|
45
49
|
}
|
|
46
50
|
|
|
@@ -96,7 +100,7 @@ export async function createMatterServer(isy?: ISY, config?: Config): Promise<Se
|
|
|
96
100
|
network: {
|
|
97
101
|
port: config.port,
|
|
98
102
|
|
|
99
|
-
|
|
103
|
+
ipv4: config.ipv4,
|
|
100
104
|
discoveryCapabilities: {
|
|
101
105
|
onIpNetwork: true
|
|
102
106
|
}
|
|
@@ -311,7 +315,9 @@ async function initializeConfiguration(isy: ISY, config?: Config): Promise<Confi
|
|
|
311
315
|
productName,
|
|
312
316
|
productId,
|
|
313
317
|
port,
|
|
314
|
-
uniqueId
|
|
318
|
+
uniqueId,
|
|
319
|
+
ipv4: config.ipv4 ?? true,
|
|
320
|
+
ipv6: config.ipv6 ?? true
|
|
315
321
|
};
|
|
316
322
|
}
|
|
317
323
|
|