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.
Files changed (104) hide show
  1. package/dist/cjs/Converters.js +28 -20
  2. package/dist/cjs/Converters.js.map +1 -1
  3. package/dist/cjs/Definitions/Global/Commands.js.map +1 -1
  4. package/dist/cjs/Definitions/Global/Drivers.js +19 -7
  5. package/dist/cjs/Definitions/Global/Drivers.js.map +1 -1
  6. package/dist/cjs/Devices/Insteon/DimmerLampSwitch.js +23 -23
  7. package/dist/cjs/Devices/Insteon/DimmerLampSwitch.js.map +1 -1
  8. package/dist/cjs/Devices/Insteon/RelayLampSwitch.js +6 -6
  9. package/dist/cjs/Devices/Insteon/RelayLampSwitch.js.map +1 -1
  10. package/dist/cjs/ISY.js +11 -5
  11. package/dist/cjs/ISY.js.map +1 -1
  12. package/dist/cjs/ISYScene.js +1 -1
  13. package/dist/cjs/ISYScene.js.map +1 -1
  14. package/dist/cjs/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
  15. package/dist/cjs/Matter/Behaviors/ISYClusterBehavior.js +11 -7
  16. package/dist/cjs/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
  17. package/dist/cjs/Matter/Behaviors/ISYOnOffBehavior.js +1 -3
  18. package/dist/cjs/Matter/Behaviors/ISYOnOffBehavior.js.map +1 -1
  19. package/dist/cjs/Matter/Behaviors/Insteon/ISYOnOffBehavior.js +47 -0
  20. package/dist/cjs/Matter/Behaviors/Insteon/ISYOnOffBehavior.js.map +1 -0
  21. package/dist/cjs/Matter/Bridge/Server.js +1 -1
  22. package/dist/cjs/Matter/Bridge/Server.js.map +1 -1
  23. package/dist/cjs/Matter/Mappings/Insteon.js +3 -4
  24. package/dist/cjs/Matter/Mappings/Insteon.js.map +1 -1
  25. package/dist/cjs/Model/NodeInfo.js.map +1 -1
  26. package/dist/cjs/types/Converters.d.ts +16 -3
  27. package/dist/cjs/types/Converters.d.ts.map +1 -1
  28. package/dist/cjs/types/Definitions/Global/Commands.d.ts +1 -1
  29. package/dist/cjs/types/Definitions/Global/Commands.d.ts.map +1 -1
  30. package/dist/cjs/types/Definitions/Global/Drivers.d.ts.map +1 -1
  31. package/dist/cjs/types/Devices/Insteon/DimmerLampSwitch.d.ts +44 -44
  32. package/dist/cjs/types/Devices/Insteon/DimmerLampSwitch.d.ts.map +1 -1
  33. package/dist/cjs/types/Devices/Insteon/RelayLampSwitch.d.ts +32 -32
  34. package/dist/cjs/types/Devices/Insteon/RelayLampSwitch.d.ts.map +1 -1
  35. package/dist/cjs/types/ISY.d.ts.map +1 -1
  36. package/dist/cjs/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
  37. package/dist/cjs/types/Matter/Behaviors/ISYClusterBehavior.d.ts +1 -1
  38. package/dist/cjs/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
  39. package/dist/cjs/types/Matter/Behaviors/ISYOnOffBehavior.d.ts.map +1 -1
  40. package/dist/cjs/types/Matter/Behaviors/Insteon/ISYOnOffBehavior.d.ts +54 -0
  41. package/dist/cjs/types/Matter/Behaviors/Insteon/ISYOnOffBehavior.d.ts.map +1 -0
  42. package/dist/cjs/types/Model/EnumDefinition.d.ts +1 -1
  43. package/dist/cjs/types/Model/NodeInfo.d.ts +5 -1
  44. package/dist/cjs/types/Model/NodeInfo.d.ts.map +1 -1
  45. package/dist/esm/Converters.js +28 -20
  46. package/dist/esm/Converters.js.map +1 -1
  47. package/dist/esm/Definitions/Global/Commands.js.map +1 -1
  48. package/dist/esm/Definitions/Global/Drivers.js +19 -7
  49. package/dist/esm/Definitions/Global/Drivers.js.map +1 -1
  50. package/dist/esm/Devices/Insteon/DimmerLampSwitch.js +23 -23
  51. package/dist/esm/Devices/Insteon/DimmerLampSwitch.js.map +1 -1
  52. package/dist/esm/Devices/Insteon/RelayLampSwitch.js +8 -8
  53. package/dist/esm/Devices/Insteon/RelayLampSwitch.js.map +1 -1
  54. package/dist/esm/ISY.js +11 -5
  55. package/dist/esm/ISY.js.map +1 -1
  56. package/dist/esm/ISYScene.js +1 -1
  57. package/dist/esm/ISYScene.js.map +1 -1
  58. package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
  59. package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js +11 -7
  60. package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
  61. package/dist/esm/Matter/Behaviors/ISYOnOffBehavior.js +1 -3
  62. package/dist/esm/Matter/Behaviors/ISYOnOffBehavior.js.map +1 -1
  63. package/dist/esm/Matter/Behaviors/Insteon/ISYOnOffBehavior.js +42 -0
  64. package/dist/esm/Matter/Behaviors/Insteon/ISYOnOffBehavior.js.map +1 -0
  65. package/dist/esm/Matter/Bridge/Server.js +1 -1
  66. package/dist/esm/Matter/Bridge/Server.js.map +1 -1
  67. package/dist/esm/Matter/Mappings/Insteon.js +3 -4
  68. package/dist/esm/Matter/Mappings/Insteon.js.map +1 -1
  69. package/dist/esm/Model/NodeInfo.js.map +1 -1
  70. package/dist/esm/types/Converters.d.ts +16 -3
  71. package/dist/esm/types/Converters.d.ts.map +1 -1
  72. package/dist/esm/types/Definitions/Global/Commands.d.ts +1 -1
  73. package/dist/esm/types/Definitions/Global/Commands.d.ts.map +1 -1
  74. package/dist/esm/types/Definitions/Global/Drivers.d.ts.map +1 -1
  75. package/dist/esm/types/Devices/Insteon/DimmerLampSwitch.d.ts +44 -44
  76. package/dist/esm/types/Devices/Insteon/DimmerLampSwitch.d.ts.map +1 -1
  77. package/dist/esm/types/Devices/Insteon/RelayLampSwitch.d.ts +32 -32
  78. package/dist/esm/types/Devices/Insteon/RelayLampSwitch.d.ts.map +1 -1
  79. package/dist/esm/types/ISY.d.ts.map +1 -1
  80. package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
  81. package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts +1 -1
  82. package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
  83. package/dist/esm/types/Matter/Behaviors/ISYOnOffBehavior.d.ts.map +1 -1
  84. package/dist/esm/types/Matter/Behaviors/Insteon/ISYOnOffBehavior.d.ts +54 -0
  85. package/dist/esm/types/Matter/Behaviors/Insteon/ISYOnOffBehavior.d.ts.map +1 -0
  86. package/dist/esm/types/Model/NodeInfo.d.ts +5 -1
  87. package/dist/esm/types/Model/NodeInfo.d.ts.map +1 -1
  88. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  89. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  90. package/package.json +2 -2
  91. package/src/Converters.ts +31 -27
  92. package/src/Definitions/Global/Commands.ts +13 -1
  93. package/src/Definitions/Global/Drivers.ts +17 -8
  94. package/src/Devices/Insteon/DimmerLampSwitch.ts +69 -71
  95. package/src/Devices/Insteon/Generated/DimmerLampSwitch.ts +8 -7
  96. package/src/Devices/Insteon/RelayLampSwitch.ts +40 -40
  97. package/src/ISY.ts +14 -10
  98. package/src/ISYScene.ts +1 -1
  99. package/src/Matter/Behaviors/ISYBridgedDeviceBehavior.ts +9 -1
  100. package/src/Matter/Behaviors/ISYClusterBehavior.ts +16 -7
  101. package/src/Matter/Behaviors/{ISYOnOffBehavior.ts → Insteon/ISYOnOffBehavior.ts} +9 -16
  102. package/src/Matter/Bridge/Server.ts +1 -1
  103. package/src/Matter/Mappings/Insteon.ts +3 -3
  104. package/src/Model/NodeInfo.ts +2 -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.1-alpha.25",
5
+ "version": "1.0.1-alpha.27",
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": "99f03336e2db40ef91e58b059969abba6534c74a"
72
+ "gitHead": "6818f4140be310656690e21c6a451f42cae1ef8f"
73
73
  }
package/src/Converters.ts CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  import { UnitOfMeasure } from './Definitions/Global/UOM.js';
3
2
  import { type StringKeys } from './Utils.js';
4
3
 
@@ -9,26 +8,21 @@ let NullConverter: Converter<any, any>;
9
8
  from: (value: any) => value;
10
9
  }
11
10
 
12
- BooleanPercentage = {
13
- to: (value: number): boolean => {
14
- return value > 0;
15
- },
16
- from: (value: boolean): number => {
17
- return value ? 100 : 0;
18
- }
19
- };
20
-
21
- const StandardConverters: {
22
- [x in `${keyof typeof UnitOfMeasure}`]?: { [y in `${keyof typeof UnitOfMeasure}`]?: Converter<any, any> };
23
- } = {
11
+ const StandardConverters = {
24
12
  Boolean: {
25
13
  LevelFrom0To255: {
26
14
  to: (value: boolean) => (value ? 255 : 0),
27
15
  from: (value: number) => value > 0
28
16
  },
29
- Percent: BooleanPercentage
17
+ Percent: {
18
+ to: (value: number): boolean => {
19
+ return value > 0;
20
+ },
21
+ from: (value: boolean): number => {
22
+ return value ? 100 : 0;
23
+ }
24
+ }
30
25
  },
31
- Percent: {},
32
26
  LevelFrom0To255: {
33
27
  Percent: {
34
28
  to: (value: number): number => {
@@ -41,8 +35,8 @@ const StandardConverters: {
41
35
  }
42
36
  };
43
37
 
44
- StandardConverters.Percent.LevelFrom0To255 = invert(StandardConverters.LevelFrom0To255.Percent);
45
- StandardConverters.LevelFrom0To255.Boolean = invert(StandardConverters.Boolean.LevelFrom0To255);
38
+ //StandardConverters.Percent.LevelFrom0To255 = invert(StandardConverters.LevelFrom0To255.Percent);
39
+ //StandardConverters.LevelFrom0To255.Boolean = invert(StandardConverters.Boolean.LevelFrom0To255);
46
40
 
47
41
  export const StdConverterRegistry = new Map<UnitOfMeasure | string, Map<UnitOfMeasure | string, Converter<any, any>>>();
48
42
 
@@ -51,8 +45,8 @@ export const ConverterRegistry = new Map<string, Converter<any, any>>();
51
45
  function registerConverters() {
52
46
  for (const from in StandardConverters) {
53
47
  for (const to in StandardConverters[from]) {
54
- registerConverter(UnitOfMeasure[from], UnitOfMeasure[to], StandardConverters[from][to] as Converter<any, any>);
55
- registerConverter(UnitOfMeasure[to], UnitOfMeasure[from], invert(StandardConverters[from][to]) as Converter<any, any>);
48
+ registerConverter(from, to, StandardConverters[from][to] as Converter<any, any>);
49
+ registerConverter(to, from, invert(StandardConverters[from][to]) as Converter<any, any>);
56
50
  }
57
51
  }
58
52
  for (const from in Converter.Matter) {
@@ -64,8 +58,8 @@ function registerConverters() {
64
58
  }
65
59
 
66
60
  export function registerConverter(
67
- from: keyof typeof StandardConverters | UnitOfMeasure | keyof typeof Converter.Matter | string,
68
- to: keyof typeof StandardConverters | UnitOfMeasure | keyof typeof Converter.Matter | string,
61
+ from: keyof typeof StandardConverters | keyof typeof Converter.Matter | string,
62
+ to: keyof typeof StandardConverters | keyof typeof Converter.Matter | string,
69
63
  converter: Converter<any, any>
70
64
  ) {
71
65
  if (!StdConverterRegistry.has(from)) {
@@ -94,6 +88,7 @@ export namespace Converter {
94
88
  : value === 255 ? 254
95
89
  : value
96
90
  }
91
+
97
92
  }
98
93
  };
99
94
 
@@ -108,7 +103,7 @@ export namespace Converter {
108
103
  export type MatterConverters = `${MatterISYConvertibleTypes}.${ISYMatterConvertibleTypes}` | `${ISYMatterConvertibleTypes}.${MatterISYConvertibleTypes}`;
109
104
 
110
105
  export type KnownConverters = StandardConverters | MatterConverters;
111
-
106
+ const cache: { [x: string]: Converter<any, any> } = {};
112
107
  export function get(label: KnownConverters): Converter<any, any>;
113
108
  export function get(from: UnitOfMeasure, to: UnitOfMeasure);
114
109
  export function get(from: ConverterTypes, to: ConverterTypes);
@@ -116,16 +111,25 @@ export namespace Converter {
116
111
  export function get(from: MatterISYConvertibleTypes, to: ISYMatterConvertibleTypes);
117
112
  export function get(to: ISYMatterConvertibleTypes, from: MatterISYConvertibleTypes);
118
113
  export function get(from: UnitOfMeasure | `${keyof typeof UnitOfMeasure}` | string, to?: UnitOfMeasure | `${keyof typeof UnitOfMeasure}` | string): Converter<any, any> {
114
+ if (to === undefined) {
115
+ return ConverterRegistry.get(from as string) ?? NullConverter;
116
+ }
117
+ if (cache[`${from}.${to}`]) {
118
+ return cache[`${from}.${to}`];
119
+ } else if (cache[`${to}.${from}`]) {
120
+ cache[`${from}.${to}`] = invert(cache[`${to}.${from}`]);
121
+ return cache[`${from}.${to}`];
122
+ }
119
123
  let isString = typeof from === 'string';
120
- let fuom = isString ? UnitOfMeasure[from] : from;
124
+ let fuom = isString ? from : UnitOfMeasure[from];
121
125
  if (to) {
122
- let tuom = typeof to === 'string' ? UnitOfMeasure[to] : to;
126
+ let tuom = typeof to === 'string' ? to : UnitOfMeasure[to];
123
127
 
124
128
  if (StdConverterRegistry.has(fuom)) {
125
- return StdConverterRegistry.get(fuom).get(tuom);
129
+ if (StdConverterRegistry.get(fuom).has(tuom)) {
130
+ return StdConverterRegistry.get(fuom).get(tuom);
131
+ }
126
132
  }
127
- } else if (typeof from === 'string') {
128
- return ConverterRegistry.get(from);
129
133
  }
130
134
  return NullConverter;
131
135
  }
@@ -1,10 +1,22 @@
1
1
  import { TimeFormatLocalization } from '@project-chip/matter.js/cluster';
2
2
  import type { Identity, Merge, UnionToIntersection } from '@project-chip/matter.js/util';
3
3
  import type { Sign } from 'crypto';
4
+ import type { UnitOfMeasure } from './UOM.js';
5
+
6
+ /*export class Command<T extends string> extends Function {
7
+
8
+ constructor(public readonly label: string) {
9
+ super();
10
+ }
11
+
12
+ public async execute(...args: any[]): Promise<Boolean> {
13
+ return this(...args);
14
+ }
15
+ }*/
4
16
 
5
17
  export namespace Command {
6
18
 
7
- export type Signature<F extends {name: string} = CallableFunction, L extends string = string,N extends string = string> = F & {label: L, name: N };
19
+ export type Signature<F extends {name} = CallableFunction, L extends string = string,N extends string = string> = F & {label: L, name: N,} ;
8
20
 
9
21
  export type Signatures<C extends string> = {[K in C]: Signature<(...args: any[]) => Promise<Boolean>, string, string>};
10
22
 
@@ -427,6 +427,7 @@ export namespace Driver {
427
427
  converter ? converter.from(initState.value)
428
428
  : (node.convertFrom(initState?.value, initState?.uom, driver as D) as T)
429
429
  : null,
430
+ rawValue: initState ? initState.value : null,
430
431
  formattedValue: initState ? initState.formatted : null,
431
432
  pendingValue: null
432
433
  },
@@ -437,22 +438,30 @@ export namespace Driver {
437
438
  return s;
438
439
  },
439
440
  apply(state: DriverState, notify = false) {
440
- let previousValue = this.state.value;
441
- this.state.value = converter ? converter.from(state.value) : node.convertFrom(state.value, state.uom, driver as D);
442
- this.state.formattedValue = state.formatted;
443
- if (previousValue == this.state.value) {
441
+ let previousValue = this.state.rawValue;
442
+ this.state.rawValue = state.value;
443
+ if (previousValue === this.state.rawValue) {
444
444
  return false;
445
445
  }
446
+ if (state.uom != this.uom) {
447
+ this.serverUom == state.uom;
448
+ this.state.value = converter ? converter.from(this.state.rawValue) : Converter.convert(state.uom, this.uom, this.state.rawValue);
449
+ } else if (converter) {
450
+ this.state.value = converter.from(state.value);
451
+ } else {
452
+ this.state.value = state.value;
453
+ }
454
+ this.state.formattedValue = state.formatted;
446
455
  if (notify) node.events.emit(`${this.name}Changed`, driver as D, this.state.value, previousValue, this.state.formattedValue);
447
456
  return true;
448
457
  },
449
458
  patch(value: T, formattedValue: string, uom: UnitOfMeasure, prec: number, notify = true) {
450
- let previousValue = this.state.value;
451
-
459
+ let previousValue = this.state.rawValue;
460
+ this.state.rawValue = value;
452
461
  this.state.formattedValue = formattedValue;
453
462
  if (uom != this.uom) {
454
463
  this.serverUom == uom;
455
- this.state.value = converter ? converter.from(value) : Converter.convert(uom, this.uom, value);
464
+ this.state.value = converter ? converter.from(this.state.rawValue) : Converter.convert(uom, this.uom, this.state.rawValue);
456
465
 
457
466
  }
458
467
  else if(converter)
@@ -466,7 +475,7 @@ export namespace Driver {
466
475
  if (previousValue == this.state.value) {
467
476
  return false;
468
477
  }
469
- if (notify) node.events.emit(`${this.name}Changed`, driver as D, value, previousValue, formattedValue);
478
+ if (notify) node.events.emit(`${this.name}Changed`, driver as D, this.state.value, previousValue, formattedValue);
470
479
  return true;
471
480
  },
472
481
  get value() {
@@ -1,19 +1,18 @@
1
1
  /* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT DIRECTLY. */
2
2
 
3
- import { UnitOfMeasure } from '../../Definitions/Global/UOM.js';
3
+ import { Driver } from '../../Definitions/Global/Drivers.js';
4
4
  import { Family } from '../../Definitions/Global/Families.js';
5
- import type { NodeInfo } from '../../Model/NodeInfo.js';
5
+ import { UnitOfMeasure } from '../../Definitions/Global/UOM.js';
6
+ import { Insteon } from '../../Definitions/index.js';
6
7
  import type { ISY } from '../../ISY.js';
7
8
  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
9
  import type { DriverState } from '../../Model/DriverState.js';
10
+ import type { NodeInfo } from '../../Model/NodeInfo.js';
11
+ import { ISYDeviceNode } from '../ISYDeviceNode.js';
13
12
  import { NodeFactory } from '../NodeFactory.js';
13
+ import { InsteonBaseDevice as Base } from './InsteonBaseDevice.js';
14
14
 
15
-
16
- export const nodeDefId = "DimmerLampSwitch";
15
+ export const nodeDefId = 'DimmerLampSwitch';
17
16
 
18
17
  type Commands = DimmerLampSwitch.Commands;
19
18
  type Drivers = DimmerLampSwitch.Drivers;
@@ -36,60 +35,59 @@ export class DimmerLampSwitchNode extends Base<Drivers, Commands> implements Dim
36
35
  BL: this.backlight,
37
36
  WDU: this.writeChanges
38
37
  };
39
- static override nodeDefId = "DimmerLampSwitch";
40
- declare readonly nodeDefId: "DimmerLampSwitch";
41
- constructor (isy: ISY, nodeInfo: NodeInfo) {
38
+ static override nodeDefId = 'DimmerLampSwitch';
39
+ declare readonly nodeDefId: 'DimmerLampSwitch';
40
+ constructor(isy: ISY, nodeInfo: NodeInfo) {
42
41
  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
-
42
+ this.drivers.ST = Driver.create('ST', this, nodeInfo.state['ST'], { uom: UnitOfMeasure.LevelFrom0To255, label: 'Status', name: 'status' });
43
+ this.drivers.OL = Driver.create('OL', this, nodeInfo.state['OL'] as DriverState, { uom: UnitOfMeasure.Percent, label: 'On Level', name: 'onLevel' });
44
+ this.drivers.RR = Driver.create('RR', this, nodeInfo.state['RR'] as DriverState, { uom: UnitOfMeasure.Index, label: 'Ramp Rate', name: 'rampRate' });
45
+ this.drivers.ERR = Driver.create('ERR', this, nodeInfo.state['ERR'] as DriverState, { uom: UnitOfMeasure.Index, label: 'Responding', name: 'responding' });
48
46
  }
49
47
  async on(value?: number) {
50
- return this.sendCommand("DON", { value: value });
48
+ return this.sendCommand('DON', value);
51
49
  }
52
50
  async off() {
53
- return this.sendCommand("DOF");
51
+ return this.sendCommand('DOF');
54
52
  }
55
53
  async fastOff() {
56
- return this.sendCommand("DFOF");
54
+ return this.sendCommand('DFOF');
57
55
  }
58
56
  async fastOn() {
59
- return this.sendCommand("DFON");
57
+ return this.sendCommand('DFON');
60
58
  }
61
59
  async brighten() {
62
- return this.sendCommand("BRT");
60
+ return this.sendCommand('BRT');
63
61
  }
64
62
  async dim() {
65
- return this.sendCommand("DIM");
63
+ return this.sendCommand('DIM');
66
64
  }
67
65
  async fadeUp() {
68
- return this.sendCommand("FDUP");
66
+ return this.sendCommand('FDUP');
69
67
  }
70
68
  async fadeDown() {
71
- return this.sendCommand("FDDOWN");
69
+ return this.sendCommand('FDDOWN');
72
70
  }
73
71
  async fadeStop() {
74
- return this.sendCommand("FDSTOP");
72
+ return this.sendCommand('FDSTOP');
75
73
  }
76
74
  async query() {
77
- return this.sendCommand("QUERY");
75
+ return this.sendCommand('QUERY');
78
76
  }
79
77
  async beep(value?: number) {
80
- return this.sendCommand("BEEP", { value: value });
78
+ return this.sendCommand('BEEP', { value: value });
81
79
  }
82
80
  async updateOnLevel(value: number) {
83
- return this.sendCommand("OL", { value: value });
81
+ return this.sendCommand('OL', { value: value });
84
82
  }
85
83
  async updateRampRate(value: number) {
86
- return this.sendCommand("RR", { value: value });
84
+ return this.sendCommand('RR', { value: value });
87
85
  }
88
86
  async backlight(value: number) {
89
- return this.sendCommand("BL", { value: value });
87
+ return this.sendCommand('BL', { value: value });
90
88
  }
91
89
  async writeChanges() {
92
- return this.sendCommand("WDU");
90
+ return this.sendCommand('WDU');
93
91
  }
94
92
  public get status(): number {
95
93
  return this.drivers.ST?.value;
@@ -109,7 +107,7 @@ NodeFactory.register(DimmerLampSwitchNode);
109
107
 
110
108
  export namespace DimmerLampSwitch {
111
109
  export interface Interface extends Omit<InstanceType<typeof DimmerLampSwitchNode>, keyof ISYDeviceNode<any, any, any, any>> {
112
- nodeDefId: "DimmerLampSwitch";
110
+ nodeDefId: 'DimmerLampSwitch';
113
111
  }
114
112
  export function is(node: ISYNode<any, any, any, any>): node is DimmerLampSwitchNode {
115
113
  return node.nodeDefId === nodeDefId;
@@ -120,90 +118,90 @@ export namespace DimmerLampSwitch {
120
118
  export const Node = DimmerLampSwitchNode;
121
119
  export type Commands = {
122
120
  DON: ((value?: number) => Promise<boolean>) & {
123
- label: "On";
124
- name: "on";
121
+ label: 'On';
122
+ name: 'on';
125
123
  };
126
124
  DOF: (() => Promise<boolean>) & {
127
- label: "Off";
128
- name: "off";
125
+ label: 'Off';
126
+ name: 'off';
129
127
  };
130
128
  DFOF: (() => Promise<boolean>) & {
131
- label: "Fast Off";
132
- name: "fastOff";
129
+ label: 'Fast Off';
130
+ name: 'fastOff';
133
131
  };
134
132
  DFON: (() => Promise<boolean>) & {
135
- label: "Fast On";
136
- name: "fastOn";
133
+ label: 'Fast On';
134
+ name: 'fastOn';
137
135
  };
138
136
  BRT: (() => Promise<boolean>) & {
139
- label: "Brighten";
140
- name: "brighten";
137
+ label: 'Brighten';
138
+ name: 'brighten';
141
139
  };
142
140
  DIM: (() => Promise<boolean>) & {
143
- label: "Dim";
144
- name: "dim";
141
+ label: 'Dim';
142
+ name: 'dim';
145
143
  };
146
144
  FDUP: (() => Promise<boolean>) & {
147
- label: "Fade Up";
148
- name: "fadeUp";
145
+ label: 'Fade Up';
146
+ name: 'fadeUp';
149
147
  };
150
148
  FDDOWN: (() => Promise<boolean>) & {
151
- label: "Fade Down";
152
- name: "fadeDown";
149
+ label: 'Fade Down';
150
+ name: 'fadeDown';
153
151
  };
154
152
  FDSTOP: (() => Promise<boolean>) & {
155
- label: "Fade Stop";
156
- name: "fadeStop";
153
+ label: 'Fade Stop';
154
+ name: 'fadeStop';
157
155
  };
158
156
  QUERY: (() => Promise<boolean>) & {
159
- label: "Query";
160
- name: "query";
157
+ label: 'Query';
158
+ name: 'query';
161
159
  };
162
160
  BEEP: ((value?: number) => Promise<boolean>) & {
163
- label: "Beep";
164
- name: "beep";
161
+ label: 'Beep';
162
+ name: 'beep';
165
163
  };
166
164
  OL: ((value: number) => Promise<boolean>) & {
167
- label: "On Level";
168
- name: "updateOnLevel";
165
+ label: 'On Level';
166
+ name: 'updateOnLevel';
169
167
  };
170
168
  RR: ((value: number) => Promise<boolean>) & {
171
- label: "Ramp Rate";
172
- name: "updateRampRate";
169
+ label: 'Ramp Rate';
170
+ name: 'updateRampRate';
173
171
  };
174
172
  BL: ((value: number) => Promise<boolean>) & {
175
- label: "Backlight";
176
- name: "backlight";
173
+ label: 'Backlight';
174
+ name: 'backlight';
177
175
  };
178
176
  WDU: (() => Promise<boolean>) & {
179
- label: "Write Changes";
180
- name: "writeChanges";
177
+ label: 'Write Changes';
178
+ name: 'writeChanges';
181
179
  };
182
180
  };
183
181
  export type Drivers = {
184
182
  ST: {
185
- uom: UnitOfMeasure.Percent;
183
+ uom: UnitOfMeasure.LevelFrom0To255;
186
184
  value: number;
187
- label: "Status";
188
- name: "status";
185
+ label: 'Status';
186
+ name: 'status';
189
187
  };
190
188
  OL: {
191
189
  uom: UnitOfMeasure.Percent;
192
190
  value: number;
193
- label: "On Level";
194
- name: "onLevel";
191
+ label: 'On Level';
192
+ name: 'onLevel';
195
193
  };
196
194
  RR: {
197
195
  uom: UnitOfMeasure.Index;
198
196
  value: number;
199
- label: "Ramp Rate";
200
- name: "rampRate";
197
+ label: 'Ramp Rate';
198
+ name: 'rampRate';
201
199
  };
202
200
  ERR: {
203
201
  uom: UnitOfMeasure.Index;
204
202
  value: Insteon.Error;
205
- label: "Responding";
206
- name: "responding";
203
+ label: 'Responding';
204
+ name: 'responding';
207
205
  };
208
206
  };
209
207
  }
@@ -1,5 +1,5 @@
1
- /* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT DIRECTLY. */
2
-
1
+ /* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT DIRECTLY. */
2
+
3
3
  import { UnitOfMeasure } from "../../../Definitions/Global/UOM.js";
4
4
  import { Family } from "../../../Definitions/Global/Families.js";
5
5
  import type { NodeInfo } from "../../../Model/NodeInfo.js";
@@ -11,12 +11,13 @@ import { Driver } from "../../../Definitions/Global/Drivers.js";
11
11
  import { Insteon } from "../../../Definitions/index.js";
12
12
  import type { DriverState } from "../../../Model/DriverState.js";
13
13
  import { NodeFactory } from "../../NodeFactory.js";
14
-
14
+ import { validateHeaderName } from 'http';
15
+
15
16
  export const nodeDefId = "DimmerLampSwitch";
16
-
17
+
17
18
  type Commands = DimmerLampSwitch.Commands;
18
19
  type Drivers = DimmerLampSwitch.Drivers;
19
-
20
+
20
21
  export class DimmerLampSwitchNode extends Base<Drivers, Commands> implements DimmerLampSwitch.Interface {
21
22
  public readonly commands = {
22
23
  DON: this.on,
@@ -102,9 +103,9 @@ export class DimmerLampSwitchNode extends Base<Drivers, Commands> implements Dim
102
103
  return this.drivers.ERR?.value;
103
104
  }
104
105
  }
105
-
106
+
106
107
  NodeFactory.register(DimmerLampSwitchNode);
107
-
108
+
108
109
  export namespace DimmerLampSwitch {
109
110
  export interface Interface extends Omit<InstanceType<typeof DimmerLampSwitchNode>, keyof ISYDeviceNode<any, any, any, any>> {
110
111
  nodeDefId: "DimmerLampSwitch";
@@ -1,18 +1,18 @@
1
1
  /* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT DIRECTLY. */
2
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 } 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";
3
+ import { Driver } from '../../Definitions/Global/Drivers.js';
4
+ import { Family } from '../../Definitions/Global/Families.js';
5
+ import { UnitOfMeasure } from '../../Definitions/Global/UOM.js';
6
+ import { Insteon } from '../../Definitions/index.js';
7
+ import type { ISY } from '../../ISY.js';
8
+ import type { ISYNode } from '../../ISYNode.js';
9
+ import type { DriverState } from '../../Model/DriverState.js';
10
+ import type { NodeInfo } from '../../Model/NodeInfo.js';
11
+ import { ISYDeviceNode } from '../ISYDeviceNode.js';
12
+ import { NodeFactory } from '../NodeFactory.js';
13
+ import { InsteonBaseDevice } from './InsteonBaseDevice.js';
14
14
 
15
- export const nodeDefId = "RelayLampSwitch";
15
+ export const nodeDefId = 'RelayLampSwitch';
16
16
 
17
17
  type Commands = RelayLampSwitch.Commands;
18
18
  type Drivers = RelayLampSwitch.Drivers;
@@ -32,11 +32,11 @@ export class RelayLampSwitchNode extends InsteonBaseDevice<Drivers, Commands> im
32
32
  declare readonly nodeDefId: 'RelayLampSwitch';
33
33
  constructor(isy: ISY, nodeInfo: NodeInfo) {
34
34
  super(isy, nodeInfo);
35
- this.drivers.ST = Driver.create('ST', this, nodeInfo.property as DriverState, { uom: UnitOfMeasure.Percent, label: 'Status', name: 'status' });
36
- this.drivers.ERR = Driver.create('ERR', this, nodeInfo.property as DriverState, { uom: UnitOfMeasure.Index, label: 'Responding', name: 'responding' });
35
+ this.drivers.ST = Driver.create('ST', this, nodeInfo.state['ST'], { uom: UnitOfMeasure.Boolean, label: 'Status', name: 'status' });
36
+ this.drivers.ERR = Driver.create('ERR', this, nodeInfo.state['ERR'], { uom: UnitOfMeasure.Index, label: 'Responding', name: 'responding' });
37
37
  }
38
38
  async on(value?: 0 | 100) {
39
- return this.sendCommand('DON', { value: value });
39
+ return this.sendCommand('DON', value);
40
40
  }
41
41
  async off() {
42
42
  return this.sendCommand('DOF');
@@ -59,7 +59,7 @@ export class RelayLampSwitchNode extends InsteonBaseDevice<Drivers, Commands> im
59
59
  async writeChanges() {
60
60
  return this.sendCommand('WDU');
61
61
  }
62
- public get status(): Insteon.OnLevelRelay {
62
+ public get status(): boolean {
63
63
  return this.drivers.ST?.value;
64
64
  }
65
65
  public get responding(): Insteon.Error {
@@ -71,7 +71,7 @@ NodeFactory.register(RelayLampSwitchNode);
71
71
 
72
72
  export namespace RelayLampSwitch {
73
73
  export interface Interface extends Omit<InstanceType<typeof RelayLampSwitchNode>, keyof ISYDeviceNode<any, any, any, any>> {
74
- nodeDefId: "RelayLampSwitch";
74
+ nodeDefId: 'RelayLampSwitch';
75
75
  }
76
76
  export function is(node: ISYNode<any, any, any, any>): node is RelayLampSwitchNode {
77
77
  return node.nodeDefId === nodeDefId;
@@ -81,51 +81,51 @@ export namespace RelayLampSwitch {
81
81
  }
82
82
  export const Node = RelayLampSwitchNode;
83
83
  export type Commands = {
84
- DON: ((value?: (0 | 100)) => Promise<boolean>) & {
85
- label: "On";
86
- name: "on";
84
+ DON: ((value?: 0 | 100) => Promise<boolean>) & {
85
+ label: 'On';
86
+ name: 'on';
87
87
  };
88
88
  DOF: (() => Promise<boolean>) & {
89
- label: "Off";
90
- name: "off";
89
+ label: 'Off';
90
+ name: 'off';
91
91
  };
92
92
  DFOF: (() => Promise<boolean>) & {
93
- label: "Fast Off";
94
- name: "fastOff";
93
+ label: 'Fast Off';
94
+ name: 'fastOff';
95
95
  };
96
96
  DFON: (() => Promise<boolean>) & {
97
- label: "Fast On";
98
- name: "fastOn";
97
+ label: 'Fast On';
98
+ name: 'fastOn';
99
99
  };
100
100
  QUERY: (() => Promise<boolean>) & {
101
- label: "Query";
102
- name: "query";
101
+ label: 'Query';
102
+ name: 'query';
103
103
  };
104
104
  BEEP: ((value?: number) => Promise<boolean>) & {
105
- label: "Beep";
106
- name: "beep";
105
+ label: 'Beep';
106
+ name: 'beep';
107
107
  };
108
108
  BL: ((value: number) => Promise<boolean>) & {
109
- label: "Backlight";
110
- name: "backlight";
109
+ label: 'Backlight';
110
+ name: 'backlight';
111
111
  };
112
112
  WDU: (() => Promise<boolean>) & {
113
- label: "Write Changes";
114
- name: "writeChanges";
113
+ label: 'Write Changes';
114
+ name: 'writeChanges';
115
115
  };
116
116
  };
117
117
  export type Drivers = {
118
118
  ST: {
119
- uom: UnitOfMeasure.Percent;
120
- value: Insteon.OnLevelRelay;
121
- label: "Status";
122
- name: "status";
119
+ uom: UnitOfMeasure.Boolean;
120
+ value: boolean;
121
+ label: 'Status';
122
+ name: 'status';
123
123
  };
124
124
  ERR: {
125
125
  uom: UnitOfMeasure.Index;
126
126
  value: Insteon.Error;
127
- label: "Responding";
128
- name: "responding";
127
+ label: 'Responding';
128
+ name: 'responding';
129
129
  };
130
130
  };
131
131
  }