UNPKG

zigbee-herdsman-converters

Version:

Collection of device converters to be used with zigbee-herdsman

866 lines 125 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.definitions = void 0; const zigbee_herdsman_1 = require("zigbee-herdsman"); const tz = __importStar(require("../converters/toZigbee")); const exposes = __importStar(require("../lib/exposes")); const logger_1 = require("../lib/logger"); const m = __importStar(require("../lib/modernExtend")); const utils = __importStar(require("../lib/utils")); // #region Constants const e = exposes.presets; const ea = exposes.access; // const manufacturerOptions = {manufacturerCode: Zcl.ManufacturerCode.YOKIS}; const NS = "zhc:yokis"; // stateAfterBlinkEnum (manuSpecificYokisLightControl) const stateAfterBlinkEnum = { previous: 0x00, off: 0x01, on: 0x02, infinite: 0x03, }; // resetActionEnum (manuSpecificYokisDevice) const resetActionEnum = { factory_reset: 0x00, configuration_reset: 0x01, network_reset: 0x02, }; // inputModeEnum (manuSpecificYokisInput) const inputModeEnum = { unknown: 0x00, push_button: 0x01, // default switch: 0x02, relay: 0x03, fp_in: 0x04, // Fil pilote }; // #endregion // #region Custom cluster definition const YokisClustersDefinition = { manuSpecificYokisDevice: { ID: 0xfc01, manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: { // Indicate if the device configuration has changed. 0 to 0xFFFE -> No Change, 0xFFFF -> Change have been detected configurationChanged: { ID: 0x0005, type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, }, commands: { // Reset setting depending on RESET ACTION value resetToFactorySettings: { ID: 0x00, response: 0, parameters: [ // 0x00 -> Factory reset, 0x01 -> Configuration Reset, 0x02 -> Network Reset { name: "uc_ResetAction", type: zigbee_herdsman_1.Zcl.DataType.INT8 }, ], }, // Relaunch BLE advertising for 15 minutes relaunchBleAdvert: { ID: 0x11, response: 0, parameters: [], }, // Open ZigBee network openNetwork: { ID: 0x12, response: 0, parameters: [ // Opening time wanted from 1 to 255 seconds,0 means closing the network. { name: "uc_OpeningTime", type: zigbee_herdsman_1.Zcl.DataType.INT8 }, ], }, }, commandsResponse: {}, }, manuSpecificYokisInput: { ID: 0xfc02, manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: { // Indicate how the input should be handle: 0 -> Unknown, 1 -> Push button, 2 -> Switch, 3 -> Relay, 4 -> FP_IN inputMode: { ID: 0x0000, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Indicate the contact nature of the entry: 0 -> NC, 1 -> NO contactMode: { ID: 0x0001, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Indicate the last known state of the local BP (Bouton Poussoir, or Push Button) lastLocalCommandState: { ID: 0x0002, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Indicate the last known state of the Bp connect lastBPConnectState: { ID: 0x0003, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Indicate the backlight intensity applied on the keys. Only use for “Simon” product. Default: 0x0A, Min-Max: 0x00 - 0x64 backlightIntensity: { ID: 0x0004, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, }, commands: { // Send to the server cluster a button press sendPress: { ID: 0x00, parameters: [], }, // Send to the server cluster a button release sendRelease: { ID: 0x01, parameters: [], }, // Change the Input mode to use switch input, wired relay or simple push button selectInputMode: { ID: 0x02, parameters: [ // Input mode to be set. See @inputMode { name: "uc_InputMode", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, ], }, }, commandsResponse: {}, }, manuSpecificYokisEntryConfigurator: { ID: 0xfc03, manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: { // Use to enable short press action eShortPress: { ID: 0x0001, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Use to enable long press action eLongPress: { ID: 0x0002, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Define long Press duration in milliseconds. Default: 0x0BB8, Min-Max: 0x00 - 0x1388 longPressDuration: { ID: 0x0003, type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, // Define the maximum time between 2 press to keep in a sequence (In milliseconds). Default: 0x01F4, Min-Max: 0x0064 - 0x0258 timeBetweenPress: { ID: 0x0004, type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, // Enable R12M Long Press action eR12MLongPress: { ID: 0x0005, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Disable local configuration eLocalConfigLock: { ID: 0x0006, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, }, commands: {}, commandsResponse: {}, }, manuSpecificYokisSubSystem: { ID: 0xfc04, manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: { // Define the device behavior after power failure : 0 -> LAST STATE, 1 -> OFF, 2 -> ON, 3-> BLINK powerFailureMode: { ID: 0x0001, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, }, commands: {}, commandsResponse: {}, }, manuSpecificYokisLoadManager: { ID: 0xfc05, // Details coming soon manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: {}, commands: {}, commandsResponse: {}, }, manuSpecificYokisLightControl: { ID: 0xfc06, manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: { // Use to know which state is the relay onOff: { ID: 0x0000, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Indicate the previous state before action prevState: { ID: 0x0001, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Define the ON embedded timer duration in seconds. Default: 0x00, Min-Max: 0x00 – 0x00409980 onTimer: { ID: 0x0002, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Enable (0x01) / Disable (0x00) use of onTimer. eOnTimer: { ID: 0x0003, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Define the PRE-ON embedded delay in seconds. Default: 0x00, Min-Max: 0x00 – 0x00409980 preOnDelay: { ID: 0x0004, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Enable (0x01) / Disable (0x00) use of PreOnTimer. ePreOnDelay: { ID: 0x0005, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Define the PRE-OFF embedded delay in seconds. Default: 0x00, Min-Max: 0x00 – 0x00409980 preOffDelay: { ID: 0x0008, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Enable (0x01) / Disable (0x00) PreOff delay. ePreOffDelay: { ID: 0x0009, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Set the value of ON pulse length. Default: 0x01F4, Min-Max: 0x0014 – 0xFFFE pulseDuration: { ID: 0x000a, type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, // Indicates the current Type of time selected that will be used during push button configuration: 0x00 -> Seconds, 0x01 -> Minutes timeType: { ID: 0x000b, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Set the value of the LONG ON embedded timer in seconds. Default: 0x5460 (1h), Min-Max: 0x00 – 0x00409980 longOnDuration: { ID: 0x000c, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Indicates the operating mode: 0x00 -> Timer, 0x01 -> Staircase, 0x02 -> Pulse operatingMode: { ID: 0x000d, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Time before goes off after the stop announce blinking. (In seconds). Default: 0x0000, Min-Max: 0x00 – 0x00409980 stopAnnounceTime: { ID: 0x0013, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Enable (0x01) / Disable (0x00) the announcement before turning OFF. eStopAnnounce: { ID: 0x0014, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Enable (0x01) / Disable (0x00) Deaf Actions. eDeaf: { ID: 0x0015, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Enable (0x01) / Disable (0x00) Blink Actions. eBlink: { ID: 0x0016, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // Number of blinks done when receiving the corresponding order. One blink is considered as one ON step followed by one OFF step. // Default: 0x03, Min-Max: 0x00 – 0x14 blinkAmount: { ID: 0x0017, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Duration for the ON time on a blink period (In millisecond). Default: 0x000001F4, Min-Max: 0x00 – 0x00409980 blinkOnTime: { ID: 0x0018, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Duration for the OFF time on a blink period (In millisecond). Default: 0x000001F4, Min-Max: 0x00 – 0x00409980 blinkOffTime: { ID: 0x0019, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Define number of blink to do when receiving the DEAF action. One blink is considered as one ON step followed by one OFF step. // Default: 0x03, Min-Max: 0x00 – 0x14 deafBlinkAmount: { ID: 0x001a, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Define duration of a blink ON (In millisecond). Default: 0x0320, Min-Max: 0x0064– 0x4E20 deafBlinkTime: { ID: 0x001b, type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, // Indicate which state must be apply after a blink sequence: 0x00 -> State before blinking, 0x01 -> OFF, 0x02 -> ON stateAfterBlink: { ID: 0x001c, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Define the output relay as Normaly close. eNcCommand: { ID: 0x001d, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, }, commands: { // Move to position specified in uc_BrightnessEnd parameter. // If TOR mode or MTR is set (no dimming) : if uc_BrightnessEnd under 50% will set to OFF else will be set to ON moveToPosition: { ID: 0x02, parameters: [ { name: "uc_BrightnessStart", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "uc_BrightnessEnd", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "ul_PreTimerValue", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, { name: "b_PreTimerEnable", type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, { name: "ul_TimerValue", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, { name: "b_TimerEnable", type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, { name: "ul_TransitionTime", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, ], }, // This command allows the relay to be controlled with an impulse. The pulse time is defined by PulseLength. pulse: { ID: 0x04, parameters: [{ name: "PulseLength", type: zigbee_herdsman_1.Zcl.DataType.UINT16 }], }, // With this command, the module is asked to perform a blinking sequence. blink: { ID: 0x05, parameters: [ { name: "uc_BlinkAmount", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "ul_BlinkOnPeriod", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, { name: "ul_BlinkOffPeriod", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, { name: "uc_StateAfterSequence", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "b_DoPeriodicCycle", type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, ], }, // Start a deaf sequence on a device only if the attribute “eDeaf” is set to Enable. deafBlink: { ID: 0x06, parameters: [ { name: "uc_BlinkAmount", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "ul_BlinkOnTime", type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, { name: "uc_SequenceAmount", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, { name: "tuc_BlinkAmount", type: zigbee_herdsman_1.Zcl.DataType.ARRAY }, ], }, // Switch output ON for LONG ON DURATION time. longOn: { ID: 0x07, parameters: [], }, }, commandsResponse: {}, }, manuSpecificYokisDimmer: { ID: 0xfc07, manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: { // This attribute defines the current position, in %. Default: 0x00, Min-Max: 0x00 - 0x64 currentPosition: { ID: 0x0000, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the memory position, in %. Default: 0x00, Min-Max: 0x00 - 0x64 memoryPosition: { ID: 0x0001, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines if a ramp up should be used or not. eRampUp: { ID: 0x0002, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // This attribute defines the time taken during the ramp up in ms. Default: 0x000003E8, Min-Max: 0x00000000 – 0x05265C00 rampUp: { ID: 0x0003, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // This attribute defines if a ramp down should be used or not. eRampDown: { ID: 0x0004, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // This attribute defines the time taken during the ramp down in ms. Default: 0x000003E8, Min-Max: 0x00000000 – 0x05265C00 rampDown: { ID: 0x0005, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // This attribute defines the time taken during the ramp loop in ms. Default: 0x00000FA0, Min-Max: 0x00000000 – 0x05265C00 rampContinuousTime: { ID: 0x0006, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // This attribute defines the value of each step during a dimming up. This value is set in %. Default: 0x01, Min-Max: 0x00 - 0x64 stepUp: { ID: 0x0007, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the value of the low dim limit, used during a dimming loop, on a long press for example. This value is set in %. Default: 0x06, Min-Max: 0x00 - 0x64 lowDimLimit: { ID: 0x0008, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the value of the high dim limit, used during a dimming loop, on a long press for example. This value is set in %. Default: 0x64, Min-Max: 0x00 - 0x64 highDimLimit: { ID: 0x0009, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the time before the nightlight begin. This value is set in seconds. Default: 0x00000000, Min-Max: 0x00000000 – 0xFFFFFFFE nightLightStartingDelay: { ID: 0x000c, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // This attribute defines the dimming value at the start of the nightlight. This value is set in %. Default: 0x28, Min-Max: 0x00 - 0x64 nightLightStartingBrightness: { ID: 0x000d, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the dimming value at the last step of the nightlight. This attribute must be lower than 0x000D :Nightlight starting brightness. This value is set in %. Default: 0x05, Min-Max: 0x00 - 0x64 nightLightEndingBrightness: { ID: 0x000e, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the ramp duration of the nightlight. The ramp is running after the end of the starting delay and until the ending bright is reached. This value is set in seconds. Default: 0x00000E10, Min-Max: 0x00000000 – 0x05265C00 nightLightRampTime: { ID: 0x000f, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // This attribute defines the total duration of the nightlight. It must not be lower than 0x000F : Nightlight ramp time. This value is set in seconds. Default: 0x00000E10, Min-Max: 0x00000000 – 0x05265C00 nightLightOnTime: { ID: 0x0010, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // This attribute defines the value of the favorite position 1. This value is set in %. Default: 0x19, Min-Max: 0x00 - 0x64 favoritePosition1: { ID: 0x0011, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the value of the favorite position 2. This value is set in %. Default: 0x32, Min-Max: 0x00 - 0x64 favoritePosition2: { ID: 0x0012, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the value of the favorite position 3. This value is set in %. Default: 0x4B, Min-Max: 0x00 - 0x64 favoritePosition3: { ID: 0x0013, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute enables or disables the 2-step controller mode. This mode enable product to run without any ramp before and after ON or OFF. It acts like a relay. stepControllerMode: { ID: 0x0014, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // This attribute enables or disables the memory position mode at first push button release. memoryPositionMode: { ID: 0x0015, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN }, // This attribute defines the value of each step during a dimming down. This value is set in %. Default: 0x01, Min-Max: 0x01 - 0x64 stepDown: { ID: 0x0016, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the value of each step during a dimming loop. This value is set in %. Default: 0x01, Min-Max: 0x01 - 0x64 stepContinuous: { ID: 0x0017, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // This attribute defines the value of each step during the ramp down of the nightlight mode. This value is set in %. Default: 0x01, Min-Max: 0x01 - 0x64 stepNightLight: { ID: 0x0018, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, }, commands: { // Start dimming up, from current position to the upper dim limit. When the limit is reached, stay at this position. dimUp: { ID: 0x00, parameters: [], }, // Start dimming down, from current position to the lower dim limit. When the limit is reached, stay at this position. dimDown: { ID: 0x01, parameters: [], }, // Start the dimming loop process for the selected duration. dim: { ID: 0x02, parameters: [ // Set the duration of the ramp for the continuous variation, otherwise use 0xFFFFFFFF to use the one configured in the product. Value is in ms. { name: "ul_RampContinuousDuration", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Set the step size, otherwise use 0xFF to use the one configured in the product.. Value is in %. { name: "uc_StepContinuous", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, ], }, // Stop the actual dimming process. dimStop: { ID: 0x04, parameters: [], }, // Start dimming to the min value set in the device. dimToMin: { ID: 0x05, parameters: [ // Set the transition time to the selected value, otherwise use 0xFFFFFFFF to use the one configured in the product. Value is in ms. { name: "ul_TransitionTime", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, ], }, // Start dimming to the max value set in the device. dimToMax: { ID: 0x06, parameters: [ // Set the transition time to the selected value, otherwise use 0xFFFFFFFF to use the one configured in the product. Value is in ms. { name: "ul_TransitionTime", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, ], }, // Start the nightlight mode with the given parameters. startNightLightMode: { ID: 0x07, parameters: [ // Set the starting delay value, used before the start of the nightlight, otherwise use 0xFFFFFFFF to use the one configured in the product. Value is in ms. { name: "ul_ChildModeStartingDelay", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Set the brightness at the beginning of the ramp, otherwise use 0xFF to use the one configured in the product. Value is in %. { name: "uc_ChildModeBrightnessStart", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Set the brightness at the end of the ramp, otherwise use 0xFF to use the one configured in the product. Value is in %. { name: "uc_ChildModeBrightnessEnd", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Set the ramp duration, otherwise use 0xFFFFFFFF to use the one configured in the product. Value is in ms. { name: "ul_ChildModeRampDuration", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Set the total duration of the nightlight, otherwise use 0xFFFFFFFF to use the one configured in the product. Value is in ms. { name: "ul_ChildModeOnDuration", type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Set the step size between each dim, otherwise use 0xFF to use the one configured in the product. Value is in %. { name: "uc_ChildStep", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, ], }, // Start the nightlight mode from the current dimming value. startNightLightModeCurrent: { ID: 0x08, parameters: [], }, // Start dimming to the favorite position 1. moveToFavorite1: { ID: 0x09, parameters: [], }, // Start dimming to the favorite position 2. moveToFavorite2: { ID: 0x0a, parameters: [], }, // Start dimming to the favorite position 3. moveToFavorite3: { ID: 0x0b, parameters: [], }, }, commandsResponse: {}, }, manuSpecificYokisWindowCovering: { ID: 0xfc08, // Details coming soon manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: {}, commands: {}, commandsResponse: {}, }, manuSpecificYokisChannel: { ID: 0xfc09, // Details coming soon manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: { // Define the command to send to the servers using cluster On/Off. 0x00 -> toggle, 0x01 -> ON, 0x02 -> OFF, 0x03 -> OFF onOffClusterMode: { ID: 0x0000, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Define the command to send to the servers using cluster Level control. 0x00 -> nothing, 0x01 -> Move up, 0x02 -> Move down, 0x03 -> stop levelControlClusterMode: { ID: 0x0001, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Define the command to send to the servers using cluster Window Covering. 0x00 -> toggle, 0x01 -> up/open, 0x02 -> down/close, 0x03 -> stop windowCoveringClusterMode: { ID: 0x0002, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Defines the cluster that will be used by the channel to create an order. Default: 0xFFF0, Min-Max: 0x0000 – 0xFFFF clusterToBeUsed: { ID: 0x0003, type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, // Define the channel sending mode. 0x00 -> Direct, 0x01 -> Broadcast, 0x02 -> Group sendingMode: { ID: 0x0004, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Define the light control mode used between remote and the binded device. 0x00 -> Mode pulse, 0x01 -> Mode deaf yokisLightControlMode: { ID: 0x0005, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Define the command to send to the servers using cluster Yokis Pilot Wire. 0x00 -> toggle, 0x01 -> confort, 0x02 -> eco yokisPilotWireClusterMode: { ID: 0x0006, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 }, // Indicate the group id who will receive the command from the dedicated endpoint. Default: 0x0000, Min-Max: 0x0000 – 0xFFFF groupId: { ID: 0x0007, type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, }, commands: {}, commandsResponse: {}, }, manuSpecificYokisPilotWire: { ID: 0xfc0a, manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: { // Represent the actual order used by the device. Default: 0x02, Min-Max: 0x00 - 0xF1. Reportable, not writable actualOrder: { ID: 0x0000, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Define the “Order” embedded timer duration. This timer is set when the device changes its order (in second). After that duration, the device is set back to its fallback order. Default: 0x00000000, Min-Max: 0x00000000 - 0xFFFFFFFF orderTimer: { ID: 0x0001, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Define the duration before an order is set. This timer is used when a new order is asked, it corresponds to the time before this order is applied. The duration is set in second. Default: 0x00000000, Min-Max: 0x00000000 - 0xFFFFFFFF preOrderTimer: { ID: 0x0002, type: zigbee_herdsman_1.Zcl.DataType.UINT32 }, // Represent the actual unit used for local command configuration: 0x00 -> Second, 0x01 -> Minutes. Default: 0x00, Min-Max: 0x00 - 0x01. timerUnit: { ID: 0x0003, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Define the product’s LED behavior: 0x00 -> LED is always ON and blink during radio activity, 0x01 -> LED is only OFF during few seconds after a mode transition. Default: 0x00, Min-Max: 0x00 - 0x01. ledMode: { ID: 0x0004, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Define if the product must be set into pilot wire relay mode: 0x00 -> Relay mode is deactivated, 0x01 -> Relay mode is activated. Default: 0x00, Min-Max: 0x00 - 0x01. pilotWireRelayMode: { ID: 0x0005, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Define the order scrolling sense: 0x00 -> Forward : Confort -> Confort – 1 -> Confort – 2 -> Eco -> Hors-Gel -> Arrêt, 0x01 -> Backward : Arrêt -> Hors-Gel -> Eco -> Confort – 2 -> Confort – 1 -> Confort. Default: 0x00, Min-Max: 0x00 - 0x01. orderScrollingMode: { ID: 0x0006, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Define the number of orders supported by the device: 0x00 -> 4 orders (Confort, Eco, Hors-Gel, Arrêt), 0x01 -> 6 orders (Confort, Confort – 1, Confort – 2, Eco, Hors-Gel, Arrêt). Default: 0x01, Min-Max: 0x00 - 0x01. orderNumberSupported: { ID: 0x0007, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Represent the fallback order used by the device after the end of an order timer is reached: 0x00 -> Stop, 0x01 -> Frost-off, 0x02 -> Eco, 0x03 -> Confort-2, 0x04 -> Confort-1, 0x05 -> Confort. Default: 0x02, Min-Max: 0x00 - 0x05. fallbackOrder: { ID: 0x0008, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, }, commands: { // Set the device in the specified order. setOrder: { ID: 0x00, parameters: [ // Order to be set: 0x00 -> Stop, 0x01 -> Frost-off, 0x02 -> Eco, 0x03 -> Confort-2, 0x04 -> Confort-1, 0x05 -> Confort { name: "uc_Order", type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, ], }, // Toggle between order by respecting the scrolling order. toggleOrder: { ID: 0x01, parameters: [], }, }, commandsResponse: {}, }, manuSpecificYokisTemperatureMeasurement: { ID: 0xfc0b, manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: { // This attribute represents the last value measured. The unit is in 0.01 °C (12,25°C -> 1225). Default: 0x0000, Min-Max: 0x954D - 0x7FFE. Reportable, not writable currentValue: { ID: 0x0000, type: zigbee_herdsman_1.Zcl.DataType.INT16 }, // Represent the minimal value set since the last power-on/reset. The unit is in 0.01 °C (12,25°C -> 1225). Default: 0x7FFE , Min-Max: 0x954D - 0x7FFE. Reportable, not writable minMeasuredValue: { ID: 0x0001, type: zigbee_herdsman_1.Zcl.DataType.INT16 }, // Represent the maximal value set since the last power-on/reset. The unit is in 0.01 °C (12,25°C -> 1225). Default: 0x954D , Min-Max: 0x954D - 0x7FFE. Reportable, not writable maxMeasuredValue: { ID: 0x0002, type: zigbee_herdsman_1.Zcl.DataType.INT16 }, // Represent the offset applicated to the temperature measured. The unit is in 0,1°C (1,5°C -> 15). Default: 0x00, Min-Max: 0xCE (-50) - 0x32 (50). offset: { ID: 0x0003, type: zigbee_herdsman_1.Zcl.DataType.INT8 }, // Represent the sampling period used to process the temperature measurement. The unit is in seconds. Default: 0x0A, Min-Max: 0x01 - 0x78. samplingPeriod: { ID: 0x0004, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Represents the sampling number to sense per sampling period defined before. Default: 0x03, Min-Max: 0x01 - 0x14. samplingNumber: { ID: 0x0005, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Represents the temperature variation to request a new temperature sending through reports. The unit is in 0,1°C (0,5°C ->5). Default: 0x00, Min-Max: 0x00 - 0x0A. deltaTemp: { ID: 0x0006, type: zigbee_herdsman_1.Zcl.DataType.UINT8 }, // Represents the minimal sending period that the device must respect before sending a new value through reporting. A writing on this attribute will update all reporting entries related to the temperature measurement. Default: 0x0A, Min-Max: 0x0000 - 0xFFFF. minimalSendingPeriod: { ID: 0x0007, type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, // Represents the maximal sending period. The device must send a new value through reporting before the end of this period. A writing on this attribute will update all reporting entries related to the temperature measurement. Default: 0x0A, Min-Max: 0x0000 - 0xFFFF. maximalSendingPeriod: { ID: 0x0008, type: zigbee_herdsman_1.Zcl.DataType.UINT16 }, }, commands: { // Reset the Min and Max temperature value information. minMaxReset: { ID: 0x00, parameters: [], }, }, commandsResponse: {}, }, manuSpecificYokisStats: { ID: 0xfcf0, // Details coming soon manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.YOKIS, attributes: {}, commands: {}, commandsResponse: {}, }, }; // #endregion // #region Extension definition // Checks definition const yokisExtendChecks = { parseResetInput: (input) => { if (!input) { throw new Error("MISSING_INPUT"); } if (!Object.keys(resetActionEnum).includes(input)) { throw new Error("INVALID_RESET_ACTION"); } return { payload: { // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_ResetAction: utils.getFromLookup(input, resetActionEnum), }, }; }, parseOpenNetworkInput: (input) => { if (!input || typeof input !== "object") { throw new Error("NOT_OBJECT"); } if (!("opening_time" in input) || !utils.isNumber(input.opening_time)) { throw new Error("INVALID_OPENNETWORK_OPENINGTIME"); } return { payload: { // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_OpeningTime: input.opening_time, }, }; }, parseInputModeInput: (input) => { if (!input || typeof input !== "object") { throw new Error("NOT_OBJECT"); } if (!("select_input_mode" in input) || !Object.keys(inputModeEnum).includes(input.select_input_mode)) { throw new Error("INVALID_INPUTMODE"); } return { payload: { // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_InputMode: utils.getFromLookup(input.select_input_mode, inputModeEnum), }, }; }, parseMoveToPositionInput: (input) => { if (!input || typeof input !== "object") { throw new Error("NOT_OBJECT"); } if (!("brightness_start" in input) || !utils.isNumber(input.brightness_start)) { throw new Error("INVALID_MOVE_BRIGHTNESSSTART"); } if (!("brightness_end" in input) || !utils.isNumber(input.brightness_end)) { throw new Error("INVALID_MOVE_BRIGHTNESSEND"); } if (!("pre_timer_value" in input) || !utils.isNumber(input.pre_timer_value)) { throw new Error("INVALID_MOVE_PRETIMERVALUE"); } if (!("enable_pre_timer" in input) || !utils.isBoolean(input.enable_pre_timer)) { throw new Error("INVALID_MOVE_PRETIMERENABLE"); } if (!("timer_value" in input) || !utils.isNumber(input.timer_value)) { throw new Error("INVALID_MOVE_TIMERVALUE"); } if (!("enable_timer" in input) || !utils.isBoolean(input.enable_timer)) { throw new Error("INVALID_MOVE_TIMERENABLE"); } if (!("transition_time" in input) || !utils.isNumber(input.transition_time)) { throw new Error("INVALID_MOVE_TRANSITIONTIME"); } return { payload: { // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_BrightnessStart: input.brightness_start, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_BrightnessEnd: input.brightness_end, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_PreTimerValue: input.pre_timer_value, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` b_PreTimerEnable: input.enable_pre_timer ? 1 : 0, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_TimerValue: input.timer_value, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` b_TimerEnable: input.enable_timer ? 1 : 0, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_TransitionTime: input.transition_time, }, }; }, parseBlinkInput: (input) => { if (!input || typeof input !== "object") { throw new Error("NOT_OBJECT"); } if (!("blink_amount" in input) || !utils.isNumber(input.blink_amount)) { throw new Error("INVALID_BLINK_BLINKAMOUNT"); } if (!("blink_on_period" in input) || !utils.isNumber(input.blink_on_period)) { throw new Error("INVALID_BLINK_BLINKONPERIOD"); } if (!("blink_off_period" in input) || !utils.isNumber(input.blink_off_period)) { throw new Error("INVALID_BLINK_BLINKOFFPERIOD"); } if (!("state_after_sequence" in input) || !Object.keys(stateAfterBlinkEnum).includes(input.state_after_sequence)) { throw new Error("MISSING_BLINK_STATEAFTERSEQUENCE"); } if (!("do_periodic_cycle" in input) || !utils.isBoolean(input.do_periodic_cycle)) { throw new Error("INVALID_BLINK_DOPERIODICYCLE"); } return { payload: { // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_BlinkAmount: input.blink_amount, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_BlinkOnPeriod: input.blink_on_period, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_BlinkOffPeriod: input.blink_off_period, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_StateAfterSequence: utils.getFromLookup(input.state_after_sequence, stateAfterBlinkEnum), // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` b_DoPeriodicCycle: input.do_periodic_cycle ? 1 : 0, }, }; }, parsePulseInput: (input) => { if (!input || typeof input !== "object") { throw new Error("NOT_OBJECT"); } if (!("pulse_length" in input) || !utils.isNumber(input.pulse_length)) { throw new Error("INVALID_PULSE_PULSELENGTH"); } return { payload: { PulseLength: input.pulse_length, }, }; }, parseDeafBlinkPropInput: (input) => { if (!input || typeof input !== "object") { throw new Error("NOT_OBJECT"); } if (!("blink_amount" in input) || !utils.isNumber(input.blink_amount)) { throw new Error("INVALID_BLINK_AMOUNT"); } if (!("blink_on_time" in input) || !utils.isNumber(input.blink_on_time)) { throw new Error("INVALID_BLINK_ONTIME"); } if (!("sequence_amount" in input) || !utils.isNumber(input.sequence_amount)) { throw new Error("INVALID_SEQUENCE_AMOUNT"); } if (input.sequence_of_blinks && Array.isArray(input.sequence_of_blinks)) { // if (input.uc_SequenceAmount < input.tuc_BlinkAmount.length) { // // more sequences configured than expected, pop extragenous // for(let i = 0; i < input.tuc_BlinkAmount.length - input.uc_SequenceAmount; i++) { // input.tuc_BlinkAmount.pop(); // } // } // if (input.uc_SequenceAmount > input.tuc_BlinkAmount.length) { // // more sequences than configured, pad with additional // for(let i = 0; i < input.uc_SequenceAmount - input.tuc_BlinkAmount.length; i++) { // input.tuc_BlinkAmount.push({"uc_BlinkAmountItem":1}); //puke // } // } // Updating number of elements input.sequence_amount = input.sequence_of_blinks.length; } else { throw new Error("INVALID_TUC_BLINKAMOUNT"); } if (!("uc_BlinkAmount" in input) || !utils.isNumber(input.uc_SequenceAmount)) { throw new Error("INVALID_SEQUENCE_AMOUNT"); } return { payload: { // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_BlinkAmount: input.blink_amount, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_BlinkOnTime: input.blink_on_time, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_SequenceAmount: input.sequence_of_blinks.length, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` tuc_BlinkAmount: input.sequence_of_blinks.map((elem) => (typeof elem === "object" ? Object.values(elem).shift() : elem)), // [{"undefined":1},{"undefined":1}] > [1,1] }, }; }, parseDim: (input) => { // biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress` let _ulRampContinuousDuration; // biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress` let _ucStepContinuous; if (!input || typeof input !== "object") { throw new Error("NOT_OBJECT"); } if (!("ramp_continuous_duration" in input) || !utils.isNumber(input.ramp_continuous_duration)) { _ulRampContinuousDuration = 0xffffffff; // use default value } else _ulRampContinuousDuration = input.ramp_continuous_duration; if (!("step_continuous" in input) || !utils.isNumber(input.step_continuous)) { _ucStepContinuous = 0xff; // use default value } else _ucStepContinuous = input.step_continuous; return { payload: { // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_RampContinuousDuration: _ulRampContinuousDuration, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_StepContinuous: _ucStepContinuous, }, }; }, parseDimMinMax: (input) => { // biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress` let _ulTransitionTime; if (!input || typeof input !== "object") { throw new Error("NOT_OBJECT"); } if (!("transition_time" in input) || !utils.isNumber(input.transition_time)) { _ulTransitionTime = 0xffffffff; // use default value } else _ulTransitionTime = input.transition_time; if (!("action" in input)) { throw new Error("MISSING_ACTION"); } return { action: input.action, payload: { // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_TransitionTime: _ulTransitionTime, }, }; }, parseStartNightLightMode: (input) => { // biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress` let _ulChildModeStartingDelay; // biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress` let _ucChildModeBrightnessStart; // biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress` let _ucChildModeBrightnessEnd; // biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress` let _ulChildModeRampDuration; // biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress` let _ulChildModeOnDuration; // biome-ignore lint/suspicious/noImplicitAnyLet: ignored using `--suppress` let _ucChildStep; if (!input || typeof input !== "object") { throw new Error("NOT_OBJECT"); } if (!("childmode_starting_delay" in input) || !utils.isNumber(input.childmode_starting_delay)) { _ulChildModeStartingDelay = 0xffffffff; // use default value } else _ulChildModeStartingDelay = input.childmode_starting_delay; if (!("childmode_brightness_start" in input) || !utils.isNumber(input.childmode_brightness_start)) { _ucChildModeBrightnessStart = 0xff; // use default value } else _ucChildModeBrightnessStart = input.childmode_brightness_start; if (!("childmode_brightness_end" in input) || !utils.isNumber(input.childmode_brightness_end)) { _ucChildModeBrightnessEnd = 0xff; // use default value } else _ucChildModeBrightnessEnd = input.childmode_brightness_end; if (!("childmode_ramp_duration" in input) || !utils.isNumber(input.childmode_ramp_duration)) { _ulChildModeRampDuration = 0xffffffff; // use default value } else _ulChildModeRampDuration = input.childmode_ramp_duration; if (!("childmode_on_duration" in input) || !utils.isNumber(input.childmode_on_duration)) { _ulChildModeOnDuration = 0xffffffff; // use default value } else _ulChildModeOnDuration = input.childmode_on_duration; if (!("childmode_step" in input) || !utils.isNumber(input.childmode_step)) { _ucChildStep = 0xff; // use default value } else _ucChildStep = input.childmode_step; return { payload: { // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_ChildModeStartingDelay: _ulChildModeStartingDelay, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_ChildModeBrightnessStart: _ucChildModeBrightnessStart, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_ChildModeBrightnessEnd: _ucChildModeBrightnessEnd, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_ChildModeRampDuration: _ulChildModeRampDuration, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` ul_ChildModeOnDuration: _ulChildModeOnDuration, // biome-ignore lint/style/useNamingConvention: ignored using `--suppress` uc_ChildStep: _ucChildStep, }, }; }, log: (key, value, payload) => { logger_1.logger.debug(`Invoked converter with key: '${key}'`, NS); logger_1.logger.debug(`Invoked converter with values:${JSON.stringify(value)}`, NS); if (payload) logger_1.logger.debug(`Invoked converter with payload:${JSON.stringify(payload)}`, NS); }, }; // Command definition const yokisCommandsExtend = { resetToFactorySettings: () => { const exposes = e .enum("reset_to_factory_settings", ea.SET, Object.keys(resetActionEnum)) .withDescription("Reset setting depending on RESET ACTION value") .withCategory("config"); const toZigbee = [ { key: ["reset_to_factory_settings"], convertSet: async (entity, key, value, meta) => { utils.assertString(value); const commandWrapper = yokisExtendChecks.parseResetInput(value); yokisExtendChecks.log(key, value); await entity.command("manuSpecificYokisDevice", "resetToFactorySettings", commandWrapper.payload); }, }, ]; return { exposes: [exposes], toZigbee, isModernExtend: true, }; }, relaunchBleAdvert: () => { const exposes = e .enum("relaunch_ble_advert", ea.SET, ["relaunch_ble_advert"]) .withDescription("Relaunch BLE advertising for 15 minutes") .withCategory("config"); const toZigbee = [ { key: ["relaunch_ble_advert"], convertSet: async (entity, key, value, meta) => { yokisExtendChecks.log(key, value); await entity.command("manuSpecific