isy-nodejs 1.0.6-alpha.0 → 1.0.6-alpha.1
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/esm/CodeGeneration/EnumFactory.js +1 -1
- package/dist/esm/CodeGeneration/EnumFactory.js.map +1 -1
- package/dist/esm/CodeGeneration/NodeClassFactory.js +5 -4
- package/dist/esm/CodeGeneration/NodeClassFactory.js.map +1 -1
- package/dist/esm/Converters.js.map +1 -1
- package/dist/esm/Definitions/Global/Drivers.js +7 -5
- package/dist/esm/Definitions/Global/Drivers.js.map +1 -1
- package/dist/esm/Devices/DynamicNode.js +19 -0
- package/dist/esm/Devices/DynamicNode.js.map +1 -0
- package/dist/esm/Devices/GenericNode.js +17 -0
- package/dist/esm/Devices/GenericNode.js.map +1 -0
- package/dist/esm/Devices/Insteon/InsteonDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonDeviceFactory.js +86 -102
- package/dist/esm/Devices/Insteon/InsteonDeviceFactory.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonLockDevice.js +4 -5
- package/dist/esm/Devices/Insteon/InsteonLockDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonMotionSensorDevice.js +4 -5
- package/dist/esm/Devices/Insteon/InsteonMotionSensorDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonRelayDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonThermostatDevice.js +2 -24
- package/dist/esm/Devices/Insteon/InsteonThermostatDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/index.js +3 -0
- package/dist/esm/Devices/Insteon/index.js.map +1 -1
- package/dist/esm/Devices/MapsTo.js +0 -11
- package/dist/esm/Devices/MapsTo.js.map +1 -1
- package/dist/esm/Devices/NodeFactory.js +1 -1
- package/dist/esm/Devices/NodeFactory.js.map +1 -1
- package/dist/esm/Devices/ZWave/ZWaveBaseDevice.js +2 -2
- package/dist/esm/Devices/ZWave/ZWaveBaseDevice.js.map +1 -1
- package/dist/esm/Devices/ZWave/ZWaveDimmerSwitchDevice.js +2 -2
- package/dist/esm/Devices/ZWave/ZWaveDimmerSwitchDevice.js.map +1 -1
- package/dist/esm/Devices/ZWave/ZWaveLockDevice.js +5 -5
- package/dist/esm/Devices/ZWave/ZWaveLockDevice.js.map +1 -1
- package/dist/esm/ISY.js +3 -3
- package/dist/esm/ISY.js.map +1 -1
- package/dist/esm/ISYConstants.js +0 -5
- package/dist/esm/ISYConstants.js.map +1 -1
- package/dist/esm/ISYNode.js +12 -7
- 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 +1 -1
- package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js +1 -0
- package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
- package/dist/esm/Matter/Mappings/Insteon.js +3 -5
- package/dist/esm/Matter/Mappings/Insteon.js.map +1 -1
- package/dist/esm/Matter/Mappings/MappingRegistry.js +26 -9
- package/dist/esm/Matter/Mappings/MappingRegistry.js.map +1 -1
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/types/CodeGeneration/EnumFactory.d.ts +2 -2
- package/dist/esm/types/CodeGeneration/EnumFactory.d.ts.map +1 -1
- package/dist/esm/types/CodeGeneration/NodeClassFactory.d.ts +11 -9
- package/dist/esm/types/CodeGeneration/NodeClassFactory.d.ts.map +1 -1
- package/dist/esm/types/Converters.d.ts +25 -16
- package/dist/esm/types/Converters.d.ts.map +1 -1
- package/dist/esm/types/Definitions/Global/Drivers.d.ts.map +1 -1
- package/dist/esm/types/Devices/DynamicNode.d.ts +11 -0
- package/dist/esm/types/Devices/DynamicNode.d.ts.map +1 -0
- package/dist/esm/types/Devices/EndpointFor.d.ts +3 -3
- package/dist/esm/types/Devices/GenericNode.d.ts +9 -0
- package/dist/esm/types/Devices/GenericNode.d.ts.map +1 -0
- package/dist/esm/types/Devices/Insteon/InsteonDevice.d.ts +10 -10
- package/dist/esm/types/Devices/Insteon/InsteonDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonDeviceFactory.d.ts +3 -4
- package/dist/esm/types/Devices/Insteon/InsteonDeviceFactory.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonMotionSensorDevice.d.ts +3 -3
- package/dist/esm/types/Devices/Insteon/InsteonMotionSensorDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonRelayDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonThermostatDevice.d.ts +2 -9
- package/dist/esm/types/Devices/Insteon/InsteonThermostatDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/index.d.ts +3 -0
- package/dist/esm/types/Devices/Insteon/index.d.ts.map +1 -1
- package/dist/esm/types/Devices/MapsTo.d.ts +1 -3
- package/dist/esm/types/Devices/MapsTo.d.ts.map +1 -1
- package/dist/esm/types/Devices/ZWave/ZWaveBaseDevice.d.ts +2 -2
- package/dist/esm/types/Devices/ZWave/ZWaveBaseDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/ZWave/ZWaveDimmerSwitchDevice.d.ts +2 -2
- package/dist/esm/types/Devices/ZWave/ZWaveDimmerSwitchDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/ZWave/ZWaveLockDevice.d.ts +2 -1
- package/dist/esm/types/Devices/ZWave/ZWaveLockDevice.d.ts.map +1 -1
- package/dist/esm/types/ISY.d.ts.map +1 -1
- package/dist/esm/types/ISYConstants.d.ts +0 -263
- package/dist/esm/types/ISYConstants.d.ts.map +1 -1
- package/dist/esm/types/ISYNode.d.ts +5 -5
- package/dist/esm/types/ISYNode.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts +4 -4
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts +2 -2
- package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Mappings/Insteon.d.ts.map +1 -1
- package/dist/esm/types/Matter/Mappings/MappingRegistry.d.ts +35 -21
- package/dist/esm/types/Matter/Mappings/MappingRegistry.d.ts.map +1 -1
- package/dist/esm/types/Model/EnumDefinition.d.ts +1 -1
- package/dist/esm/types/Utils.d.ts +5 -5
- package/dist/esm/types/Utils.d.ts.map +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/CodeGeneration/EnumFactory.ts +1 -1
- package/src/CodeGeneration/NodeClassFactory.ts +7 -4
- package/src/Converters.ts +7 -4
- package/src/Definitions/Global/Drivers.ts +8 -6
- package/src/Devices/DynamicNode.ts +37 -0
- package/src/Devices/GenericNode.ts +31 -0
- package/src/Devices/Insteon/InsteonDevice.ts +0 -3
- package/src/Devices/Insteon/InsteonDeviceFactory.ts +93 -104
- package/src/Devices/Insteon/InsteonFanDevice.ts +1 -1
- package/src/Devices/Insteon/InsteonLockDevice.ts +5 -5
- package/src/Devices/Insteon/InsteonMotionSensorDevice.ts +8 -5
- package/src/Devices/Insteon/InsteonRelayDevice.ts +1 -8
- package/src/Devices/Insteon/InsteonThermostatDevice.ts +3 -20
- package/src/Devices/Insteon/index.ts +6 -0
- package/src/Devices/MapsTo.ts +0 -25
- package/src/Devices/NCD/Generated/Relay.ts +17 -14
- package/src/Devices/NodeFactory.ts +1 -1
- package/src/Devices/ZWave/ZWaveBaseDevice.ts +2 -1
- package/src/Devices/ZWave/ZWaveDimmerSwitchDevice.ts +2 -1
- package/src/Devices/ZWave/ZWaveLockDevice.ts +7 -6
- package/src/Devices/ZigBeeLegacy/Generated/Relay.ts +14 -17
- package/src/Devices/ZigBeeLegacy/Generated/Thermostat.ts +70 -87
- package/src/ISY.ts +3 -4
- package/src/ISYConstants.ts +0 -10
- package/src/ISYNode.ts +7 -2
- package/src/ISYScene.ts +3 -3
- package/src/Matter/Behaviors/ISYBridgedDeviceBehavior.ts +12 -30
- package/src/Matter/Behaviors/ISYClusterBehavior.ts +8 -7
- package/src/Matter/Mappings/Insteon.ts +7 -7
- package/src/Matter/Mappings/MappingRegistry.ts +93 -35
- package/src/Utils.ts +21 -18
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.6-alpha.
|
|
5
|
+
"version": "1.0.6-alpha.1",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Pradeep Mouli"
|
|
8
8
|
},
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"faye-websocket": "^0.11.4",
|
|
64
64
|
"mocha": "^10.8.2",
|
|
65
65
|
"p-queue": "^8.0.1",
|
|
66
|
+
"type-fest": "4.28.0",
|
|
66
67
|
"winston": "^3.17.0",
|
|
67
68
|
"ws": "^8.18.0",
|
|
68
69
|
"xml2js": "^0.6.2"
|
|
@@ -73,5 +74,5 @@
|
|
|
73
74
|
"publishConfig": {
|
|
74
75
|
"access": "public"
|
|
75
76
|
},
|
|
76
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "ad2041ab8c841c6b22ae49d28a0cfc45482ccf87"
|
|
77
78
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { createWrappedNode, IndentationText, Project, QuoteKind,
|
|
1
|
+
import { createWrappedNode, IndentationText, Project, QuoteKind, ScriptTarget, SourceFile, type Node } from 'ts-morph';
|
|
2
2
|
import { factory, Statement, type Declaration } from 'typescript';
|
|
3
|
+
import ts from 'typescript';
|
|
4
|
+
|
|
3
5
|
import type { Driver } from '../Definitions/Global/Drivers.js';
|
|
4
6
|
import { UnitOfMeasure } from '../Definitions/Global/UOM.js';
|
|
5
7
|
|
|
@@ -28,7 +30,7 @@ export class NodeClassFactory extends CodeFactory {
|
|
|
28
30
|
|
|
29
31
|
public static _basePath: string;
|
|
30
32
|
public static project = new Project({
|
|
31
|
-
compilerOptions: { target:
|
|
33
|
+
compilerOptions: { target: ScriptTarget.ESNext, module: ts.ModuleKind.ESNext },
|
|
32
34
|
manipulationSettings: {
|
|
33
35
|
usePrefixAndSuffixTextForRename: true,
|
|
34
36
|
quoteKind: QuoteKind.Single,
|
|
@@ -474,11 +476,12 @@ export class NodeClassFactory extends CodeFactory {
|
|
|
474
476
|
});
|
|
475
477
|
let currentKind = ts.SyntaxKind.Unknown;
|
|
476
478
|
for (const s of f.getStatements()) {
|
|
477
|
-
|
|
479
|
+
|
|
480
|
+
if (currentKind.valueOf() != s.getKind().valueOf()) {
|
|
478
481
|
if (currentKind != ts.SyntaxKind.Unknown) {
|
|
479
482
|
s.prependWhitespace('\n');
|
|
480
483
|
}
|
|
481
|
-
currentKind = s.getKind();
|
|
484
|
+
currentKind = s.getKind().valueOf();
|
|
482
485
|
}
|
|
483
486
|
}
|
|
484
487
|
f.insertText(0, '/* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT DIRECTLY. */\n\n');
|
package/src/Converters.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UnitOfMeasure } from './Definitions/Global/UOM.js';
|
|
2
|
-
import {
|
|
2
|
+
import {type PathsWithLimit, type StringKeys } from './Utils.js';
|
|
3
|
+
import {Paths} from 'type-fest'
|
|
3
4
|
|
|
4
5
|
let BooleanPercentage: Converter<boolean, number>;
|
|
5
6
|
let NullConverter: Converter<any, any>;
|
|
@@ -112,17 +113,19 @@ export namespace Converter {
|
|
|
112
113
|
|
|
113
114
|
export type ConverterTypes = `${StringKeys<typeof StandardConverters>}`;
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
type StandardConverters = Paths<typeof StandardConverters, {maxRecursionDepth: 1, bracketNotation: false}>
|
|
116
117
|
|
|
118
|
+
type Invert<K extends string> = K extends `${infer T}.${infer U}` ? `${U}.${T}` | K : never;
|
|
117
119
|
//export type StandardConvertersList = PathsWithLimit<typeof StandardConverters, 1>;
|
|
118
120
|
|
|
121
|
+
|
|
119
122
|
export type MatterISYConvertibleTypes = `${StringKeys<(typeof Matter)[`${keyof typeof Matter}`]>}`;
|
|
120
123
|
|
|
121
124
|
export type ISYMatterConvertibleTypes = `${StringKeys<typeof Matter>}`;
|
|
122
125
|
|
|
123
|
-
export type MatterConverters =
|
|
126
|
+
export type MatterConverters = Paths<typeof Matter, {maxRecursionDepth: 1, bracketNotation: false}>
|
|
124
127
|
|
|
125
|
-
export type KnownConverters = StandardConverters | MatterConverters
|
|
128
|
+
export type KnownConverters = Invert<StandardConverters> | Invert<MatterConverters>;
|
|
126
129
|
const cache: { [x: string]: Converter<any, any> } = {};
|
|
127
130
|
export function get(label: KnownConverters): Converter<any, any>;
|
|
128
131
|
export function get(from: UnitOfMeasure, to: UnitOfMeasure): Converter<any,any>
|
|
@@ -365,7 +365,7 @@ export namespace Driver {
|
|
|
365
365
|
};
|
|
366
366
|
};
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
|
|
369
369
|
export type For<D extends string, T, S extends boolean = false> = T extends Signature<infer U, infer V, infer SU, infer N, infer L> ? StatelessOrStateful<D, U, V, N, L, S> : never;
|
|
370
370
|
|
|
371
371
|
export type ForAll<T, S extends boolean = false> = {
|
|
@@ -398,10 +398,11 @@ export namespace Driver {
|
|
|
398
398
|
return {
|
|
399
399
|
id: driver as D,
|
|
400
400
|
stateless: true,
|
|
401
|
-
uom:
|
|
401
|
+
uom: driverSignature.uom as U,
|
|
402
|
+
serverUom: initState?.uom != driverSignature.uom ? initState?.uom : undefined,
|
|
402
403
|
state: {
|
|
403
404
|
initial: true,
|
|
404
|
-
value:
|
|
405
|
+
value: initState?.value, //TODO include converter
|
|
405
406
|
formattedValue: initState.formatted,
|
|
406
407
|
pendingValue: null
|
|
407
408
|
},
|
|
@@ -422,16 +423,17 @@ export namespace Driver {
|
|
|
422
423
|
value:
|
|
423
424
|
initState ?
|
|
424
425
|
converter ? converter.from(initState.value)
|
|
425
|
-
:
|
|
426
|
-
: null,
|
|
426
|
+
: driverSignature?.uom && initState?.uom != driverSignature?.uom ? Converter.convert(initState.uom, driverSignature.uom, initState.value)
|
|
427
|
+
: initState.value : null,
|
|
427
428
|
rawValue: initState ? initState.value : null,
|
|
428
429
|
formattedValue: initState ? initState.formatted : null,
|
|
429
430
|
pendingValue: null
|
|
430
431
|
},
|
|
431
432
|
async query() {
|
|
432
433
|
let s = await query();
|
|
433
|
-
this.state.value = converter ? converter.from(s.value) :
|
|
434
|
+
this.state.value = converter ? converter.from(s.value) : this.uom !== s.uom ? Converter.convert(s.value, s.uom, this.uom) : s.value;
|
|
434
435
|
this.state.formattedValue = s.formatted;
|
|
436
|
+
this.state.rawValue = s.value;
|
|
435
437
|
return s;
|
|
436
438
|
},
|
|
437
439
|
apply(state: DriverState, notify = false) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Driver, type Family } from '../Definitions/index.js';
|
|
2
|
+
import type { ISY } from '../ISY.js';
|
|
3
|
+
import { ISYNode } from '../ISYNode.js';
|
|
4
|
+
import type { DriverState } from '../Model/DriverState.js';
|
|
5
|
+
import type { NodeDef } from '../Model/NodeDef.js';
|
|
6
|
+
import type { NodeInfo } from '../Model/NodeInfo.js';
|
|
7
|
+
import { ISYDeviceNode } from './ISYDeviceNode.js';
|
|
8
|
+
|
|
9
|
+
export abstract class DynamicNode<T extends Family.ZWave | Family.ZigBee,D extends ISYNode.DriverSignatures,C,E extends ISYNode.EventSignatures> extends ISYDeviceNode<T,D,C,E> {
|
|
10
|
+
|
|
11
|
+
abstract getNodeDef() : Promise<NodeDef>;
|
|
12
|
+
|
|
13
|
+
constructor(isy: ISY, node: NodeInfo<T>) {
|
|
14
|
+
super(isy, node);
|
|
15
|
+
this.getNodeDef().then((def) => {
|
|
16
|
+
for(let st in this.drivers) {
|
|
17
|
+
if(!((def.sts.st) as Array<any>).find((s) => s.id === st)) {
|
|
18
|
+
delete this.drivers[st];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
for(let cmd in this.commands) {
|
|
22
|
+
if(!((def.cmds.accepts.cmd) as Array<any>).find((c) => c.id === cmd)) {
|
|
23
|
+
delete this.commands[cmd];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/*override handleEvent(event: { control?: any; data?: any; node?: any; action?: any; fmtAct?: any; }): boolean {
|
|
31
|
+
if(event.node !== this.address) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if()
|
|
35
|
+
return false;
|
|
36
|
+
}*/
|
|
37
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Driver } from '../Definitions/index.js';
|
|
2
|
+
import type { ISY } from '../ISY.js';
|
|
3
|
+
import { ISYNode } from '../ISYNode.js';
|
|
4
|
+
import type { DriverState } from '../Model/DriverState.js';
|
|
5
|
+
import type { NodeInfo } from '../Model/NodeInfo.js';
|
|
6
|
+
import { ISYDeviceNode } from './ISYDeviceNode.js';
|
|
7
|
+
|
|
8
|
+
export class GenericNode extends ISYDeviceNode<any,any,any,any> {
|
|
9
|
+
constructor(isy: ISY, node: NodeInfo) {
|
|
10
|
+
super(isy, node);
|
|
11
|
+
for(const prop in node.state) {
|
|
12
|
+
this.drivers[prop] = Driver.create(prop as never, this,node.state[prop]);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override applyStatus(prop: DriverState): void {
|
|
18
|
+
if(!this.drivers[prop.id]) {
|
|
19
|
+
this.drivers[prop.id] = Driver.create(prop.id as never, this,prop,{uom: prop.uom, label: prop.name as string ?? prop.id as string, name: prop.name as string ?? prop.id as string});
|
|
20
|
+
}
|
|
21
|
+
super.applyStatus(prop);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/*override handleEvent(event: { control?: any; data?: any; node?: any; action?: any; fmtAct?: any; }): boolean {
|
|
25
|
+
if(event.node !== this.address) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if()
|
|
29
|
+
return false;
|
|
30
|
+
}*/
|
|
31
|
+
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { ISY } from '../../ISY.js';
|
|
2
2
|
|
|
3
|
-
import { Insteon } from '../../Definitions/Global/Families.js';
|
|
4
|
-
import { Commands } from '../../ISYConstants.js'
|
|
5
3
|
import { Constructor } from '../Constructor.js';
|
|
6
|
-
import { InsteonKeypadButtonDevice } from './InsteonKeypadDevice.js';
|
|
7
4
|
import { InsteonRelayDevice } from './InsteonRelayDevice.js';
|
|
8
5
|
import 'winston';
|
|
9
6
|
import type { InsteonBaseDevice } from './InsteonBaseDevice.js';
|