isy-nodejs 1.0.3-y.0 → 1.0.4-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.
Files changed (32) hide show
  1. package/dist/esm/Devices/EndpointFor.js.map +1 -1
  2. package/dist/esm/Devices/ISYDevice.js.map +1 -1
  3. package/dist/esm/Devices/Insteon/InsteonDimmableDevice.js +2 -2
  4. package/dist/esm/Devices/Insteon/InsteonDimmableDevice.js.map +1 -1
  5. package/dist/esm/Devices/Insteon/InsteonRelayDevice.js +1 -1
  6. package/dist/esm/Devices/Insteon/InsteonRelayDevice.js.map +1 -1
  7. package/dist/esm/ISYNode.js +12 -4
  8. package/dist/esm/ISYNode.js.map +1 -1
  9. package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
  10. package/dist/esm/types/Devices/EndpointFor.d.ts +5 -5
  11. package/dist/esm/types/Devices/EndpointFor.d.ts.map +1 -1
  12. package/dist/esm/types/Devices/ISYDevice.d.ts +1 -1
  13. package/dist/esm/types/Devices/ISYDevice.d.ts.map +1 -1
  14. package/dist/esm/types/Devices/Insteon/InsteonDevice.d.ts +6 -4
  15. package/dist/esm/types/Devices/Insteon/InsteonDevice.d.ts.map +1 -1
  16. package/dist/esm/types/Devices/Insteon/InsteonDimmableDevice.d.ts +2 -2
  17. package/dist/esm/types/Devices/Insteon/InsteonDimmableDevice.d.ts.map +1 -1
  18. package/dist/esm/types/Devices/Insteon/InsteonRelayDevice.d.ts +1 -1
  19. package/dist/esm/types/Devices/Insteon/InsteonRelayDevice.d.ts.map +1 -1
  20. package/dist/esm/types/ISYNode.d.ts +5 -3
  21. package/dist/esm/types/ISYNode.d.ts.map +1 -1
  22. package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
  23. package/dist/esm/types/Model/EnumDefinition.d.ts +1 -1
  24. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  25. package/package.json +2 -2
  26. package/src/Devices/EndpointFor.ts +4 -3
  27. package/src/Devices/ISYDevice.ts +2 -1
  28. package/src/Devices/Insteon/InsteonDimmableDevice.ts +3 -2
  29. package/src/Devices/Insteon/InsteonRelayDevice.ts +3 -2
  30. package/src/ISYNode.ts +19 -8
  31. package/src/Matter/Behaviors/ISYBridgedDeviceBehavior.ts +1 -2
  32. package/src/Model/NLS.ts +1 -1
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.3-y.0",
5
+ "version": "1.0.4-alpha.1",
6
6
  "author": {
7
7
  "name": "Pradeep Mouli"
8
8
  },
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "e28859e01d805f420d064c9c56e5e2f481cf5514"
76
+ "gitHead": "25bc1f98e239376a78bf7e78b852a5c25e2b964f"
77
77
  }
@@ -1,13 +1,14 @@
1
- import { Endpoint } from '@project-chip/matter.js/endpoint';
2
- import { SupportedBehaviors } from '@project-chip/matter.js/endpoint/properties';
1
+ import { Endpoint, type EndpointType, type MutableEndpoint } from '@project-chip/matter.js/endpoint';
2
+
3
3
  import { Behavior } from '@project-chip/matter.js/behavior';
4
- import { MutableEndpoint, EndpointType } from '@project-chip/matter.js/endpoint/type';
4
+
5
5
  import type { ClusterBehavior } from '@project-chip/matter.js/behavior/cluster';
6
6
  import { type ClusterType } from '@project-chip/matter.js/cluster';
7
7
  import type { Constructor } from './Constructor.js';
8
8
  import type { ISYDeviceNode } from '../Devices/ISYDeviceNode.js';
9
9
 
10
10
  import { BridgedDeviceBasicInformationBehavior, BridgedDeviceBasicInformationServer } from '@project-chip/matter.js/behaviors/bridged-device-basic-information';
11
+ import type { SupportedBehaviors } from '@matter/node';
11
12
 
12
13
 
13
14
  export type RelaxTypes<V> = V extends number
@@ -1,6 +1,7 @@
1
+ import type { SupportedBehaviors } from '@matter/node';
1
2
  import { ClusterBehavior } from '@project-chip/matter.js/behavior/cluster';
2
3
  import type { Endpoint, EndpointType, MutableEndpoint } from '@project-chip/matter.js/endpoint';
3
- import type { SupportedBehaviors } from '@project-chip/matter.js/endpoint/properties';
4
+
4
5
  import 'winston';
5
6
 
6
7
  // export const ISYBinaryStateDevice = <K extends Family,D extends DriverSignatures, T extends Constructor<ISYDeviceNode<K,Driver.ToSignatures<'ST'>,any,any>>>(Base: T) => {
@@ -11,7 +11,8 @@ 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
+ import { DimmerLampSwitchNode } from './Generated/DimmerLampSwitch.js';
15
+
15
16
 
16
17
  // #region Type aliases (2)
17
18
 
@@ -23,7 +24,7 @@ type OnOffBehavior = typeof OOB;
23
24
  // #region Classes (1)
24
25
 
25
26
  //@ts-ignore
26
- export class InsteonDimmableDevice extends DimmerLampSwitch.Node{
27
+ export class InsteonDimmableDevice extends DimmerLampSwitchNode{
27
28
  // #region Constructors (1)
28
29
 
29
30
  constructor(isy: ISY, node: NodeInfo) {
@@ -7,20 +7,21 @@ import { InsteonBaseDevice } from './InsteonBaseDevice.js';
7
7
 
8
8
  import type { OnOffBehavior } from '@project-chip/matter.js/behaviors/on-off';
9
9
  import 'winston';
10
- import { RelayLampSwitch } from './RelayLampSwitch.js';
10
+
11
11
  import type { Command } from '../../Definitions/Global/Commands.js';
12
12
  import { Driver, DriverType } from '../../Definitions/Global/Drivers.js';
13
13
  import { UnitOfMeasure } from '../../Definitions/index.js';
14
14
  import { Properties } from '../../ISYConstants.js';
15
15
 
16
16
  import type { DriverState } from '../../Model/DriverState.js';
17
+ import { RelayLampSwitch } from './Generated/RelayLampSwitch.js';
17
18
 
18
19
  export class InsteonRelayDevice extends RelayLampSwitch.Node /*InsteonBaseDevice<Driver.Signatures<'ST' | 'OL' | 'RR' | 'ERR'>, Command.Signatures<'DON' | 'DOF'>>*/ {
19
20
  // #region Constructors (1)
20
21
 
21
22
  constructor(isy: ISY, nodeInfo: NodeInfo) {
22
23
  super(isy, nodeInfo);
23
-
24
+
24
25
  }
25
26
 
26
27
  // #endregion Constructors (1)
package/src/ISYNode.ts CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  import { Logger } from 'winston';
3
2
  import { Driver } from './Definitions/Global/Drivers.js';
4
3
  import { Family } from './Definitions/Global/Families.js';
@@ -52,7 +51,7 @@ export class ISYNode<
52
51
  public drivers: Driver.ForAll<D> = {} as Driver.ForAll<D>;
53
52
  public enabled: boolean;
54
53
  //TODO: add signature for non-command/non-driver events
55
- public events: Merge<Event.NodeEventEmitter<this>,Event.FunctionSigFor<E, Event.NodeEventEmitter<this>>>;
54
+ public events: Merge<Event.NodeEventEmitter<this>, Event.FunctionSigFor<E, Event.NodeEventEmitter<this>>>;
56
55
  //Event.FunctionSigFor<Event.ForAll<E,typeof this>> & Omit<EventEmitter,'on'>
57
56
  /*{
58
57
  [x in E]: x extends keyof D ? {name:`${D[x]["name"]}Changed`, driver: x, value: D[x]["value"], formatted: string, uom: UnitOfMeasure}
@@ -127,7 +126,6 @@ export class ISYNode<
127
126
  }
128
127
  this.events = Event.createEmitter(this);
129
128
 
130
-
131
129
  //this.logger(this.nodeDefId);
132
130
  this.lastChanged = new Date();
133
131
  }
@@ -354,12 +352,25 @@ export class ISYNode<
354
352
  }
355
353
  public async sendCommand(command: StringKeys<C>): Promise<any>;
356
354
  public async sendCommand(command: StringKeys<C>, value: string | number, parameters: Record<string | symbol, string | number | undefined>);
357
- public async sendCommand(command: StringKeys<C>, parameters: Record<string | symbol, string | number | undefined> | string | number): Promise<any>;
358
- async sendCommand(command: StringKeys<C>, value?: string | number, parameters?: Record<string | symbol, string | number | undefined> | string | number): Promise<any> {
359
- if (value !== undefined && typeof parameters === 'object') {
360
- return this.isy.sendNodeCommand(this, command, { default: value, ...parameters });
355
+ public async sendCommand(command: StringKeys<C>, value: string | number): Promise<any>;
356
+ public async sendCommand(command: StringKeys<C>, parameters: Record<string | symbol, string | number | undefined>): Promise<any>;
357
+ async sendCommand(command: StringKeys<C>, valueOrParameters?: string | number | Record<string | symbol, string | number | undefined>, parameters?: Record<string | symbol, string | number | undefined>): Promise<any> {
358
+ if (valueOrParameters === null || valueOrParameters === undefined) {
359
+ return this.isy.sendNodeCommand(this, command);
361
360
  }
362
- return this.isy.sendNodeCommand(this, command, parameters);
361
+
362
+ if(parameters === null || parameters === undefined) {
363
+ return this.isy.sendNodeCommand(this, command, valueOrParameters);
364
+ }
365
+ if(typeof valueOrParameters === 'object') {
366
+ return this.isy.sendNodeCommand(this, command, {...valueOrParameters,...parameters});
367
+ }
368
+ if(typeof valueOrParameters === 'string' || typeof valueOrParameters === 'number') {
369
+ return this.isy.sendNodeCommand(this, command, { default: valueOrParameters, ...parameters });
370
+ }
371
+
372
+
373
+
363
374
  }
364
375
 
365
376
  public async updateProperty(propertyName: string, value: any): Promise<any> {
@@ -4,8 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */ import { Behavior } from '@project-chip/matter.js/behavior';
6
6
  import { ClusterBehavior } from '@project-chip/matter.js/behavior/cluster';
7
- import type { StateType } from '@project-chip/matter.js/behavior/state';
8
- import { Internal } from '@project-chip/matter.js/behavior/state/managed';
7
+
9
8
  import { EventEmitter, Observable } from '@project-chip/matter.js/util';
10
9
  import internal from 'stream';
11
10
  import type { Driver } from '../../Definitions/Global/Drivers.js';
package/src/Model/NLS.ts CHANGED
@@ -2,7 +2,7 @@ import { merge } from 'moderndash';
2
2
  import type { DriverType } from "../Definitions/Global/Drivers.js";
3
3
  import { Family } from "../Definitions/Global/Families.js";
4
4
  import "../Utils.js";
5
- import type { TransactionalInteractionServer } from '@project-chip/matter.js/node/server';
5
+
6
6
 
7
7
  export enum NLSRecordType {
8
8
  Generic = "GEN",