isy-nodejs 1.0.1-alpha.27 → 1.0.1-alpha.28
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/CodeGeneration/EnumFactory.js +6 -6
- package/dist/cjs/CodeGeneration/EnumFactory.js.map +1 -1
- package/dist/cjs/CodeGeneration/NodeClassFactory.js +7 -7
- package/dist/cjs/CodeGeneration/NodeClassFactory.js.map +1 -1
- package/dist/cjs/Devices/ISYDeviceNode.js.map +1 -1
- package/dist/cjs/Devices/Insteon/InsteonDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/InsteonDeviceFactory.js +12 -8
- package/dist/cjs/Devices/Insteon/InsteonDeviceFactory.js.map +1 -1
- package/dist/cjs/Devices/Insteon/InsteonKeypadDevice.js +2 -2
- package/dist/cjs/Devices/Insteon/InsteonKeypadDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/KeypadButton.js +52 -0
- package/dist/cjs/Devices/Insteon/KeypadButton.js.map +1 -0
- package/dist/cjs/Devices/NodeFactory.js +5 -4
- package/dist/cjs/Devices/NodeFactory.js.map +1 -1
- package/dist/cjs/Devices/index.js.map +1 -1
- package/dist/cjs/ISY.js +220 -213
- package/dist/cjs/ISY.js.map +1 -1
- package/dist/cjs/ISYNode.js +3 -3
- package/dist/cjs/ISYNode.js.map +1 -1
- package/dist/cjs/ISYScene.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
- package/dist/cjs/Matter/Bridge/Server.js +4 -4
- package/dist/cjs/Matter/Bridge/Server.js.map +1 -1
- package/dist/cjs/Model/ClusterMap.js +2 -2
- package/dist/cjs/Model/ClusterMap.js.map +1 -1
- package/dist/cjs/Model/NodeInfo.js +3 -3
- package/dist/cjs/Model/NodeInfo.js.map +1 -1
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/types/CodeGeneration/EnumFactory.d.ts +1 -1
- package/dist/cjs/types/CodeGeneration/EnumFactory.d.ts.map +1 -1
- package/dist/cjs/types/CodeGeneration/NodeClassFactory.d.ts +1 -1
- package/dist/cjs/types/CodeGeneration/NodeClassFactory.d.ts.map +1 -1
- package/dist/cjs/types/Devices/EndpointFor.d.ts +1 -1
- package/dist/cjs/types/Devices/ISYDeviceNode.d.ts +2 -1
- package/dist/cjs/types/Devices/ISYDeviceNode.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/InsteonDevice.d.ts +8 -7
- package/dist/cjs/types/Devices/Insteon/InsteonDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/InsteonDeviceFactory.d.ts +2 -1
- package/dist/cjs/types/Devices/Insteon/InsteonDeviceFactory.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/InsteonFanDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/InsteonKeypadDevice.d.ts +4 -4
- package/dist/cjs/types/Devices/Insteon/InsteonKeypadDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/InsteonRelayDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/KeypadButton.d.ts +63 -0
- package/dist/cjs/types/Devices/Insteon/KeypadButton.d.ts.map +1 -0
- package/dist/cjs/types/Devices/NodeFactory.d.ts +2 -1
- package/dist/cjs/types/Devices/NodeFactory.d.ts.map +1 -1
- package/dist/cjs/types/Devices/index.d.ts +1 -1
- package/dist/cjs/types/Devices/index.d.ts.map +1 -1
- package/dist/cjs/types/ISY.d.ts +13 -28
- package/dist/cjs/types/ISY.d.ts.map +1 -1
- package/dist/cjs/types/ISYDevice.d.ts +1 -1
- package/dist/cjs/types/ISYDevice.d.ts.map +1 -1
- package/dist/cjs/types/ISYNode.d.ts +4 -2
- package/dist/cjs/types/ISYNode.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Bridge/Server.d.ts.map +1 -1
- package/dist/cjs/types/Model/ClusterMap.d.ts +1 -1
- package/dist/cjs/types/Model/ClusterMap.d.ts.map +1 -1
- package/dist/cjs/types/Model/EnumDefinition.d.ts +1 -1
- package/dist/cjs/types/Model/NodeInfo.d.ts +2 -2
- package/dist/cjs/types/Model/NodeInfo.d.ts.map +1 -1
- package/dist/cjs/types/Utils.d.ts +8 -1
- package/dist/cjs/types/Utils.d.ts.map +1 -1
- package/dist/esm/CodeGeneration/EnumFactory.js +1 -1
- package/dist/esm/CodeGeneration/EnumFactory.js.map +1 -1
- package/dist/esm/CodeGeneration/NodeClassFactory.js +1 -1
- package/dist/esm/CodeGeneration/NodeClassFactory.js.map +1 -1
- package/dist/esm/Devices/ISYDeviceNode.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonDeviceFactory.js +5 -1
- package/dist/esm/Devices/Insteon/InsteonDeviceFactory.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonKeypadDevice.js +2 -2
- package/dist/esm/Devices/Insteon/InsteonKeypadDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/KeypadButton.js +48 -0
- package/dist/esm/Devices/Insteon/KeypadButton.js.map +1 -0
- package/dist/esm/Devices/NodeFactory.js +2 -1
- package/dist/esm/Devices/NodeFactory.js.map +1 -1
- package/dist/esm/Devices/index.js.map +1 -1
- package/dist/esm/ISY.js +220 -183
- package/dist/esm/ISY.js.map +1 -1
- package/dist/esm/ISYNode.js +2 -2
- package/dist/esm/ISYNode.js.map +1 -1
- package/dist/esm/ISYScene.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
- package/dist/esm/Matter/Bridge/Server.js +5 -5
- package/dist/esm/Matter/Bridge/Server.js.map +1 -1
- package/dist/esm/Model/ClusterMap.js +2 -2
- package/dist/esm/Model/ClusterMap.js.map +1 -1
- package/dist/esm/Model/NodeInfo.js +1 -1
- package/dist/esm/Model/NodeInfo.js.map +1 -1
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/types/CodeGeneration/EnumFactory.d.ts +1 -1
- package/dist/esm/types/CodeGeneration/EnumFactory.d.ts.map +1 -1
- package/dist/esm/types/CodeGeneration/NodeClassFactory.d.ts +1 -1
- package/dist/esm/types/CodeGeneration/NodeClassFactory.d.ts.map +1 -1
- package/dist/esm/types/Devices/EndpointFor.d.ts +1 -1
- package/dist/esm/types/Devices/ISYDeviceNode.d.ts +2 -1
- package/dist/esm/types/Devices/ISYDeviceNode.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonDevice.d.ts +8 -7
- package/dist/esm/types/Devices/Insteon/InsteonDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonDeviceFactory.d.ts +2 -1
- package/dist/esm/types/Devices/Insteon/InsteonDeviceFactory.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonFanDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonKeypadDevice.d.ts +4 -4
- package/dist/esm/types/Devices/Insteon/InsteonKeypadDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonRelayDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/KeypadButton.d.ts +63 -0
- package/dist/esm/types/Devices/Insteon/KeypadButton.d.ts.map +1 -0
- package/dist/esm/types/Devices/NodeFactory.d.ts +2 -1
- package/dist/esm/types/Devices/NodeFactory.d.ts.map +1 -1
- package/dist/esm/types/Devices/index.d.ts +1 -1
- package/dist/esm/types/Devices/index.d.ts.map +1 -1
- package/dist/esm/types/ISY.d.ts +13 -28
- package/dist/esm/types/ISY.d.ts.map +1 -1
- package/dist/esm/types/ISYDevice.d.ts +1 -1
- package/dist/esm/types/ISYDevice.d.ts.map +1 -1
- package/dist/esm/types/ISYNode.d.ts +4 -2
- package/dist/esm/types/ISYNode.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Bridge/Server.d.ts.map +1 -1
- package/dist/esm/types/Model/ClusterMap.d.ts +1 -1
- package/dist/esm/types/Model/ClusterMap.d.ts.map +1 -1
- package/dist/esm/types/Model/NodeInfo.d.ts +2 -2
- package/dist/esm/types/Model/NodeInfo.d.ts.map +1 -1
- package/dist/esm/types/Utils.d.ts +8 -1
- package/dist/esm/types/Utils.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/CodeGeneration/EnumFactory.ts +2 -1
- package/src/CodeGeneration/NodeClassFactory.ts +2 -1
- package/src/Definitions/Global/Events.ts +2 -2
- package/src/Devices/ISYDeviceNode.ts +2 -1
- package/src/Devices/ISYMultiNodeDevice.ts +1 -1
- package/src/Devices/Insteon/InsteonDevice.ts +3 -2
- package/src/Devices/Insteon/InsteonDeviceFactory.ts +7 -2
- package/src/Devices/Insteon/InsteonFanDevice.ts +1 -1
- package/src/Devices/Insteon/InsteonKeypadDevice.ts +5 -5
- package/src/Devices/Insteon/InsteonRelayDevice.ts +1 -1
- package/src/Devices/Insteon/{Generated/KeypadButton.ts → KeypadButton.ts} +20 -20
- package/src/Devices/NodeFactory.ts +3 -2
- package/src/Devices/ZWave/ZWaveDimmerSwitchDevice.ts +1 -1
- package/src/Devices/index.ts +2 -2
- package/src/ISY.ts +249 -228
- package/src/ISYDevice.ts +3 -2
- package/src/ISYNode.ts +7 -5
- package/src/ISYScene.ts +1 -1
- package/src/Matter/Behaviors/ISYBridgedDeviceBehavior.ts +4 -2
- package/src/Matter/Behaviors/ISYClusterBehavior.ts +2 -12
- package/src/Matter/Bridge/Server.ts +8 -6
- package/src/Model/ClusterMap.ts +4 -3
- package/src/Model/NodeInfo.ts +4 -3
- package/src/Utils.ts +13 -6
package/src/ISYNode.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Logger } from 'winston';
|
|
|
3
3
|
import { Driver } from './Definitions/Global/Drivers.js';
|
|
4
4
|
import { Family } from './Definitions/Global/Families.js';
|
|
5
5
|
import { UnitOfMeasure } from './Definitions/Global/UOM.js';
|
|
6
|
-
import { ISY
|
|
6
|
+
import { ISY } from './ISY.js';
|
|
7
7
|
|
|
8
8
|
import { CliConfigSetLevels } from 'winston/lib/winston/config/index.js';
|
|
9
9
|
import { Converter } from './Converters.js';
|
|
@@ -14,13 +14,15 @@ import type { DriverState } from './Model/DriverState.js';
|
|
|
14
14
|
import { NodeInfo } from './Model/NodeInfo.js';
|
|
15
15
|
import type { NodeNotes } from './Model/NodeNotes.js';
|
|
16
16
|
import { type StringKeys } from './Utils.js';
|
|
17
|
+
import { NodeType } from './ISYConstants.js';
|
|
18
|
+
import type { ISYScene } from './ISYScene.js';
|
|
17
19
|
|
|
18
20
|
//type DriverValues<DK extends string | number | symbol,V = any> = {[x in DK]?:V};
|
|
19
21
|
|
|
20
22
|
export class ISYNode<
|
|
21
|
-
T extends Family,
|
|
22
|
-
D extends ISYNode.DriverSignatures,
|
|
23
|
-
C extends ISYNode.CommandSignatures,
|
|
23
|
+
T extends Family = Family,
|
|
24
|
+
D extends ISYNode.DriverSignatures = {},
|
|
25
|
+
C extends ISYNode.CommandSignatures = {},
|
|
24
26
|
E extends ISYNode.EventSignatures = { [x in keyof D]: Event.DriverToEvent<D[x]> & { driver: x } } & { [x in keyof C]: Event.CommandToEvent<C[x]> & { command: x } }
|
|
25
27
|
> {
|
|
26
28
|
// #region Properties (32)
|
|
@@ -219,7 +221,7 @@ export class ISYNode<
|
|
|
219
221
|
|
|
220
222
|
public async getNotes(): Promise<NodeNotes> {
|
|
221
223
|
try {
|
|
222
|
-
const result = await this.isy.sendRequest(`nodes/${this.address}/notes`, { trailingSlash: false, errorLogLevel: 'debug' });
|
|
224
|
+
const result = await this.isy.sendRequest(`nodes/${this.address}/notes`, { trailingSlash: false, errorLogLevel: 'debug', validateStatus(status) { return true; }});
|
|
223
225
|
if (result !== null && result !== undefined) {
|
|
224
226
|
return result.NodeProperties;
|
|
225
227
|
} else {
|
package/src/ISYScene.ts
CHANGED
|
@@ -32,7 +32,7 @@ export class ISYScene extends ISYNode<Family.Scene, Driver.Signatures<'ST'>,Comm
|
|
|
32
32
|
public members: ISYDevice<any,any,any>[];
|
|
33
33
|
public typeCode: string;
|
|
34
34
|
constructor(isy: ISY, scene: SceneInfo) {
|
|
35
|
-
super(isy, scene as
|
|
35
|
+
super(isy, scene as NodeInfo);
|
|
36
36
|
// this.logger(JSON.stringify(scene));
|
|
37
37
|
this.typeCode = '';
|
|
38
38
|
this.connectionType = 'Insteon Wired';
|
|
@@ -9,10 +9,12 @@ import { Internal } from '@project-chip/matter.js/behavior/state/managed';
|
|
|
9
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
|
-
import { ISY
|
|
12
|
+
import { ISY } from '../../ISY.js';
|
|
13
13
|
import type { ISYDevice } from '../../ISYDevice.js';
|
|
14
14
|
import { DeviceToClusterMap, MappingRegistry, type ClusterMapping, type BehaviorMapping } from '../../Model/ClusterMap.js';
|
|
15
15
|
import { server } from 'typescript';
|
|
16
|
+
import type { ISYNode } from '../../ISYNode.js';
|
|
17
|
+
import type { Family } from '../../Definitions/index.js';
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
type ClusterForBehavior<B extends ClusterBehavior> = B extends ClusterBehavior.Type<infer C> ? C : never;
|
|
@@ -32,7 +34,7 @@ export class ISYBridgedDeviceBehavior<N extends ISYNode<any, D, any, any>, D ext
|
|
|
32
34
|
const d = ISY.instance.nodeMap.get(this.state.address);
|
|
33
35
|
this.internal.device = d;
|
|
34
36
|
this.internal.map = MappingRegistry.getMapping(this.internal.device as unknown as ISYNode<Family, any, any, any>);
|
|
35
|
-
|
|
37
|
+
|
|
36
38
|
ISY.instance.logger.debug(`Initializing ${this.constructor.name} for ${this.internal.device.constructor.name} ${this.internal.device.name} with address ${address}`);
|
|
37
39
|
if (d) {
|
|
38
40
|
d.events.on('propertyChanged', this.handlePropertyChange.bind(this));
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ClusterBehavior, ClusterInterface } from '@project-chip/matter.js/behavior/cluster';
|
|
3
|
-
import { BridgedDeviceBasicInformationServer } from '@project-chip/matter.js/behaviors/bridged-device-basic-information';
|
|
1
|
+
import type { ClusterBehavior } from '@project-chip/matter.js/behavior/cluster';
|
|
4
2
|
import type { LevelControlBehavior } from '@project-chip/matter.js/behaviors/level-control';
|
|
5
|
-
import type { OnOffBehavior, OnOffServer } from '@project-chip/matter.js/behaviors/on-off';
|
|
6
|
-
import type { Cluster, ClusterServerHandlers, ClusterType as CT } from '@project-chip/matter.js/cluster';
|
|
7
3
|
import '@project-chip/matter.js/device';
|
|
8
|
-
import { OnOffLightRequirements } from '@project-chip/matter.js/devices/OnOffLightDevice';
|
|
9
|
-
import type { AnyMxRecord } from 'dns';
|
|
10
4
|
import { Converter } from '../../Converters.js';
|
|
11
|
-
import { Driver, DriverType } from '../../Definitions/Global/Drivers.js';
|
|
12
5
|
import type { Constructor } from '../../Devices/Constructor.js';
|
|
13
|
-
import type { RelaxTypes } from '../../Devices/MapsTo.js';
|
|
14
|
-
import { ISY, type ISYDevice } from '../../ISY.js';
|
|
15
6
|
import type { DriversOf, ISYNode } from '../../ISYNode.js';
|
|
16
|
-
import { BehaviorMapping
|
|
7
|
+
import { BehaviorMapping } from '../../Model/ClusterMap.js';
|
|
17
8
|
import { ISYBridgedDeviceBehavior } from './ISYBridgedDeviceBehavior.js';
|
|
18
|
-
import { loggers } from 'winston';
|
|
19
9
|
|
|
20
10
|
// #region Type aliases (6)
|
|
21
11
|
|
|
@@ -3,7 +3,7 @@ import { NodeJsEnvironment } from '@project-chip/matter-node.js/environment';
|
|
|
3
3
|
import { StorageBackendDisk } from '@project-chip/matter-node.js/storage';
|
|
4
4
|
import { BridgedDeviceBasicInformationServer } from '@project-chip/matter.js/behaviors/bridged-device-basic-information';
|
|
5
5
|
import { VendorId } from '@project-chip/matter.js/datatype';
|
|
6
|
-
import { logEndpoint } from '@project-chip/matter.js/device';
|
|
6
|
+
import { Device, logEndpoint } from '@project-chip/matter.js/device';
|
|
7
7
|
import { Endpoint, EndpointServer } from '@project-chip/matter.js/endpoint';
|
|
8
8
|
import { DimmableLightDevice, OnOffLightDevice } from '@project-chip/matter.js/endpoint/definitions';
|
|
9
9
|
import type { SupportedBehaviors } from '@project-chip/matter.js/endpoint/properties';
|
|
@@ -11,6 +11,8 @@ import { MutableEndpoint } from '@project-chip/matter.js/endpoint/type';
|
|
|
11
11
|
import { AggregatorEndpoint } from '@project-chip/matter.js/endpoints/AggregatorEndpoint';
|
|
12
12
|
import { StorageService } from '@project-chip/matter.js/environment';
|
|
13
13
|
import { Level, levelFromString, Logger as MatterLogger } from '@project-chip/matter.js/log';
|
|
14
|
+
import { Devices } from '../../Devices/index.js';
|
|
15
|
+
|
|
14
16
|
import { ServerNode } from '@project-chip/matter.js/node';
|
|
15
17
|
//@ts-ignore
|
|
16
18
|
import PackageJson from '@project-chip/matter.js/package.json' with { type: 'json' };
|
|
@@ -18,7 +20,7 @@ import { QrCode } from '@project-chip/matter.js/schema';
|
|
|
18
20
|
import path, { resolve } from 'path';
|
|
19
21
|
import { format, loggers } from 'winston';
|
|
20
22
|
import type { ISYDeviceNode } from '../../Devices/ISYDeviceNode.js';
|
|
21
|
-
import {
|
|
23
|
+
import { ISY } from '../../ISY.js';
|
|
22
24
|
import { ISYBridgedDeviceBehavior } from '../Behaviors/ISYBridgedDeviceBehavior.js';
|
|
23
25
|
import { ISYDimmableBehavior, ISYOnOffBehavior } from '../Behaviors/Insteon/ISYOnOffBehavior.js';
|
|
24
26
|
import '../Mappings/Insteon.js';
|
|
@@ -152,24 +154,24 @@ export async function createMatterServer(isy?: ISY, config?: Config): Promise<Se
|
|
|
152
154
|
|
|
153
155
|
logger.info(`Bridge Aggregator Added`);
|
|
154
156
|
|
|
155
|
-
|
|
157
|
+
|
|
156
158
|
|
|
157
159
|
for (const node of isy.nodeMap.values()) {
|
|
158
160
|
let device = node as ISYDeviceNode<any, any, any>;
|
|
159
161
|
let serialNumber = `${device.address.replaceAll(' ', '_').replaceAll('.', '_')}`;
|
|
160
|
-
if (device.enabled
|
|
162
|
+
if (device.enabled) {
|
|
161
163
|
//const name = `OnOff ${isASocket ? "Socket" : "Light"} ${i}`;
|
|
162
164
|
|
|
163
165
|
//@ts-ignore
|
|
164
166
|
let baseBehavior: MutableEndpoint.With<DimmableLightDevice | OnOffLightDevice, SupportedBehaviors.MapOf<[typeof BridgedDeviceBasicInformationServer, typeof ISYBridgedDeviceBehavior]>>;
|
|
165
167
|
|
|
166
|
-
if (device instanceof
|
|
168
|
+
if (device instanceof Devices.Insteon.Dimmer || device instanceof Devices.Insteon.DimmerSwitch || device instanceof Devices.Insteon.KeypadDimmer) {
|
|
167
169
|
baseBehavior = DimmableLightDevice.with(BridgedDeviceBasicInformationServer, ISYBridgedDeviceBehavior, ISYOnOffBehavior, ISYDimmableBehavior);
|
|
168
170
|
// if(device instanceof InsteonSwitchDevice)
|
|
169
171
|
// {
|
|
170
172
|
// baseBehavior = DimmerSwitchDevice.with(BridgedDeviceBasicInformationServer);
|
|
171
173
|
// }
|
|
172
|
-
} else if (device instanceof
|
|
174
|
+
} else if (device instanceof Devices.Insteon.Relay || device instanceof Devices.Insteon.RelaySwitch) {
|
|
173
175
|
baseBehavior = OnOffLightDevice.with(BridgedDeviceBasicInformationServer, ISYBridgedDeviceBehavior, ISYOnOffBehavior);
|
|
174
176
|
// if(device instanceof InsteonSwitchDevice)
|
|
175
177
|
// {
|
package/src/Model/ClusterMap.ts
CHANGED
|
@@ -13,11 +13,12 @@ import type { Converter } from '../Converters.js';
|
|
|
13
13
|
import { Driver, DriverType } from '../Definitions/Global/Drivers.js';
|
|
14
14
|
import { Devices, type ToDevice } from '../Devices/index.js';
|
|
15
15
|
import { Insteon } from '../Devices/Insteon/index.js';
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
import type { ISYDevice } from '../ISYDevice.js';
|
|
18
18
|
import type { CommandsOf, DriversOf, ISYNode } from '../ISYNode.js';
|
|
19
19
|
import type { ClusterForBehavior } from '../Matter/Behaviors/ISYClusterBehavior.js';
|
|
20
20
|
import { ClusterType } from './ClusterType.js';
|
|
21
|
+
import type { Family } from '../Definitions/index.js';
|
|
21
22
|
|
|
22
23
|
// #region Type aliases (16)
|
|
23
24
|
|
|
@@ -189,7 +190,7 @@ var clusterMap = {
|
|
|
189
190
|
moveToColor: { command: DriverType.CustomControl1, parameters: { colorX: { parameter: 'colorX' }, colorY: { parameter: 'colorY' }, colorTemperature: { parameter: 'colorTemperature' } } }
|
|
190
191
|
}
|
|
191
192
|
};
|
|
192
|
-
const map: EndpointMapping<OnOffLightDevice, InsteonRelayDevice> = {
|
|
193
|
+
/*const map: EndpointMapping<OnOffLightDevice, InsteonRelayDevice> = {
|
|
193
194
|
Identify: {},
|
|
194
195
|
OnOff: {
|
|
195
196
|
attributes: {
|
|
@@ -199,6 +200,6 @@ const map: EndpointMapping<OnOffLightDevice, InsteonRelayDevice> = {
|
|
|
199
200
|
onWithTimedOff: { command: 'DON' }
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
|
-
}
|
|
203
|
+
};*/
|
|
203
204
|
|
|
204
205
|
// #endregion Variables (3)
|
package/src/Model/NodeInfo.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Family } from '../Definitions/index.js';
|
|
2
|
+
|
|
3
|
+
|
|
3
4
|
import type { DriverState } from './DriverState.js';
|
|
4
5
|
|
|
5
6
|
// #region Type aliases (1)
|
|
6
7
|
|
|
7
|
-
export type NodeInfo<T extends Family = Family> = (T extends Family.ZWave ? DynamicNodeInfo : StaticNodeInfo) & { state?: { [x: string]: DriverState } };
|
|
8
|
+
export type NodeInfo<T extends Family = Family> = (T extends Family.ZWave | Family.ZigBee ? DynamicNodeInfo : StaticNodeInfo) & { state?: { [x: string]: DriverState } };
|
|
8
9
|
|
|
9
10
|
// #endregion Type aliases (1)
|
|
10
11
|
|
package/src/Utils.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import axios, { AxiosRequestConfig } from 'axios';
|
|
2
1
|
|
|
3
2
|
import * as log4js from '@log4js-node/log4js-api';
|
|
4
|
-
import winston, { Logger, format } from 'winston';
|
|
3
|
+
import winston, { Logger, format, type LeveledLogMethod, type LogMethod } from 'winston';
|
|
5
4
|
|
|
6
|
-
import { Axios } from 'axios';
|
|
7
5
|
import { EventEmitter as BaseEventEmitter } from 'events';
|
|
8
6
|
import { Category } from './Definitions/Global/Categories.js';
|
|
9
7
|
|
|
10
8
|
//import { get } from 'http';
|
|
11
9
|
import type { PackageJson } from '@npmcli/package-json';
|
|
12
|
-
import type { Identity } from '@project-chip/matter.js/util';
|
|
13
10
|
import { existsSync } from 'fs';
|
|
14
11
|
import { readFile } from 'fs/promises';
|
|
15
12
|
import path from 'path';
|
|
16
|
-
import {
|
|
17
|
-
import { Family, type Driver, type DriverType, type EnumLiteral } from './Definitions/index.js';
|
|
13
|
+
import { Family } from './Definitions/index.js';
|
|
18
14
|
import { EventType } from './Events/EventType.js';
|
|
15
|
+
import type { Axios, AxiosRequestConfig } from 'axios';
|
|
19
16
|
|
|
20
17
|
export type StringKeys<T> = Extract<keyof T, string>;
|
|
21
18
|
|
|
19
|
+
export type PickOfType<T, U> = { [K in keyof T]: T[K] extends U ? (any extends T[K] ? never : K) : undefined }[keyof T];
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
22
23
|
export function getEnumValueByEnumKey<E extends { [index: string]: number }, T extends keyof E>(enumType: E, enumKey: T): E[T] {
|
|
23
24
|
return enumType[enumKey];
|
|
24
25
|
}
|
|
@@ -27,6 +28,8 @@ export function getEnumKeyByEnumValue<E extends { [index: string]: number }, T e
|
|
|
27
28
|
return Object.keys(enumType).find((key) => enumType[key] === enumValue) as unknown as T;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
|
|
32
|
+
export type LogLevel = PickOfType<winston.Logger, LeveledLogMethod>;
|
|
30
33
|
export type ValuesOf<TEnum extends number | string | boolean | bigint> = `${TEnum}` extends `${infer R extends number}` ? R : `${TEnum}`;
|
|
31
34
|
|
|
32
35
|
type s = ValuesOf<Family>;
|
|
@@ -53,6 +56,10 @@ export function fromArray<T>(...value: T[]): MaybeArray<T> {
|
|
|
53
56
|
return value;
|
|
54
57
|
}
|
|
55
58
|
|
|
59
|
+
export type BaseRequestConfig = Pick<AxiosRequestConfig, 'auth' | 'baseURL' | 'socketPath'>;
|
|
60
|
+
|
|
61
|
+
export type ISYRequestConfig = Omit<AxiosRequestConfig, keyof BaseRequestConfig | 'method'>
|
|
62
|
+
|
|
56
63
|
export function byteToPct(value) {
|
|
57
64
|
return Math.round((value * 100) / 255);
|
|
58
65
|
}
|