isy-nodejs 1.0.2-alpha.0 → 1.0.2-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/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.2-alpha.0",
5
+ "version": "1.0.2-alpha.1",
6
6
  "author": {
7
7
  "name": "Pradeep Mouli"
8
8
  },
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "1c92bb07bb652f73334bf200841ab4a10f562965"
73
+ "gitHead": "e8bc6294609ae4951cdf35bf1a7c926ef0ff5cd9"
74
74
  }
package/src/ISY.ts CHANGED
@@ -750,7 +750,7 @@ export class ISY extends EventEmitter implements Disposable {
750
750
  //newDevice = new cls(this, nodeInfo) as ISYDeviceNode<any, any, any, any>;
751
751
  }
752
752
 
753
- if (m) {
753
+ if (m && newDevice) {
754
754
  newDevice.productName = m.name;
755
755
  newDevice.model = `(${m.modelNumber}) ${m.name} v.${m.version}`;
756
756
  newDevice.modelNumber = m.modelNumber;
@@ -17,6 +17,8 @@ import type { ISYNode } from '../../ISYNode.js';
17
17
  import type { Family } from '../../Definitions/index.js';
18
18
 
19
19
 
20
+
21
+
20
22
  type ClusterForBehavior<B extends ClusterBehavior> = B extends ClusterBehavior.Type<infer C> ? C : never;
21
23
  export class ISYBridgedDeviceBehavior<N extends ISYNode<any, D, any, any>, D extends ISYNode.DriverSignatures = ISYNode.DriverSignatures> extends Behavior {
22
24
  static override readonly id = 'isyNode';
@@ -33,7 +35,7 @@ export class ISYBridgedDeviceBehavior<N extends ISYNode<any, D, any, any>, D ext
33
35
  var address = this.state.address;
34
36
  const d = ISY.instance.nodeMap.get(this.state.address);
35
37
  this.internal.device = d;
36
- this.internal.map = MappingRegistry.getMapping(this.internal.device as unknown as ISYNode<Family, any, any, any>);
38
+ this.internal.map = MappingRegistry.getMapping(this.internal.device as ISYNode<Family, any, any, any>);
37
39
 
38
40
  ISY.instance.logger.debug(`Initializing ${this.constructor.name} for ${this.internal.device.constructor.name} ${this.internal.device.name} with address ${address}`);
39
41
  if (d) {
@@ -44,6 +46,8 @@ export class ISYBridgedDeviceBehavior<N extends ISYNode<any, D, any, any>, D ext
44
46
  let evt = `${d.drivers[f].name}Changed`;
45
47
  const obs = Observable<[{ driver: string; newValue: any; oldValue: any; formattedValue: string }]>();
46
48
 
49
+
50
+
47
51
  d.events.on(evt, (driver: string, newValue: any, oldValue: any, formattedValue: string) => obs.emit({ driver, newValue, oldValue, formattedValue }));
48
52
  this.events[evt] = obs;
49
53
 
@@ -8,7 +8,7 @@ import { DriverType } from '../Definitions/Global/Drivers.js';
8
8
  import { Devices } from '../Devices/index.js';
9
9
  import { Insteon } from '../Devices/Insteon/index.js';
10
10
 
11
- import type { CommandsOf, DriversOf, ISYNode } from '../ISYNode.js';
11
+ import { CommandsOf, DriversOf, ISYNode } from '../ISYNode.js';
12
12
  import { ClusterType } from './ClusterType.js';
13
13
  import type { Family } from '../Definitions/index.js';
14
14
 
@@ -145,13 +145,13 @@ export class MappingRegistry {
145
145
 
146
146
  // #region Public Static Methods (3)
147
147
 
148
- public static getMapping<T extends ISYNode<any, any, any, any>>(device: T) {
148
+ public static getMapping<T extends ISYNode<any,any,any,any>>(device: ISYNode<any,any,any,any>) {
149
149
  if(MappingRegistry.map.has(device.family))
150
150
  {
151
151
  let g = MappingRegistry.map.get(device.family);
152
- if(g.has(device.name))
152
+ if(g.has(device.constructor.name))
153
153
  {
154
- return g.get(device.name);
154
+ return g.get(device.constructor.name);
155
155
  }
156
156
  else if(g.has(device.nodeDefId))
157
157
  {