UNPKG

zigbee-herdsman-converters

Version:

Collection of device converters to be used with zigbee-herdsman

945 lines (944 loc) 122 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = exports.VZM36_ATTRIBUTES = exports.VZM35_ATTRIBUTES = exports.VZM32_MMWAVE_ATTRIBUTES = exports.VZM32_ATTRIBUTES = exports.VZM31_ATTRIBUTES = exports.VZM30_ATTRIBUTES = exports.INOVELLI = exports.MMWAVE_CLUSTER_NAME = exports.CLUSTER_NAME = void 0; const zigbee_herdsman_1 = require("zigbee-herdsman"); const enums_1 = require("zigbee-herdsman/dist/zspec/zcl/definition/enums"); const fz = __importStar(require("../converters/fromZigbee")); const tz = __importStar(require("../converters/toZigbee")); const exposes = __importStar(require("./exposes")); const m = __importStar(require("./modernExtend")); const reporting = __importStar(require("./reporting")); const utils = __importStar(require("./utils")); const e = exposes.presets; const ea = exposes.access; const clickLookup = { 0: "single", 1: "release", 2: "held", 3: "double", 4: "triple", 5: "quadruple", 6: "quintuple", }; const buttonLookup = { 1: "down", 2: "up", 3: "config", 4: "aux_down", 5: "aux_up", 6: "aux_config", }; const ledEffects = { off: 0, solid: 1, fast_blink: 2, slow_blink: 3, pulse: 4, chase: 5, open_close: 6, small_to_big: 7, aurora: 8, slow_falling: 9, medium_falling: 10, fast_falling: 11, slow_rising: 12, medium_rising: 13, fast_rising: 14, medium_blink: 15, slow_chase: 16, fast_chase: 17, fast_siren: 18, slow_siren: 19, clear_effect: 255, }; const individualLedEffects = { off: 0, solid: 1, fast_blink: 2, slow_blink: 3, pulse: 4, chase: 5, falling: 6, rising: 7, aurora: 8, clear_effect: 255, }; const mmWaveControlCommands = { reset_mmwave_module: 0, set_interference: 1, query_areas: 2, clear_interference: 3, reset_detection_area: 4, clear_stay_areas: 5, }; const INOVELLI_CLUSTER_NAME = "manuSpecificInovelli"; const INOVELLI_MMWAVE_CLUSTER_NAME = "manuSpecificInovelliMMWave"; exports.CLUSTER_NAME = INOVELLI_CLUSTER_NAME; exports.MMWAVE_CLUSTER_NAME = INOVELLI_MMWAVE_CLUSTER_NAME; exports.INOVELLI = 0x122f; const inovelliExtend = { addCustomCluster: () => m.deviceAddCustomCluster(INOVELLI_CLUSTER_NAME, { name: INOVELLI_CLUSTER_NAME, ID: 64561, manufacturerCode: 0x122f, attributes: { dimmingSpeedUpRemote: { name: "dimmingSpeedUpRemote", ID: 0x0001, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, dimmingSpeedUpLocal: { name: "dimmingSpeedUpLocal", ID: 0x0002, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, rampRateOffToOnRemote: { name: "rampRateOffToOnRemote", ID: 0x0003, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, rampRateOffToOnLocal: { name: "rampRateOffToOnLocal", ID: 0x0004, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, dimmingSpeedDownRemote: { name: "dimmingSpeedDownRemote", ID: 0x0005, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, dimmingSpeedDownLocal: { name: "dimmingSpeedDownLocal", ID: 0x0006, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, rampRateOnToOffRemote: { name: "rampRateOnToOffRemote", ID: 0x0007, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, rampRateOnToOffLocal: { name: "rampRateOnToOffLocal", ID: 0x0008, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, minimumLevel: { name: "minimumLevel", ID: 0x0009, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, maximumLevel: { name: "maximumLevel", ID: 0x000a, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, invertSwitch: { name: "invertSwitch", ID: 0x000b, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, autoTimerOff: { name: "autoTimerOff", ID: 0x000c, type: zigbee_herdsman_1.Zcl.DataType.UINT16, write: true, max: 0xffff }, defaultLevelLocal: { name: "defaultLevelLocal", ID: 0x000d, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLevelRemote: { name: "defaultLevelRemote", ID: 0x000e, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, stateAfterPowerRestored: { name: "stateAfterPowerRestored", ID: 0x000f, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, loadLevelIndicatorTimeout: { name: "loadLevelIndicatorTimeout", ID: 0x0011, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, activePowerReports: { name: "activePowerReports", ID: 0x0012, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, periodicPowerAndEnergyReports: { name: "periodicPowerAndEnergyReports", ID: 0x0013, type: zigbee_herdsman_1.Zcl.DataType.UINT16, write: true, max: 0xffff, }, activeEnergyReports: { name: "activeEnergyReports", ID: 0x0014, type: zigbee_herdsman_1.Zcl.DataType.UINT16, write: true, max: 0xffff }, powerType: { name: "powerType", ID: 0x0015, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, switchType: { name: "switchType", ID: 0x0016, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, quickStartTime: { name: "quickStartTime", ID: 0x0017, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, quickStartLevel: { name: "quickStartLevel", ID: 0x0018, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, higherOutputInNonNeutral: { name: "higherOutputInNonNeutral", ID: 0x0019, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, dimmingMode: { name: "dimmingMode", ID: 0x001a, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, dimmingAlgorithm: { name: "dimmingAlgorithm", ID: 0x001b, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, auxDetectionLevel: { name: "auxDetectionLevel", ID: 0x007c, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, dumbDetectionLevel: { name: "dumbDetectionLevel", ID: 0x00a5, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, nonNeutralAuxMediumGear: { name: "nonNeutralAuxMediumGear", ID: 0x001e, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, nonNeutralAuxLowGear: { name: "nonNeutralAuxLowGear", ID: 0x001f, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, internalTemperature: { name: "internalTemperature", ID: 0x0020, type: zigbee_herdsman_1.Zcl.DataType.INT8, write: true, max: 0xff }, overheat: { name: "overheat", ID: 0x0021, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, otaImageType: { name: "otaImageType", ID: 0x0022, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, buttonDelay: { name: "buttonDelay", ID: 0x0032, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, deviceBindNumber: { name: "deviceBindNumber", ID: 0x0033, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, smartBulbMode: { name: "smartBulbMode", ID: 0x0034, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, doubleTapUpToParam55: { name: "doubleTapUpToParam55", ID: 0x0035, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, doubleTapDownToParam56: { name: "doubleTapDownToParam56", ID: 0x0036, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, brightnessLevelForDoubleTapUp: { name: "brightnessLevelForDoubleTapUp", ID: 0x0037, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, brightnessLevelForDoubleTapDown: { name: "brightnessLevelForDoubleTapDown", ID: 0x0038, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff, }, defaultLed1ColorWhenOn: { name: "defaultLed1ColorWhenOn", ID: 0x003c, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed1ColorWhenOff: { name: "defaultLed1ColorWhenOff", ID: 0x003d, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed1IntensityWhenOn: { name: "defaultLed1IntensityWhenOn", ID: 0x003e, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed1IntensityWhenOff: { name: "defaultLed1IntensityWhenOff", ID: 0x003f, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed2ColorWhenOn: { name: "defaultLed2ColorWhenOn", ID: 0x0041, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed2ColorWhenOff: { name: "defaultLed2ColorWhenOff", ID: 0x0042, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed2IntensityWhenOn: { name: "defaultLed2IntensityWhenOn", ID: 0x0043, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed2IntensityWhenOff: { name: "defaultLed2IntensityWhenOff", ID: 0x0044, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed3ColorWhenOn: { name: "defaultLed3ColorWhenOn", ID: 0x0046, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed3ColorWhenOff: { name: "defaultLed3ColorWhenOff", ID: 0x0047, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed3IntensityWhenOn: { name: "defaultLed3IntensityWhenOn", ID: 0x0048, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed3IntensityWhenOff: { name: "defaultLed3IntensityWhenOff", ID: 0x0049, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed4ColorWhenOn: { name: "defaultLed4ColorWhenOn", ID: 0x004b, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed4ColorWhenOff: { name: "defaultLed4ColorWhenOff", ID: 0x004c, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed4IntensityWhenOn: { name: "defaultLed4IntensityWhenOn", ID: 0x004d, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed4IntensityWhenOff: { name: "defaultLed4IntensityWhenOff", ID: 0x004e, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed5ColorWhenOn: { name: "defaultLed5ColorWhenOn", ID: 0x0050, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed5ColorWhenOff: { name: "defaultLed5ColorWhenOff", ID: 0x0051, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed5IntensityWhenOn: { name: "defaultLed5IntensityWhenOn", ID: 0x0052, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed5IntensityWhenOff: { name: "defaultLed5IntensityWhenOff", ID: 0x0053, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed6ColorWhenOn: { name: "defaultLed6ColorWhenOn", ID: 0x0055, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed6ColorWhenOff: { name: "defaultLed6ColorWhenOff", ID: 0x0056, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed6IntensityWhenOn: { name: "defaultLed6IntensityWhenOn", ID: 0x0057, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed6IntensityWhenOff: { name: "defaultLed6IntensityWhenOff", ID: 0x0058, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed7ColorWhenOn: { name: "defaultLed7ColorWhenOn", ID: 0x005a, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed7ColorWhenOff: { name: "defaultLed7ColorWhenOff", ID: 0x005b, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed7IntensityWhenOn: { name: "defaultLed7IntensityWhenOn", ID: 0x005c, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, defaultLed7IntensityWhenOff: { name: "defaultLed7IntensityWhenOff", ID: 0x005d, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, ledColorWhenOn: { name: "ledColorWhenOn", ID: 0x005f, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, ledColorWhenOff: { name: "ledColorWhenOff", ID: 0x060, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, ledIntensityWhenOn: { name: "ledIntensityWhenOn", ID: 0x0061, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, ledIntensityWhenOff: { name: "ledIntensityWhenOff", ID: 0x0062, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, ledBarScaling: { name: "ledBarScaling", ID: 0x0064, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, mmwaveControlWiredDevice: { name: "mmwaveControlWiredDevice", ID: 0x006e, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, mmWaveRoomSizePreset: { name: "mmWaveRoomSizePreset", ID: 0x0075, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, singleTapBehavior: { name: "singleTapBehavior", ID: 0x0078, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, fanTimerMode: { name: "fanTimerMode", ID: 0x0079, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, auxSwitchUniqueScenes: { name: "auxSwitchUniqueScenes", ID: 0x007b, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, bindingOffToOnSyncLevel: { name: "bindingOffToOnSyncLevel", ID: 0x007d, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, breezeMode: { name: "breezeMode", ID: 0x0081, type: zigbee_herdsman_1.Zcl.DataType.UINT32, write: true, max: 0xffffffff }, fanControlMode: { name: "fanControlMode", ID: 0x0082, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, lowLevelForFanControlMode: { name: "lowLevelForFanControlMode", ID: 0x0083, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, mediumLevelForFanControlMode: { name: "mediumLevelForFanControlMode", ID: 0x0084, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, highLevelForFanControlMode: { name: "highLevelForFanControlMode", ID: 0x0085, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, ledColorForFanControlMode: { name: "ledColorForFanControlMode", ID: 0x0086, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, localProtection: { name: "localProtection", ID: 0x0100, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, remoteProtection: { name: "remoteProtection", ID: 0x0101, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, outputMode: { name: "outputMode", ID: 0x0102, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, onOffLedMode: { name: "onOffLedMode", ID: 0x0103, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, firmwareUpdateInProgressIndicator: { name: "firmwareUpdateInProgressIndicator", ID: 0x0104, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, relayClick: { name: "relayClick", ID: 0x105, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, doubleTapClearNotifications: { name: "doubleTapClearNotifications", ID: 0x106, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, write: true }, fanLedLevelType: { name: "fanLedLevelType", ID: 0x0107, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, }, commands: { ledEffect: { name: "ledEffect", ID: 1, parameters: [ { name: "effect", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }, { name: "color", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }, { name: "level", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }, { name: "duration", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }, ], }, energyReset: { name: "energyReset", ID: 2, parameters: [], }, individualLedEffect: { name: "individualLedEffect", ID: 3, parameters: [ { name: "led", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }, { name: "effect", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }, { name: "color", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }, { name: "level", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }, { name: "duration", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }, ], }, ledEffectComplete: { name: "ledEffectComplete", ID: 0x24, parameters: [{ name: "notificationType", type: zigbee_herdsman_1.Zcl.DataType.INT8, min: -128 }], }, }, commandsResponse: {}, }), addCustomMMWaveCluster: () => { const mmWaveCommandAreaParameters = [ { name: "areaId", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 3 }, { name: "xMin", type: zigbee_herdsman_1.Zcl.DataType.INT16, min: -600, max: 600 }, { name: "xMax", type: zigbee_herdsman_1.Zcl.DataType.INT16, min: -600, max: 600 }, { name: "yMin", type: zigbee_herdsman_1.Zcl.DataType.INT16, min: -600, max: 600 }, { name: "yMax", type: zigbee_herdsman_1.Zcl.DataType.INT16, min: -600, max: 600 }, { name: "zMin", type: zigbee_herdsman_1.Zcl.DataType.INT16, min: -600, max: 600 }, { name: "zMax", type: zigbee_herdsman_1.Zcl.DataType.INT16, min: -600, max: 600 }, ]; const mmWaveCommandResponseAreaParameters = [ { name: "count", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "xMin1", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "xMax1", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "yMin1", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "yMax1", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "zMin1", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "zMax1", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "xMin2", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "xMax2", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "yMin2", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "yMax2", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "zMin2", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "zMax2", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "xMin3", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "xMax3", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "yMin3", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "yMax3", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "zMin3", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "zMax3", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "xMin4", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "xMax4", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "yMin4", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "yMax4", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "zMin4", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, { name: "zMax4", type: zigbee_herdsman_1.Zcl.DataType.INT16 }, ]; return m.deviceAddCustomCluster(INOVELLI_MMWAVE_CLUSTER_NAME, { name: INOVELLI_MMWAVE_CLUSTER_NAME, ID: 64562, // 0xfc32 manufacturerCode: 0x122f, attributes: { mmWaveHoldTime: { name: "mmWaveHoldTime", ID: 0x0072, type: zigbee_herdsman_1.Zcl.DataType.UINT32, write: true, max: 0xffffffff }, mmWaveDetectSensitivity: { name: "mmWaveDetectSensitivity", ID: 0x0070, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, mmWaveDetectTrigger: { name: "mmWaveDetectTrigger", ID: 0x0071, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, mmWaveTargetInfoReport: { name: "mmWaveTargetInfoReport", ID: 0x006b, type: zigbee_herdsman_1.Zcl.DataType.UINT8, write: true, max: 0xff }, mmWaveStayLife: { name: "mmWaveStayLife", ID: 0x006c, type: zigbee_herdsman_1.Zcl.DataType.UINT32, write: true, max: 0xffffffff }, mmWaveVersion: { name: "mmWaveVersion", ID: 0x0073, type: zigbee_herdsman_1.Zcl.DataType.UINT32, write: true, max: 0xffffffff }, mmWaveHeightMin: { name: "mmWaveHeightMin", ID: 0x0065, type: zigbee_herdsman_1.Zcl.DataType.INT16, write: true, min: -32768 }, mmWaveHeightMax: { name: "mmWaveHeightMax", ID: 0x0066, type: zigbee_herdsman_1.Zcl.DataType.INT16, write: true, min: -32768 }, mmWaveWidthMin: { name: "mmWaveWidthMin", ID: 0x0067, type: zigbee_herdsman_1.Zcl.DataType.INT16, write: true, min: -32768 }, mmWaveWidthMax: { name: "mmWaveWidthMax", ID: 0x0068, type: zigbee_herdsman_1.Zcl.DataType.INT16, write: true, min: -32768 }, mmWaveDepthMin: { name: "mmWaveDepthMin", ID: 0x0069, type: zigbee_herdsman_1.Zcl.DataType.INT16, write: true, min: -32768 }, mmWaveDepthMax: { name: "mmWaveDepthMax", ID: 0x006a, type: zigbee_herdsman_1.Zcl.DataType.INT16, write: true, min: -32768 }, }, commands: { mmWaveControl: { name: "mmWaveControl", ID: 0, parameters: [{ name: "controlID", type: zigbee_herdsman_1.Zcl.DataType.UINT8, max: 0xff }], }, setInterferenceArea: { name: "setInterferenceArea", ID: 1, parameters: mmWaveCommandAreaParameters, }, setDetectionArea: { name: "setDetectionArea", ID: 2, parameters: mmWaveCommandAreaParameters, }, setStayArea: { name: "setStayArea", ID: 3, parameters: mmWaveCommandAreaParameters, }, }, commandsResponse: { anyoneInReportingArea: { name: "anyoneInReportingArea", ID: 0, parameters: [ { name: "area1", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "area2", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "area3", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "area4", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, ], }, reportTargetInfo: { name: "reportTargetInfo", ID: 1, parameters: [ { name: "targetNum", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "targets", type: enums_1.BuffaloZclDataType.BUFFER }, ], }, reportInterferenceArea: { name: "reportInterferenceArea", ID: 2, parameters: mmWaveCommandResponseAreaParameters, }, reportDetectionArea: { name: "reportDetectionArea", ID: 3, parameters: mmWaveCommandResponseAreaParameters, }, reportStayArea: { name: "reportStayArea", ID: 4, parameters: mmWaveCommandResponseAreaParameters, }, }, }); }, device: ({ model, attrs, supportsLedEffects, supportsButtonTaps, splitValuesByEndpoint = false, }) => { // biome-ignore lint/suspicious/noExplicitAny: generic const fromZigbee = []; const toZigbee = []; const staticExposes = []; if (supportsLedEffects) { fromZigbee.push(fzLocal.led_effect_complete); toZigbee.push(tzLocal.inovelli_led_effect, tzLocal.inovelli_individual_led_effect); staticExposes.push(exposeLedEffects(), exposeIndividualLedEffects(), exposeLedEffectComplete()); } if (supportsButtonTaps) { staticExposes.push(e.action(BUTTON_TAP_SEQUENCES)); } for (const attr of attrs) { fromZigbee.push(fzLocal.inovelli(attr.attributes, attr.clusterName, splitValuesByEndpoint, model)); toZigbee.push(tzLocal.inovelli_parameters(attr.attributes, attr.clusterName, model), tzLocal.inovelli_parameters_readOnly(attr.attributes, attr.clusterName)); } const dynamicExposes = (device, _options) => { const result = []; if (utils.isDummyDevice(device)) { for (const attr of attrs) { attributesToExposeList(adjustAttributesForDevice(attr.attributes, model), result); } } else { const fw = device.softwareBuildID ? parseFirmwareVersion(device.softwareBuildID) : undefined; for (const attr of attrs) { attributesToExposeList(adjustAttributesForDevice(attr.attributes, model, fw), result); } } return result; }; const configure = [ async (device, coordinatorEndpoint, definition) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, [INOVELLI_CLUSTER_NAME]); // Bind for Button Event Reporting const endpoint2 = device.getEndpoint(2); await reporting.bind(endpoint2, coordinatorEndpoint, [INOVELLI_CLUSTER_NAME]); const fw = device.softwareBuildID ? parseFirmwareVersion(device.softwareBuildID) : undefined; for (const attr of attrs) { const filtered = adjustAttributesForDevice(attr.attributes, model, fw); if (!splitValuesByEndpoint) { await chunkedRead(endpoint, Object.keys(filtered), attr.clusterName); } else { await chunkedRead(endpoint, Object.keys(filtered).flatMap((key) => { const keysplit = key.split("_"); if (keysplit.length === 2) { if (Number(keysplit[1]) === 1) { return [keysplit[0]]; } return []; } return [key]; }), attr.clusterName); await chunkedRead(endpoint2, Object.keys(filtered).flatMap((key) => { const keysplit = key.split("_"); if (keysplit.length === 2) { if (Number(keysplit[1]) === 2) { return [keysplit[0]]; } } return []; }), attr.clusterName); } } }, ]; return { fromZigbee, toZigbee, exposes: [...staticExposes, dynamicExposes], configure, isModernExtend: true, }; }, light: ({ splitValuesByEndpoint = false } = {}) => { // biome-ignore lint/suspicious/noExplicitAny: generic const fromZigbee = [fzLocal.on_off_for_endpoint(1, "state"), fzLocal.brightness]; if (!splitValuesByEndpoint) { fromZigbee.push(fz.level_config, fz.power_on_behavior); } const configure = [ async (device, coordinatorEndpoint, definition) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ["genOnOff", "genLevelCtrl"]); await reporting.onOff(endpoint); }, ]; return { fromZigbee, toZigbee: [ tzLocal.light_onoff_brightness_inovelli, tz.power_on_behavior, tz.ignore_transition, tz.light_brightness_move, tz.light_brightness_step, tz.level_config, ], exposes: [e.light_brightness()], configure, isModernExtend: true, }; }, fan: ({ endpointId, splitValuesByEndpoint = false }) => { return { fromZigbee: [fzLocal.fan_mode(endpointId), fzLocal.breeze_mode(endpointId), fzLocal.fan_state(endpointId)], toZigbee: [tzLocal.fan_mode(endpointId), tzLocal.breezeMode(endpointId), tzLocal.fan_state(endpointId)], exposes: [e.fan().withState("fan_state").withModes(Object.keys(FAN_MODES)), exposeBreezeMode()], configure: [ async (device, coordinatorEndpoint, definition) => { const endpoint = device.getEndpoint(endpointId); await reporting.bind(endpoint, coordinatorEndpoint, ["genOnOff", "genLevelCtrl"]); await reporting.onOff(endpoint); }, ], isModernExtend: true, }; }, mmWave: () => { const configure = [ async (device, coordinatorEndpoint, definition) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, [INOVELLI_MMWAVE_CLUSTER_NAME]); await endpoint.command(INOVELLI_MMWAVE_CLUSTER_NAME, "mmWaveControl", { controlID: mmWaveControlCommands.query_areas, }, { disableResponse: true, disableDefaultResponse: true }); }, ]; return { fromZigbee: [fzLocal.anyone_in_reporting_area, fzLocal.report_areas, fzLocal.report_target_info], toZigbee: [ tzLocal.inovelli_mmwave_control_commands, tzLocal.mmwave_detection_areas, tzLocal.mmwave_interference_areas, tzLocal.mmwave_stay_areas, ], exposes: [ exposeMMWaveControl(), ...exposeMMWaveAreas(), exposeInterferenceAreas(), exposeDetectionAreas(), exposeStayAreas(), exposeMMWaveTargets(), ], configure: configure, isModernExtend: true, }; }, energyReset: () => { return { fromZigbee: [], toZigbee: [tzLocal.inovelli_energy_reset], exposes: [exposeEnergyReset()], configure: [], isModernExtend: true, }; }, }; exports.m = inovelliExtend; const FAN_MODES = { off: 0, low: 2, smart: 4, medium: 86, high: 170, on: 255 }; const BREEZE_MODES = ["off", "low", "medium", "high"]; const LED_NOTIFICATION_TYPES = { 0: "LED_1", 1: "LED_2", 2: "LED_3", 3: "LED_4", 4: "LED_5", 5: "LED_6", 6: "LED_7", 16: "ALL_LEDS", "-1": "CONFIG_BUTTON_DOUBLE_PRESS", }; // Converts brightness level to a fan mode const intToFanMode = (value) => { let selectedMode = "low"; if (value >= FAN_MODES.low) { selectedMode = "low"; } if (value >= FAN_MODES.medium) { selectedMode = "medium"; } if (value >= FAN_MODES.high) { selectedMode = "high"; } if (value === 4) { selectedMode = "smart"; } if (value === 0) { selectedMode = "off"; } return selectedMode; }; /** * Convert speed string to int needed for breeze mode calculation. * @param speedIn - speed string * @returns low = 1, medium = 2, high = 3, off = 0 */ const speedToInt = (speedIn) => { switch (speedIn) { case "low": return 1; case "medium": return 2; case "high": return 3; default: return 0; } }; const parseFirmwareVersion = (version) => { const match = version.match(/(\d+)\.(\d+)/); if (!match) return undefined; return [Number.parseInt(match[1], 10), Number.parseInt(match[2], 10)]; }; const fwGte = (firmware, target) => { return firmware[0] > target[0] || (firmware[0] === target[0] && firmware[1] >= target[1]); }; const resolveValueMap = (attr, model) => { if (!attr.modelValues) return undefined; const entry = model ? attr.modelValues[model] : undefined; return entry?.values ?? attr.modelValues.default.values; }; const adjustAttributesForDevice = (attributes, model, firmware) => { const result = {}; for (const [key, attr] of Object.entries(attributes)) { if (attr.addedInFirmware) { const threshold = attr.addedInFirmware[model]; if (!threshold) continue; if (firmware && !fwGte(firmware, threshold)) continue; } if (attr.modelValues) { const entry = attr.modelValues[model] ?? attr.modelValues.default; const baseValues = { ...(entry.values ?? attr.modelValues.default.values) }; if (firmware && entry.conditionalValues) { for (const [valueName, constraint] of Object.entries(entry.conditionalValues)) { if (!(valueName in baseValues)) continue; if (constraint.addedInFirmware && !fwGte(firmware, constraint.addedInFirmware)) { delete baseValues[valueName]; } if (constraint.removedInFirmware && fwGte(firmware, constraint.removedInFirmware)) { delete baseValues[valueName]; } } } const { modelValues: _, ...rest } = attr; result[key] = { ...rest, values: baseValues }; continue; } result[key] = attr; } return result; }; // Create Expose list with Inovelli Parameters definitions const attributesToExposeList = (attributes, exposesList) => { Object.keys(attributes).forEach((key) => { if (attributes[key].displayType === "enum") { const enumE = e .enum(key, attributes[key].readOnly ? ea.STATE_GET : ea.ALL, Object.keys(attributes[key].values ?? {})) .withDescription(attributes[key].description); if (!attributes[key].readOnly) { enumE.withCategory(attributes[key].category ?? "config"); } exposesList.push(enumE); } else if (attributes[key].displayType === "binary" || attributes[key].displayType === "switch") { const binary = e .binary(key, attributes[key].readOnly ? ea.STATE_GET : ea.ALL, // @ts-expect-error ignore attributes[key].values.Enabled, attributes[key].values.Disabled) .withDescription(attributes[key].description); if (!attributes[key].readOnly) { binary.withCategory(attributes[key].category ?? "config"); } exposesList.push(binary); } else { const numeric = e .numeric(key, attributes[key].readOnly ? ea.STATE_GET : ea.ALL) .withValueMin(attributes[key].min) .withValueMax(attributes[key].max); if (attributes[key].values) { Object.keys(attributes[key].values).forEach((value) => { numeric.withPreset(value, attributes[key].values[value], ""); }); } if (attributes[key].unit) { numeric.withUnit(attributes[key].unit); } numeric.withDescription(attributes[key].description); if (!attributes[key].readOnly) { numeric.withCategory(attributes[key].category ?? "config"); } exposesList.push(numeric); } }); }; /** * Attribute composition: COMMON_ATTRIBUTES is the base; COMMON_DIMMER_*, COMMON_DIMMABLE_LIGHT_*, * COMMON_DIMMER_ON_OFF_* extend it; VZM*_ATTRIBUTES are device-specific compositions. Only VZM* are exported. */ /** * Common Attributes * * These attributes are shared between all devices with the manufacturer specific Inovelli cluster * Some of the descriptions, max, min or value properties may be overridden for each device */ const COMMON_ATTRIBUTES = { dimmingSpeedUpRemote: { ID: 1, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 127, description: "This changes the speed that the light dims up when controlled from the hub. " + "A setting of 0 turns the light immediately on. Increasing the value slows down the transition speed. " + "Every number represents 100ms. Default = 25 (2.5s)", }, dimmingSpeedUpLocal: { ID: 2, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 127, description: "This changes the speed that the light dims up when controlled at the switch. " + "A setting of 0 turns the light immediately on. Increasing the value slows down the transition speed. " + "Every number represents 100ms. Default = 127 - Keep in sync with dimmingSpeedUpRemote setting.", }, rampRateOffToOnRemote: { ID: 3, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 127, description: "This changes the speed that the light turns on when controlled from the hub. " + "A setting of 0 turns the light immediately on. Increasing the value slows down the transition speed. " + "Every number represents 100ms. Default = 127 - Keep in sync with dimmingSpeedUpRemote setting.", }, rampRateOffToOnLocal: { ID: 4, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 127, description: "This changes the speed that the light turns on when controlled at the switch. " + "A setting of 0 turns the light immediately on. Increasing the value slows down the transition speed. " + "Every number represents 100ms. Default = 127 - Keep in sync with dimmingSpeedUpRemote setting.", }, dimmingSpeedDownRemote: { ID: 5, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 127, description: "This changes the speed that the light dims down when controlled from the hub. " + "A setting of 0 turns the light immediately off. Increasing the value slows down the transition speed. " + "Every number represents 100ms. Default = 127 - Keep in sync with dimmingSpeedUpRemote setting.", }, dimmingSpeedDownLocal: { ID: 6, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 127, description: "This changes the speed that the light dims down when controlled at the switch. " + "A setting of 0 turns the light immediately off. Increasing the value slows down the transition speed. " + "Every number represents 100ms. Default = 127 - Keep in sync with dimmingSpeedUpLocal setting.", }, rampRateOnToOffRemote: { ID: 7, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 127, description: "This changes the speed that the light turns off when controlled from the hub. " + "A setting of 'instant' turns the light immediately off. Increasing the value slows down the transition speed. " + "Every number represents 100ms. Default = 127 - Keep in sync with rampRateOffToOnRemote setting.", }, rampRateOnToOffLocal: { ID: 8, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 127, description: "This changes the speed that the light turns off when controlled at the switch. " + "A setting of 'instant' turns the light immediately off. Increasing the value slows down the transition speed. " + "Every number represents 100ms. Default = 127 - Keep in sync with rampRateOffToOnLocal setting.", }, invertSwitch: { ID: 11, dataType: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, displayType: "enum", modelValues: { default: { values: { Yes: 1, No: 0 } } }, min: 0, max: 1, description: "Inverts the orientation of the switch." + " Useful when the switch is installed upside down. Essentially up becomes down and down becomes up.", }, autoTimerOff: { ID: 12, min: 0, max: 32767, dataType: zigbee_herdsman_1.Zcl.DataType.UINT16, unit: "seconds", modelValues: { default: { values: { Disabled: 0 } } }, description: "Automatically turns the switch off after this many seconds." + " When the switch is turned on a timer is started. When the timer expires, the switch is turned off. 0 = Auto off is disabled.", }, defaultLevelLocal: { ID: 13, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 255, description: "Default level for the load when it is turned on at the switch." + " A setting of 255 means that the switch will return to the level that it was on before it was turned off.", }, defaultLevelRemote: { ID: 14, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 255, description: "Default level for the load when it is turned on from the hub." + " A setting of 255 means that the switch will return to the level that it was on before it was turned off.", }, stateAfterPowerRestored: { ID: 15, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 255, description: "The state the switch should return to when power is restored after power failure. 0 = off, 1-254 = level, 255 = previous.", }, loadLevelIndicatorTimeout: { ID: 17, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, description: "Shows the level that the load is at for x number of seconds after the load is adjusted" + " and then returns to the Default LED state. 0 = Stay Off, 1-10 = seconds, 11 = Stay On.", displayType: "enum", modelValues: { default: { values: { "Stay Off": 0, "1 Second": 1, "2 Seconds": 2, "3 Seconds": 3, "4 Seconds": 4, "5 Seconds": 5, "6 Seconds": 6, "7 Seconds": 7, "8 Seconds": 8, "9 Seconds": 9, "10 Seconds": 10, "Stay On": 11, }, }, }, min: 0, max: 11, }, switchType: { ID: 22, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, displayType: "enum", modelValues: { default: { values: { "Single Pole": 0, "Aux Switch": 1 } }, ["VZM31-SN" /* Model.VZM31 */]: { values: { "Single Pole": 0, "3-Way Dumb Switch": 1, "3-Way Aux Switch": 2, "Single-Pole Full Sine Wave": 3 }, conditionalValues: { "Single-Pole Full Sine Wave": { removedInFirmware: [3, 0] } }, }, }, min: 0, max: 3, description: "Set the switch configuration.", }, internalTemperature: { ID: 32, dataType: zigbee_herdsman_1.Zcl.DataType.INT8, min: 0, max: 127, readOnly: true, description: "The temperature measured by the temperature sensor inside the chip, in degrees Celsius", category: "diagnostic", unit: "°C", }, overheat: { ID: 33, dataType: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, displayType: "enum", modelValues: { default: { values: { "No Alert": 0, Overheated: 1 } } }, min: 0, max: 1, readOnly: true, description: "Indicates if the internal chipset is currently in an overheated state.", }, buttonDelay: { ID: 50, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, modelValues: { default: { values: { "0ms": 0, "100ms": 1, "200ms": 2, "300ms": 3, "400ms": 4, "500ms": 5, "600ms": 6, "700ms": 7, "800ms": 8, "900ms": 9, }, }, }, displayType: "enum", min: 0, max: 9, description: "This will set the button press delay. 0 = no delay (Disables Button Press Events), Default = 500ms.", }, deviceBindNumber: { ID: 51, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, readOnly: true, description: "The number of devices currently bound (excluding gateways) and counts one group as two devices", }, smartBulbMode: { ID: 52, dataType: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, displayType: "enum", modelValues: { default: { values: { Disabled: 0, "Smart Bulb Mode": 1 } }, ["VZM35-SN" /* Model.VZM35 */]: { values: { Disabled: 0, "Smart Fan Mode": 1 } }, }, description: "For use with Smart Bulbs that need constant power and are controlled via commands rather than power.", }, doubleTapUpToParam55: { ID: 53, dataType: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, displayType: "enum", modelValues: { default: { values: { Disabled: 0, Enabled: 1 } } }, description: "Enable or Disable setting level to parameter 55 on double-tap UP.", }, doubleTapDownToParam56: { ID: 54, dataType: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, displayType: "enum", modelValues: { default: { values: { Disabled: 0, Enabled: 1 } } }, description: "Enable or Disable setting level to parameter 56 on double-tap DOWN.", }, brightnessLevelForDoubleTapUp: { ID: 55, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 2, max: 255, description: "Set this level on double-tap UP (if enabled by P53). 255 = send ON command.", }, brightnessLevelForDoubleTapDown: { ID: 56, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 255, description: "Set this level on double-tap DOWN (if enabled by P54). 255 = send OFF command.", }, ledColorWhenOn: { ID: 95, dataType: zigbee_herdsman_1.Zcl.DataType.UINT8, min: 0, max: 255, modelValues: { default: { values: { Red: 0, Orange: 21, Yellow: 42, Green: 85, Cyan: 127,