zigbee-herdsman
Version:
An open source Zigbee gateway solution with node.js.
284 lines • 12.6 kB
TypeScript
import type { BuffaloZclDataType, DataType, Direction, FrameType, ParameterCondition, StructuredIndicatorType } from "./enums";
import type { Status } from "./status";
export interface BuffaloZclOptions {
length?: number;
payload?: {
mode?: number;
numoftrans?: number;
commandID?: number;
payloadSize?: number;
} & {
[key: string]: unknown;
};
dataType?: DataType | BuffaloZclDataType;
attrId?: number;
}
export interface ZclArray {
elementType: DataType | keyof typeof DataType;
elements: unknown[];
}
export interface StructuredSelector {
indexes?: number[];
indicatorType?: StructuredIndicatorType;
}
export interface Struct {
elmType: DataType;
elmVal: unknown;
}
export interface ZclTimeOfDay {
/** [0-23] */
hours?: number;
/** [0-59] */
minutes?: number;
/** [0-59] */
seconds?: number;
/** [0-99] */
hundredths?: number;
}
export interface ZclDate {
/** [1900-2155], converted to/from [0-255] => value+1900=year */
year?: number;
/** [1-12] */
month?: number;
/** [1-31] */
dayOfMonth?: number;
/** [1-7] */
dayOfWeek?: number;
}
export interface ZoneInfo {
zoneID: number;
zoneStatus: number;
}
export interface ExtensionFieldSet {
clstId: number;
len: number;
extField: unknown[];
}
export interface ThermoTransition {
transitionTime: number;
heatSetpoint?: number;
coolSetpoint?: number;
}
export interface Gpd {
deviceID: number;
options: number;
extendedOptions: number;
securityKey: Buffer;
keyMic: number;
outgoingCounter: number;
applicationInfo: number;
manufacturerID: number;
modelID: number;
numGpdCommands: number;
gpdCommandIdList: Buffer;
numServerClusters: number;
numClientClusters: number;
gpdServerClusters: Buffer;
gpdClientClusters: Buffer;
genericSwitchConfig: number;
currentContactStatus: number;
}
export interface GpdChannelRequest {
nextChannel: number;
nextNextChannel: number;
}
export interface GpdChannelConfiguration {
commandID: number;
operationalChannel: number;
basic: boolean;
}
export interface GpdCommissioningReply {
commandID: number;
options: number;
/** expected valid if corresponding `options` bits set */
panID?: number;
/** expected valid if corresponding `options` bits set */
securityKey?: Buffer;
/** expected valid if corresponding `options` bits set */
keyMic?: number;
/** expected valid if corresponding `options` bits set */
frameCounter?: number;
}
export interface GpdCustomReply {
commandID: number;
buffer: Buffer;
}
export type GpdAttributeReport = {
clusterID: number;
clusterName: string;
attributes: Record<string | number, unknown>;
};
export type GpdManufAttributeReport = {
manufacturerCode: number;
} & GpdAttributeReport;
export type GpdMultiClusterAttributeReport = {
reports: Array<{
clusterID: number;
clusterName: string;
attribute: string | number;
attrData: unknown;
}>;
};
export type GpdManufMultiClusterAttributeReport = {
manufacturerCode: number;
} & GpdMultiClusterAttributeReport;
export type GpdAttributeReporting = GpdAttributeReport | GpdManufAttributeReport | GpdMultiClusterAttributeReport | GpdManufMultiClusterAttributeReport;
export type GpdRequestAttribute = {
options: number;
manufacturerID: number | undefined;
records: Array<{
clusterID: number;
attributes: Array<number>;
}>;
};
export type GpdReadAttributeResponse = {
options: number;
manufacturerID: number | undefined;
records: Array<{
clusterID: number;
clusterName: string;
attributes: Record<string | number, {
status: Status;
attrData: unknown;
}>;
}>;
};
export interface TuyaDataPointValue {
dp: number;
datatype: number;
data: Buffer;
}
export interface MiboxerZone {
zoneNum: number;
groupId: number;
}
export interface FrameControl {
reservedBits: number;
frameType: FrameType;
manufacturerSpecific: boolean;
direction: Direction;
disableDefaultResponse: boolean;
}
/**
* @see https://github.com/project-chip/zap/blob/master/zcl-builtin/dotdot/README.md#restrictions
*/
type Restrictions = Readonly<{
/** specifies an exact length, generally used for a string. */
length?: number;
/** specifies the minimum length that a type must take, generally used for a string or a list/array */
minLen?: number;
/** specifies the maximum length that a type must take, generally used for a string or a list/array */
maxLen?: number;
/** sets a minimum that doesn't include the value specified, i.e. a field of this type must be strictly greater than the value */
minExcl?: number;
/** sets a minimum that includes the value specified, i.e. a field of this type must be greater than or equal than the value */
min?: number;
/** sets a maximum that doesn't include the value specified, i.e. a field of this type must be strictly less than the value */
maxExcl?: number;
/** sets a maximum that includes the value specified, i.e. a field of this type must be less than or equal to the value */
max?: number;
/** sets a minimum that is based on the value of the referenced attribute. The value of the referenced attribute is included in the range */
/** sets a minimum that is based on the value of the referenced attribute. The value of the referenced attribute is excluded from the range */
/** sets a maximum that is based on the value of the referenced attribute. The value of the referenced attribute is included in the range */
/** sets a maximum that is based on the value of the referenced attribute. The value of the referenced attribute is excluded from the range */
/**
* In some cases, a special value is defined by the Zigbee specification.
* In these cases, the special value along with a descriptor should be defined using this tag.
* Special values take precedence over other restrictions imposed (e.g. a special value may fall outside the min/max range for the attribute).
*
* Mapped as "value -> label".
* Technically `1 in ..` and `"1" in ..` will match, but for same entry, value is always expected of same type, so does not matter.
*/
special?: Record<string | number, string>;
}>;
/**
* @see https://github.com/project-chip/zap/blob/master/zcl-builtin/dotdot/README.md#attributes
* Extra metadata:
* - writableIf: Indicates an expression that specifies the writability of the attribute.
* Defaults to true.
* Note: An attribute is only writable if this attribute and the writable attribute are true.
* - requiredIf: Allows for an expression to be implemented which indicates the conditions in which an attribute is mandatory.
* Defaults to false
*/
export type Attribute = Readonly<{
ID: number;
name: string;
type: DataType;
manufacturerCode?: number;
/** If the attribute is readable OTA. Defaults to true. NOTE: marked as `R` in spec PDF */
read?: false;
/** If the attribute is writable OTA. Defaults to false. NOTE: marked as `W` in spec PDF */
write?: true;
/** If the attribute is specified as writable this indicates if the write is required (returns READ_ONLY if not). Defaults to false. */
writeOptional?: true;
/** If attribute is required to be reportable. Defaults to false. NOTE: marked as `P` in spec PDF */
report?: true;
/** If attribute is required to be part of the scene extensions. Defaults to false. NOTE: marked as `S` in spec PDF */
scene?: true;
/** If the attribute is mandatory. Defaults to false */
required?: true;
/** Specifies the default value of an attribute. No Default */
default?: number | string;
/**
* Specifies that the default value of the attribute takes the value of the referenced attribute.
* Must be another attriibute in this cluster.
* Referenced by name, schema forces this during validation.
*/
/** If attribute is client side */
client?: true;
}> & Restrictions;
export type Parameter = Readonly<{
name: string;
type: DataType | BuffaloZclDataType;
conditions?: readonly ({
type: ParameterCondition.MINIMUM_REMAINING_BUFFER_BYTES;
value: number;
} | {
type: ParameterCondition.BITMASK_SET;
param: string;
mask: number;
reversed?: boolean;
} | {
type: ParameterCondition.BITFIELD_ENUM;
param: string;
offset: number;
size: number;
value: number;
} | {
type: ParameterCondition.FIELD_EQUAL;
field: string;
value: unknown;
reversed?: boolean;
} | {
type: ParameterCondition.FIELD_GT;
field: string;
value: number;
})[];
}> & Restrictions;
/**
* @see https://github.com/project-chip/zap/blob/master/zcl-builtin/dotdot/README.md#commands
* Extra metadata:
* - requiredIf: Allows for an expression to be implemented which indicates the conditions in which a command is mandatory. Defaults to false
*/
export type Command = Readonly<{
ID: number;
name: string;
parameters: readonly Parameter[];
response?: number;
/** If the command is mandatory. Defaults to false */
required?: true;
}>;
export type Cluster = Readonly<{
ID: number;
name: string;
manufacturerCode?: number;
attributes: Readonly<Record<string, Attribute>>;
commands: Readonly<Record<string, Command>>;
commandsResponse: Readonly<Record<string, Command>>;
}>;
export interface CustomClusters {
[k: string]: Cluster;
}
export type ClusterName = "genBasic" | "genPowerCfg" | "genDeviceTempCfg" | "genIdentify" | "genGroups" | "genScenes" | "genOnOff" | "genOnOffSwitchCfg" | "genLevelCtrl" | "genAlarms" | "genTime" | "genRssiLocation" | "genAnalogInput" | "genAnalogOutput" | "genAnalogValue" | "genBinaryInput" | "genBinaryOutput" | "genBinaryValue" | "genMultistateInput" | "genMultistateOutput" | "genMultistateValue" | "genCommissioning" | "piPartition" | "genOta" | "powerProfile" | "haApplianceControl" | "pulseWidthModulation" | "genPollCtrl" | "greenPower" | "mobileDeviceCfg" | "neighborCleaning" | "nearestGateway" | "keepAlive" | "zigbeeDirectConfiguration" | "closuresShadeCfg" | "closuresDoorLock" | "closuresWindowCovering" | "barrierControl" | "hvacPumpCfgCtrl" | "hvacThermostat" | "hvacFanCtrl" | "hvacDehumidificationCtrl" | "hvacUserInterfaceCfg" | "lightingColorCtrl" | "lightingBallastCfg" | "msIlluminanceMeasurement" | "msIlluminanceLevelSensing" | "msTemperatureMeasurement" | "msPressureMeasurement" | "msFlowMeasurement" | "msRelativeHumidity" | "msOccupancySensing" | "msLeafWetness" | "msSoilMoisture" | "pHMeasurement" | "msElectricalConductivity" | "msWindSpeed" | "msCarbonMonoxide" | "msCO2" | "msEthylene" | "msEthyleneOxide" | "msHydrogen" | "msHydrogenSulfide" | "msNitricOxide" | "msNitrogenDioxide" | "msOxygen" | "msOzone" | "msSulfurDioxide" | "msDissolvedOxygen" | "msBromate" | "msChloramines" | "msChlorine" | "msFecalColiformAndEColi" | "msFluoride" | "msHaloaceticAcids" | "msTotalTrihalomethanes" | "msTotalColiformBacteria" | "msTurbidity" | "msCopper" | "msLead" | "msManganese" | "msSulfate" | "msBromodichloromethane" | "msBromoform" | "msChlorodibromomethane" | "msChloroform" | "msSodium" | "pm25Measurement" | "msFormaldehyde" | "ssIasZone" | "ssIasAce" | "ssIasWd" | "piGenericTunnel" | "piBacnetProtocolTunnel" | "piAnalogInputReg" | "piAnalogInputExt" | "piAnalogOutputReg" | "piAnalogOutputExt" | "piAnalogValueReg" | "piAnalogValueExt" | "piBinaryInputReg" | "piBinaryInputExt" | "piBinaryOutputReg" | "piBinaryOutputExt" | "piBinaryValueReg" | "piBinaryValueExt" | "piMultistateInputReg" | "piMultistateInputExt" | "piMultistateOutputReg" | "piMultistateOutputExt" | "piMultistateValueReg" | "piMultistateValueExt" | "pi11073ProtocolTunnel" | "piIso7818ProtocolTunnel" | "retailTunnel" | "seMetering" | "seTunneling" | "telecommunicationsInformation" | "telecommunicationsVoiceOverZigbee" | "telecommunicationsChatting" | "haApplianceIdentification" | "seMeterIdentification" | "haApplianceEventsAlerts" | "haApplianceStatistics" | "haElectricalMeasurement" | "haDiagnostic" | "touchlink" | "manuSpecificTuya" | "manuSpecificAmazonWWAH";
export {};
//# sourceMappingURL=tstype.d.ts.map