Skip to content

Commit

Permalink
fix(ignore): Export ZclHeader type Koenkk/zigbee2mqtt#19129
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Oct 7, 2023
1 parent cb5dd54 commit 69fb9f1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/controller/model/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,15 +883,15 @@ class Endpoint extends Entity {

public waitForCommand(
clusterKey: number | string, commandKey: number | string, transactionSequenceNumber: number, timeout: number,
): {promise: Promise<{header: KeyValue; payload: KeyValue}>; cancel: () => void} {
): {promise: Promise<{header: Zcl.ZclHeader; payload: KeyValue}>; cancel: () => void} {
const cluster = Zcl.Utils.getCluster(clusterKey);
const command = cluster.getCommand(commandKey);
const waiter = Entity.adapter.waitFor(
this.deviceNetworkAddress, this.ID, Zcl.FrameType.SPECIFIC, Zcl.Direction.CLIENT_TO_SERVER,
transactionSequenceNumber, cluster.ID, command.ID, timeout
);

const promise = new Promise<{header: KeyValue; payload: KeyValue}>((resolve, reject) => {
const promise = new Promise<{header: Zcl.ZclHeader; payload: KeyValue}>((resolve, reject) => {
waiter.promise.then(
(payload) => resolve({header: payload.frame.Header, payload: payload.frame.Payload}),
(error) => reject(error),
Expand Down
2 changes: 2 additions & 0 deletions src/zcl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import PowerSource from './definition/powerSource';
import EndpointDeviceType from './definition/endpointDeviceType';
import ManufacturerCode from './definition/manufacturerCode';
import ZclFrame from './zclFrame';
import ZclHeader from './zclHeader';
import ZclStatusError from './zclStatusError';
import * as TsType from './tstype';

Expand All @@ -28,4 +29,5 @@ export {
FrameControl,
EndpointDeviceType,
ZclStatusError,
ZclHeader,
};
10 changes: 2 additions & 8 deletions src/zcl/zclFrame.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Direction, Foundation, DataType, BuffaloZclDataType, FrameControl} from './definition';
import {Direction, Foundation, DataType, BuffaloZclDataType} from './definition';
import ZclHeader from './zclHeader';
import * as Utils from './utils';
import BuffaloZcl from './buffaloZcl';
import {TsType as BuffaloTsType} from '../buffalo';
Expand All @@ -10,13 +11,6 @@ const MINIMAL_FRAME_LENGTH = 3;
// eslint-disable-next-line
type ZclPayload = any;

interface ZclHeader {
frameControl: FrameControl;
manufacturerCode: number;
transactionSequenceNumber: number;
commandIdentifier: number;
}

const ListTypes: number[] = [
BuffaloZclDataType.LIST_UINT8,
BuffaloZclDataType.LIST_UINT16,
Expand Down
10 changes: 10 additions & 0 deletions src/zcl/zclHeader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {FrameControl} from './definition';

interface ZclHeader {
frameControl: FrameControl;
manufacturerCode: number;
transactionSequenceNumber: number;
commandIdentifier: number;
}

export default ZclHeader;

0 comments on commit 69fb9f1

Please sign in to comment.