lib-comfoair
Version:
Library to communicate with Zehnder ComfoAirQ ventilation unit through the ComfoControl gateway
313 lines (312 loc) • 12.7 kB
TypeScript
/**
* Enum representing different data types.
*/
export declare enum PropertyDataType {
CN_BOOL = 0 /** CN_BOOL: `00` (false), `01` (true) */,
CN_UINT8 = 1 /** CN_UINT8: `00` (0) until `ff` (255) */,
CN_UINT16 = 2 /** CN_UINT16: `3412` = 1234 */,
CN_UINT32 = 3 /** CN_UINT32: `7856 3412` = 12345678 */,
CN_INT8 = 5 /** CN_INT8 */,
CN_INT16 = 6 /** CN_INT16: `3412` = 1234 */,
CN_INT32 = 7 /** CN_INT16: `3412` = 1234 */,
CN_INT64 = 8 /** CN_INT64 */,
CN_STRING = 9 /** CN_STRING */,
CN_TIME = 10 /** CN_TIME */,
CN_VERSION = 11 /** CN_VERSION */
}
declare const PropertyDataTypeParsers: {
readonly 0: (data: Buffer) => boolean;
readonly 1: (data: Buffer) => number;
readonly 2: (data: Buffer) => number;
readonly 3: (data: Buffer) => number;
readonly 5: (data: Buffer) => number;
readonly 6: (data: Buffer) => number;
readonly 7: (data: Buffer) => number;
readonly 8: (data: Buffer) => bigint;
readonly 9: (data: Buffer) => string;
readonly 10: (data: Buffer) => number;
readonly 11: (data: Buffer) => string;
};
export interface DeviceProperty {
readonly propertyId: number;
readonly dataType: PropertyDataType;
readonly convert?: (v: DeriveNativeDataType<this['dataType']>) => DeriveNativeDataType<this['dataType']>;
}
type DeriveNativeDataType<T extends PropertyDataType> = (typeof PropertyDataTypeParsers)[T] extends (data: Buffer) => infer R ? R : never;
export type PropertyNativeType<T extends {
dataType: PropertyDataType;
}> = DeriveNativeDataType<T['dataType']>;
export type ComfoAirPropertyType<P extends keyof typeof ComfoAirProperties> = PropertyNativeType<(typeof ComfoAirProperties)[P]>;
/**
* Object representing different properties with their propertyId and dataType.
*/
export declare const ComfoAirProperties: {
/** Away indicator (`01` = low, medium, high fan speed, `07` = away) */
readonly AWAY_INDICATOR: {
readonly propertyId: 16;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Operating mode (`01` = limited manual, `05` = unlimited manual, `ff` = auto) */
readonly OPERATING_MODE_49: {
readonly propertyId: 49;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Operating mode (`01` = unlimited manual, `ff` = auto) */
readonly OPERATING_MODE_56: {
readonly propertyId: 56;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Fans: Fan speed setting (`00` (away), `01`, `02` or `03`) */
readonly FAN_SPEED_SETTING: {
readonly propertyId: 65;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Bypass activation mode (`00` = auto, `01` = activated, `02` = deactivated) */
readonly BYPASS_ACTIVATION_MODE: {
readonly propertyId: 66;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Temperature Profile (`00` = normal, `01` = cold, `02` = warm) */
readonly TEMPERATURE_PROFILE: {
readonly propertyId: 67;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** General: Countdown until next fan speed change (`52020000` = 00000252 -> 594 seconds) */
readonly COUNTDOWN_NEXT_FAN_SPEED_CHANGE: {
readonly propertyId: 81;
readonly dataType: PropertyDataType.CN_UINT32;
};
/** Fans: Exhaust fan duty (`1c` = 28%) */
readonly EXHAUST_FAN_DUTY: {
readonly propertyId: 117;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Fans: Supply fan duty (`1d` = 29%) */
readonly SUPPLY_FAN_DUTY: {
readonly propertyId: 118;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Fans: Exhaust fan flow (`6e00` = 110 m³/h) */
readonly EXHAUST_FAN_FLOW: {
readonly propertyId: 119;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Fans: Supply fan flow (`6900` = 105 m³/h) */
readonly SUPPLY_FAN_FLOW: {
readonly propertyId: 120;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Fans: Exhaust fan speed (`2d04` = 1069 rpm) */
readonly EXHAUST_FAN_SPEED: {
readonly propertyId: 121;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Fans: Supply fan speed (`5904` = 1113 rpm) */
readonly SUPPLY_FAN_SPEED: {
readonly propertyId: 122;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Power Consumption: Current Ventilation (`0f00` = 15 W) */
readonly CURRENT_VENTILATION_POWER_CONSUMPTION: {
readonly propertyId: 128;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Power Consumption: Total year-to-date (`1700` = 23 kWh) */
readonly TOTAL_YEAR_TO_DATE_POWER_CONSUMPTION: {
readonly propertyId: 129;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Power Consumption: Total from start (`1700` = 23 kWh) */
readonly TOTAL_FROM_START_POWER_CONSUMPTION: {
readonly propertyId: 130;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Preheater Power Consumption: Total year-to-date (`1700` = 23 kWh) */
readonly PREHEATER_TOTAL_YEAR_TO_DATE_POWER_CONSUMPTION: {
readonly propertyId: 144;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Preheater Power Consumption: Total from start (`1700` = 23 kWh) */
readonly PREHEATER_TOTAL_FROM_START_POWER_CONSUMPTION: {
readonly propertyId: 145;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Preheater Power Consumption: Current Ventilation (`0f00` = 15 W) */
readonly PREHEATER_CURRENT_VENTILATION_POWER_CONSUMPTION: {
readonly propertyId: 146;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Days left before filters must be replaced (`8200` = 130 days) */
readonly DAYS_LEFT_BEFORE_FILTER_REPLACEMENT: {
readonly propertyId: 192;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Current RMOT (`7500` = 117 -> 11.7 °C) */
readonly CURRENT_RMOT: {
readonly propertyId: 209;
readonly dataType: PropertyDataType.CN_INT16;
readonly convert: (v: any) => number;
};
/** Temperature profile target (`ee00` = 23.8 °C) */
readonly TEMPERATURE_PROFILE_TARGET: {
readonly propertyId: 212;
readonly dataType: PropertyDataType.CN_UINT16;
readonly convert: (v: any) => number;
};
/** Avoided Heating: Avoided actual: (`b901` = 441 -> 4.41 W) */
readonly AVOIDED_HEATING_ACTUAL: {
readonly propertyId: 213;
readonly dataType: PropertyDataType.CN_UINT16;
readonly convert: (v: any) => number;
};
/** Avoided Heating: Avoided year-to-date: (`dd01` = 477 kWh) */
readonly AVOIDED_HEATING_YEAR_TO_DATE: {
readonly propertyId: 214;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Avoided Heating: Avoided total: (`dd01` = 477 kWh) */
readonly AVOIDED_HEATING_TOTAL: {
readonly propertyId: 215;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Avoided Cooling: Avoided actual: (`b901` = 441 -> 4.41 W) */
readonly AVOIDED_COOLING_ACTUAL: {
readonly propertyId: 216;
readonly dataType: PropertyDataType.CN_UINT16;
readonly convert: (v: any) => number;
};
/** Avoided Cooling: Avoided year-to-date: (`dd01` = 477 kWh) */
readonly AVOIDED_COOLING_YEAR_TO_DATE: {
readonly propertyId: 217;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Avoided Cooling: Avoided total: (`dd01` = 477 kWh) */
readonly AVOIDED_COOLING_TOTAL: {
readonly propertyId: 218;
readonly dataType: PropertyDataType.CN_UINT16;
};
/** Temperature & Humidity: Supply Air (`aa00` = 170 -> 17.0 °C) PostHeaterTempAfter */
readonly SUPPLY_AIR_TEMPERATURE: {
readonly propertyId: 221;
readonly dataType: PropertyDataType.CN_INT16;
readonly convert: (v: any) => number;
};
/** Bypass state (`64` = 100%) */
readonly BYPASS_STATE: {
readonly propertyId: 227;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Temperature & Humidity: Extract Air (`ab00` = 171 -> 17.1 °C) */
readonly EXTRACT_AIR_TEMPERATURE: {
readonly propertyId: 274;
readonly dataType: PropertyDataType.CN_INT16;
readonly convert: (v: any) => number;
};
/** Temperature & Humidity: Exhaust Air (`5600` = 86 -> 8.6 °C) */
readonly EXHAUST_AIR_TEMPERATURE: {
readonly propertyId: 275;
readonly dataType: PropertyDataType.CN_INT16;
readonly convert: (v: any) => number;
};
/** Temperature & Humidity: Outdoor Air (`3c00` = 60 -> 6.0 °C) */
readonly OUTDOOR_AIR_TEMPERATURE: {
readonly propertyId: 276;
readonly dataType: PropertyDataType.CN_INT16;
readonly convert: (v: any) => number;
};
/** Temperature & Humidity: Preheated Outdoor Air (`3c00` = 60 -> 6.0 °C) */
readonly PREHEATED_OUTDOOR_AIR_TEMPERATURE: {
readonly propertyId: 277;
readonly dataType: PropertyDataType.CN_INT16;
readonly convert: (v: any) => number;
};
/** PostHeaterTempBefore */
readonly POST_HEATER_TEMP_BEFORE: {
readonly propertyId: 278;
readonly dataType: PropertyDataType.CN_INT16;
readonly convert: (v: any) => number;
};
/** Temperature & Humidity: Extract Air (`31` = 49%) */
readonly EXTRACT_AIR_HUMIDITY: {
readonly propertyId: 290;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Temperature & Humidity: Exhaust Air (`57` = 87%) */
readonly EXHAUST_AIR_HUMIDITY: {
readonly propertyId: 291;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Temperature & Humidity: Outdoor Air (`43` = 67%) */
readonly OUTDOOR_AIR_HUMIDITY: {
readonly propertyId: 292;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Temperature & Humidity: Preheated Outdoor Air (`43` = 67%) */
readonly PREHEATED_OUTDOOR_AIR_HUMIDITY: {
readonly propertyId: 293;
readonly dataType: PropertyDataType.CN_UINT8;
};
/** Temperature & Humidity: Supply Air (`23` = 35%) */
readonly SUPPLY_AIR_HUMIDITY: {
readonly propertyId: 294;
readonly dataType: PropertyDataType.CN_UINT8;
};
readonly ANALOG_VOLTAGE_1: {
readonly propertyId: 513;
readonly dataType: PropertyDataType.CN_UINT16;
readonly convert: (v: any) => string;
};
readonly ANALOG_VOLTAGE_2: {
readonly propertyId: 514;
readonly dataType: PropertyDataType.CN_UINT16;
readonly convert: (v: any) => string;
};
readonly ANALOG_VOLTAGE_3: {
readonly propertyId: 515;
readonly dataType: PropertyDataType.CN_UINT16;
readonly convert: (v: any) => string;
};
readonly ANALOG_VOLTAGE_4: {
readonly propertyId: 516;
readonly dataType: PropertyDataType.CN_UINT16;
readonly convert: (v: any) => string;
};
/** ComfoCoolCompressor State */
readonly COMFOCOOL_COMPRESSOR_STATE: {
readonly propertyId: 785;
readonly dataType: PropertyDataType.CN_BOOL;
};
};
/**
* Get the value of a property from the data buffer.
* @param property The property to get the value for.
* @param data The data buffer to read the value from.
* @returns The value of the property.
*/
export declare function deserializePropertyValue<T extends {
dataType: PropertyDataType;
}>(property: T, data: Buffer): PropertyNativeType<T>;
export declare function deserializePropertyValue<T extends PropertyDataType>(dataType: T, data: Buffer): DeriveNativeDataType<T>;
/**
* Get the value of a property from the data buffer.
* @param property The property to get the value for.
* @param data The data buffer to read the value from.
* @returns The value of the property.
*/
export declare function serializePropertyValue<T extends {
dataType: PropertyDataType;
}>(property: T, value: PropertyNativeType<T>): Buffer;
export declare function serializePropertyValue<T extends PropertyDataType>(dataType: T, value: DeriveNativeDataType<T>): Buffer;
/**
* Get the property object by its propertyId.
* @param id The propertyId to get the property for.
* @returns The property object.
*/
export declare function getProperty(id: number): DeviceProperty | undefined;
/**
* Get the property name by its propertyId.
* @param id The propertyId to get the name for.
* @returns The property name.
*/
export declare function getPropertyName(id: number): string | undefined;
export {};