zigbee-herdsman-converters
Version:
Collection of device converters to be used with zigbee-herdsman
1,048 lines • 285 kB
JavaScript
"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 fz = __importStar(require("../converters/fromZigbee"));
const tz = __importStar(require("../converters/toZigbee"));
const exposes = __importStar(require("../lib/exposes"));
const logger_1 = require("../lib/logger");
const lumi = __importStar(require("../lib/lumi"));
const m = __importStar(require("../lib/modernExtend"));
const reporting = __importStar(require("../lib/reporting"));
const utils_1 = require("../lib/utils");
const e = exposes.presets;
const ea = exposes.access;
const { lumiAction, lumiOperationMode, lumiPowerOnBehavior, lumiZigbeeOTA, lumiSwitchType, lumiAirQuality, lumiVoc, lumiDisplayUnit, lumiLight, lumiOutageCountRestoreBindReporting, lumiElectricityMeter, lumiPower, lumiOverloadProtection, lumiLedIndicator, lumiButtonLock, lumiMotorSpeed, lumiCurtainSpeed, lumiCurtainManualOpenClose, lumiCurtainAdaptivePullingSpeed, lumiCurtainManualStop, lumiCurtainReverse, lumiCurtainStatus, lumiCurtainLastManualOperation, lumiCurtainPosition, lumiCurtainTraverseTime, lumiCurtainCalibrationStatus, lumiCurtainCalibrated, lumiCurtainIdentifyBeep, lumiOnOff, lumiLedDisabledNight, lumiFlipIndicatorLight, lumiPreventReset, lumiClickMode, lumiSlider, lumiSetEventMode, lumiSwitchMode, lumiVibration, lumiReportInterval, lumiSensitivityAdjustment, lumiKnobRotation, lumiCommandMode, lumiBattery, lumiLockRelay, lumiMultiClick, lumiPreventLeave, lumiExternalSensor, w600ExternalTempSensor, w600Heartbeat, w600PresetTemperatureTable, w600Schedule, w600Thermostat, w600ValvePosition, w600WeeklySchedule, lumiReadPositionOnReport, } = lumi.modernExtend;
const NS = "zhc:lumi";
const { manufacturerCode } = lumi;
const aqaraH2EuShutterSwitchEndpoints = { top_wireless_button: 3, bottom_wireless_button: 4 };
const aqaraH2EuShutterSwitchEndpointNames = ["top_wireless_button", "bottom_wireless_button"];
const aqaraH2EuShutterSwitchActionLookup = { hold: 0, single: 1, double: 2, release: 255 };
const aqaraH2EuShutterSwitchMultiEndpointSkip = ["energy", "position", "state", "tilt"];
const aqaraH2EuShutterSwitchMultiClickAttribute = 0x0286;
async function configureAqaraH2EuShutterSwitch(device, coordinatorEndpoint) {
for (const endpointName of aqaraH2EuShutterSwitchEndpointNames) {
const endpoint = device.getEndpoint(aqaraH2EuShutterSwitchEndpoints[endpointName]);
await reporting.bind(endpoint, coordinatorEndpoint, ["manuSpecificLumi", "genMultistateInput"]);
await endpoint.configureReporting("genMultistateInput", reporting.payload("presentValue", 0, 3600, 1));
// Initialize Aqara's per-button multi-click setting on startup.
await endpoint.read("manuSpecificLumi", [aqaraH2EuShutterSwitchMultiClickAttribute], {
manufacturerCode,
});
}
}
function fp310DetectionRange() {
return {
isModernExtend: true,
exposes: [
e
.numeric("detection_range", ea.ALL)
.withValueMin(0)
.withValueMax(6)
.withValueStep(0.25)
.withUnit("m")
.withDescription("Specifies the range that is being detected. Press the on-device button to wake the device up and refresh it's settings."),
],
fromZigbee: [
{
cluster: "manuSpecificLumi",
type: ["attributeReport", "readResponse"],
convert: (model, msg, publish, options, meta) => {
if (msg.data["410"] && Buffer.isBuffer(msg.data["410"])) {
const buffer = msg.data["410"];
const mask = buffer[2] | (buffer[3] << 8) | (buffer[4] << 16);
let zones = 0;
let value = mask;
while (value > 0) {
zones++;
value >>= 1;
}
// 1 zone = 0.25m
const detection_range = zones * 0.25;
return { detection_range };
}
},
},
],
toZigbee: [
{
key: ["detection_range"],
convertSet: async (entity, key, value, meta) => {
(0, utils_1.assertNumber)(value);
const distance = Math.max(0, Math.min(6, value));
const zones = Math.round(distance / 0.25);
const mask = zones === 0 ? 0 : (1 << zones) - 1;
const buffer = Buffer.from([0x00, 0x03, mask & 0xff, (mask >> 8) & 0xff, (mask >> 16) & 0xff]);
await entity.write("manuSpecificLumi", { 410: { value: buffer, type: 0x41 } }, { manufacturerCode: manufacturerCode });
return {
state: { detection_range: value },
};
},
convertGet: async (entity, key, meta) => {
const endpoint = meta.device.getEndpoint(1);
await endpoint.read("manuSpecificLumi", [0x019a], { manufacturerCode: manufacturerCode });
},
},
],
};
}
exports.definitions = [
{
zigbeeModel: ["lumi.flood.acn001"],
model: "SJCGQ13LM",
vendor: "Aqara",
description: "Water leak sensor E1",
fromZigbee: [fz.ias_water_leak_alarm_1, lumi.fromZigbee.lumi_specific, fz.battery],
toZigbee: [],
exposes: [e.water_leak(), e.battery(), e.battery_low(), e.battery_voltage(), e.device_temperature(), e.power_outage_count(false)],
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
await endpoint.read("genPowerCfg", ["batteryVoltage"]);
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), m.quirkCheckinInterval("1_HOUR"), lumiZigbeeOTA()],
},
{
zigbeeModel: ["lumi.airm.fhac01"],
model: "KQJCMB11LM",
vendor: "Aqara",
description: "Air monitoring panel S1",
fromZigbee: [fz.temperature, fz.humidity, lumi.fromZigbee.lumi_pm25, lumi.fromZigbee.lumi_co2],
toZigbee: [],
exposes: [e.temperature(), e.humidity(), e.pm25(), e.co2()],
extend: [lumiZigbeeOTA()],
},
{
zigbeeModel: ["lumi.magnet.acn001"],
model: "MCCGQ14LM",
vendor: "Aqara",
description: "Door and window sensor E1",
fromZigbee: [fz.ias_contact_alarm_1, lumi.fromZigbee.lumi_specific, fz.battery],
toZigbee: [],
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
exposes: [e.contact(), e.battery(), e.battery_low(), e.battery_voltage()],
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
await endpoint.read("genPowerCfg", ["batteryVoltage"]);
},
extend: [
lumi.modernExtend.addManuSpecificLumiCluster(),
m.quirkCheckinInterval("1_HOUR"),
// OTA request: "fieldControl":0, "manufacturerCode":4447, "imageType":10635, no available for now
// https://github.com/Koenkk/zigbee-OTA/pull/138
// lumiZigbeeOTA(),
],
},
{
zigbeeModel: ["lumi.magnet.ac01"],
model: "MCCGQ13LM",
vendor: "Aqara",
description: "Door and window sensor P1",
fromZigbee: [lumi.fromZigbee.lumi_contact, fz.ias_contact_alarm_1, lumi.fromZigbee.lumi_specific],
toZigbee: [lumi.toZigbee.lumi_detection_distance],
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
exposes: [
e.contact(),
e.battery(),
e.battery_voltage(),
e.tamper(),
e
.enum("detection_distance", ea.ALL, ["10mm", "20mm", "30mm"])
.withDescription('The sensor will be considered "off" within the set distance. Please press the device button before setting'),
],
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), m.quirkCheckinInterval("1_HOUR")],
},
{
zigbeeModel: ["lumi.dimmer.rcbac1"],
model: "ZNDDMK11LM",
vendor: "Aqara",
description: "Smart lightstrip driver",
fromZigbee: [lumi.fromZigbee.lumi_power, lumi.fromZigbee.lumi_specific, ...m.light({ colorTemp: { range: undefined }, color: true }).fromZigbee],
toZigbee: [
lumi.toZigbee.lumi_dimmer_mode,
lumi.toZigbee.lumi_switch_power_outage_memory,
...m.light({ colorTemp: { range: undefined }, color: true }).toZigbee,
],
exposes: [
e.power(),
e.energy(),
e.voltage(),
e.device_temperature(),
e.power_outage_memory(),
// When in rgbw mode, only one of color and colortemp will be valid, and l2 will be invalid
// Do not control l2 in rgbw mode
e.light_brightness_colortemp_colorxy([153, 370]).removeFeature("color_temp_startup").withEndpoint("l1"),
e.light_brightness_colortemp([153, 370]).removeFeature("color_temp_startup").withEndpoint("l2"),
e.enum("dimmer_mode", ea.ALL, ["rgbw", "dual_ct"]).withDescription("Switch between rgbw mode or dual color temperature mode"),
],
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), m.deviceEndpoints({ endpoints: { l1: 1, l2: 2 } }), lumiZigbeeOTA()],
},
{
zigbeeModel: ["lumi.light.aqcn02"],
model: "ZNLDP12LM",
vendor: "Aqara",
description: "Light bulb",
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiLight({ colorTemp: true, powerOutageMemory: "light" }), lumiZigbeeOTA()],
},
{
zigbeeModel: ["lumi.light.acn003"],
model: "ZNXDD01LM",
vendor: "Aqara",
description: "Ceiling light L1-350",
extend: [
lumi.modernExtend.addManuSpecificLumiCluster(),
lumiLight({ colorTemp: true, powerOutageMemory: "switch", levelConfig: { features: ["on_level"] } }),
lumiZigbeeOTA(),
],
},
{
zigbeeModel: ["lumi.light.cwac02", "lumi.light.acn014"],
model: "ZNLDP13LM",
vendor: "Aqara",
description: "Light bulb T1",
whiteLabel: [{ vendor: "Aqara", model: "LEDLBT1-L01" }],
extend: [
lumi.modernExtend.addManuSpecificLumiCluster(),
lumiZigbeeOTA(),
lumiLight({ colorTemp: true, powerOutageMemory: "switch" }),
m.forceDeviceType({ type: "Router" }),
m.forcePowerSource({ powerSource: "Mains (single phase)" }),
],
},
{
zigbeeModel: ["lumi.light.cwopcn01"],
model: "XDD11LM",
vendor: "Aqara",
description: "Opple MX960",
meta: { turnsOffAtBrightness1: true },
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiLight({ colorTemp: true, powerOutageMemory: "switch" }), lumiZigbeeOTA()],
},
{
zigbeeModel: ["lumi.light.cwopcn02"],
model: "XDD12LM",
vendor: "Aqara",
description: "Opple MX650",
meta: { turnsOffAtBrightness1: true },
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiLight({ colorTemp: true, powerOutageMemory: "switch" })],
},
{
zigbeeModel: ["lumi.light.cwopcn03"],
model: "XDD13LM",
vendor: "Aqara",
description: "Opple MX480",
meta: { turnsOffAtBrightness1: true },
extend: [
lumi.modernExtend.addManuSpecificLumiCluster(),
lumiLight({ colorTemp: true, powerOutageMemory: "switch", colorTempRange: [175, 370] }),
lumiZigbeeOTA(),
],
},
{
zigbeeModel: ["lumi.light.cwjwcn01"],
model: "JWSP001A",
vendor: "Aqara",
description: "Jiawen LED Driver & Dimmer",
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiLight({ colorTemp: true, powerOutageMemory: "switch" })],
},
{
zigbeeModel: ["lumi.light.cwjwcn02"],
model: "JWDL001A",
vendor: "Aqara",
description: "Embedded spot led light",
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiLight({ colorTemp: true, powerOutageMemory: "switch" })],
},
{
zigbeeModel: ["lumi.sensor_switch"],
model: "WXKG01LM",
vendor: "Xiaomi",
whiteLabel: [
{ vendor: "Xiaomi", model: "YTC4040GL" },
{ vendor: "Xiaomi", model: "YTC4006CN" },
{ vendor: "Xiaomi", model: "YTC4017CN" },
{ vendor: "Xiaomi", model: "ZHTZ02LM" },
],
description: "Mi wireless switch",
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
fromZigbee: [lumi.fromZigbee.lumi_basic, lumi.fromZigbee.lumi_action_WXKG01LM],
exposes: [
e.battery(),
e.action(["single", "double", "triple", "quadruple", "hold", "release", "many"]),
e.battery_voltage(),
e.power_outage_count(false),
],
toZigbee: [],
extend: [m.quirkCheckinInterval("1_HOUR")],
},
{
zigbeeModel: ["lumi.sensor_switch.aq2", "lumi.remote.b1acn01"],
model: "WXKG11LM",
vendor: "Aqara",
description: "Wireless mini switch",
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
exposes: [
e.battery(),
e.battery_voltage(),
e.action(["single", "double", "triple", "quadruple", "hold", "release"]),
e.device_temperature(),
e.power_outage_count(),
],
fromZigbee: [lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_action, lumi.fromZigbee.lumi_basic],
toZigbee: [],
extend: [m.quirkCheckinInterval("1_HOUR")],
},
{
zigbeeModel: ["lumi.sensor_switch.aq3", "lumi.sensor_swit"],
model: "WXKG12LM",
vendor: "Aqara",
description: "Wireless mini switch (with gyroscope)",
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
exposes: [e.battery(), e.action(["single", "double", "hold", "release", "shake"]), e.battery_voltage()],
fromZigbee: [lumi.fromZigbee.lumi_basic, lumi.fromZigbee.lumi_action_multistate],
toZigbee: [],
extend: [m.quirkCheckinInterval("1_HOUR")],
},
{
zigbeeModel: ["lumi.sensor_86sw1"],
model: "WXKG03LM_rev1",
vendor: "Aqara",
description: "Wireless remote switch (single rocker), 2016 model",
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
exposes: [e.battery(), e.action(["single"]), e.battery_voltage()],
fromZigbee: [lumi.fromZigbee.lumi_action, lumi.fromZigbee.lumi_basic],
toZigbee: [],
extend: [m.quirkCheckinInterval("1_HOUR"), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.remote.b186acn01"],
model: "WXKG03LM_rev2",
vendor: "Aqara",
description: "Wireless remote switch (single rocker), 2018 model",
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
exposes: [e.battery(), e.action(["single", "double", "hold"]), e.battery_voltage()],
fromZigbee: [lumi.fromZigbee.lumi_action, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_basic],
toZigbee: [],
extend: [m.quirkCheckinInterval("1_HOUR"), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.remote.b186acn02"],
model: "WXKG06LM",
vendor: "Aqara",
description: "Wireless remote switch D1 (single rocker)",
fromZigbee: [lumi.fromZigbee.lumi_basic, lumi.fromZigbee.lumi_action, lumi.fromZigbee.lumi_action_multistate],
toZigbee: [],
exposes: [e.battery(), e.action(["single", "double", "hold"]), e.battery_voltage()],
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
extend: [m.quirkCheckinInterval("1_HOUR"), lumiPreventReset()],
configure: async (device, coordinatorEndpoint) => {
try {
const endpoint = device.endpoints[1];
await reporting.bind(endpoint, coordinatorEndpoint, ["genOnOff", "genPowerCfg"]);
}
catch {
// fails for some but device works as expected: https://github.com/Koenkk/zigbee2mqtt/issues/9136
}
},
},
{
zigbeeModel: ["lumi.light.acn132"],
model: "LGYCDD01LM",
vendor: "Aqara",
whiteLabel: [{ vendor: "Aqara", model: "RLS-K01D" }],
description: "LED Strip T1",
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
await endpoint.read("manuSpecificLumi", [0x0515], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x0516], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x0517], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x051b], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x051c], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x051d], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x051e], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x051f], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x0520], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x0523], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x0527], { manufacturerCode: manufacturerCode });
await endpoint.read("manuSpecificLumi", [0x0530], { manufacturerCode: manufacturerCode });
await endpoint.read("genLevelCtrl", [0x0012], {});
await endpoint.read("genLevelCtrl", [0x0013], {});
},
extend: [
lumi.modernExtend.addManuSpecificLumiCluster(),
lumiLight({
colorTemp: true,
color: { modes: ["xy"] },
colorTempRange: [153, 370],
}),
m.forcePowerSource({ powerSource: "Mains (single phase)" }),
m.identify(),
lumiPowerOnBehavior({ lookup: { on: 0, previous: 1, off: 2 } }),
lumiZigbeeOTA(),
lumi.lumiModernExtend.lumiDimmingRangeMin(),
lumi.lumiModernExtend.lumiDimmingRangeMax(),
lumi.lumiModernExtend.lumiOnOffDuration(),
lumi.lumiModernExtend.lumiOffOnDuration(),
m.numeric({
name: "length",
valueMin: 1,
valueMax: 10,
valueStep: 0.2,
scale: 5,
unit: "m",
cluster: "manuSpecificLumi",
attribute: { ID: 0x051b, type: 0x20 },
description: "LED strip length (5 x 20cm segments per meter)",
entityCategory: "config",
zigbeeCommandOptions: { manufacturerCode },
}),
m.binary({
name: "audio",
valueOn: ["ON", 1],
valueOff: ["OFF", 0],
cluster: "manuSpecificLumi",
attribute: { ID: 0x051c, type: 0x20 },
description: "Audio sync mode",
zigbeeCommandOptions: { manufacturerCode },
}),
m.enumLookup({
name: "audio_sensitivity",
lookup: { low: 0, high: 2 },
cluster: "manuSpecificLumi",
attribute: { ID: 0x051e, type: 0x20 },
description: "Audio sync sensitivity",
zigbeeCommandOptions: { manufacturerCode },
}),
m.enumLookup({
name: "audio_effect",
lookup: { random: 0, blink: 1, rainbow: 2, wave: 3 },
cluster: "manuSpecificLumi",
attribute: { ID: 0x051d, type: 0x23 },
description: "Audio effect",
zigbeeCommandOptions: { manufacturerCode },
}),
lumi.lumiModernExtend.lumiRGBEffect({ breathing: 0, rainbow1: 1, chasing: 2, flash: 3, hopping: 4, rainbow2: 5, flicker: 6, dash: 7 }),
lumi.lumiModernExtend.lumiRGBEffectSpeed(),
lumi.lumiModernExtend.lumiRGBEffectSegments(),
lumi.lumiModernExtend.lumiRGBEffectColors(),
lumi.lumiModernExtend.lumiSegmentColors(),
],
},
{
zigbeeModel: ["lumi.sensor_86sw2", "lumi.sensor_86sw2.es1"],
model: "WXKG02LM_rev1",
vendor: "Aqara",
description: "Wireless remote switch (double rocker), 2016 model",
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
exposes: [e.battery(), e.action(["single_left", "single_right", "single_both"]), e.battery_voltage(), e.power_outage_count(false)],
fromZigbee: [lumi.fromZigbee.lumi_action, lumi.fromZigbee.lumi_basic],
toZigbee: [],
extend: [m.quirkCheckinInterval("1_HOUR"), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.remote.b286acn01"],
model: "WXKG02LM_rev2",
vendor: "Aqara",
description: "Wireless remote switch (double rocker), 2018 model",
meta: { battery: { voltageToPercentage: { min: 2850, max: 3000 } } },
exposes: [
e.battery(),
e.action([
"single_left",
"single_right",
"single_both",
"double_left",
"double_right",
"double_both",
"hold_left",
"hold_right",
"hold_both",
]),
e.battery_voltage(),
],
fromZigbee: [lumi.fromZigbee.lumi_action, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_basic],
toZigbee: [],
extend: [m.quirkCheckinInterval("1_HOUR"), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.b1laus01"],
model: "WS-USC01",
vendor: "Aqara",
description: "Smart wall switch (no neutral, single rocker), US",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_flip_indicator_light,
lumi.toZigbee.lumi_switch_mode_switch,
lumi.toZigbee.lumi_switch_power_outage_memory,
],
exposes: [
e.switch(),
e.action(["single", "double"]),
e.flip_indicator_light(),
e.power_outage_memory(),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode"),
e
.enum("mode_switch", ea.ALL, ["anti_flicker_mode", "quick_mode"])
.withDescription("Anti flicker mode can be used to solve blinking issues of some lights. Quick mode makes the device respond faster."),
e.power_outage_count(),
e.device_temperature().withAccess(ea.STATE),
],
configure: async (device, coordinatorEndpoint) => {
const endpoint1 = device.getEndpoint(1);
// set "event" mode
await endpoint1.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [
lumi.modernExtend.addManuSpecificLumiCluster(),
lumiZigbeeOTA(),
lumiPreventReset(),
m.forcePowerSource({ powerSource: "Mains (single phase)" }),
],
},
{
zigbeeModel: ["lumi.switch.b2laus01"],
model: "WS-USC02",
vendor: "Aqara",
description: "Smart wall switch (no neutral, double rocker), US",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_flip_indicator_light,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_switch_mode_switch,
],
exposes: [
e.switch().withEndpoint("top"),
e.switch().withEndpoint("bottom"),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for top button").withEndpoint("top"),
e
.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"])
.withDescription("Decoupled mode for bottom button")
.withEndpoint("bottom"),
e
.enum("mode_switch", ea.ALL, ["anti_flicker_mode", "quick_mode"])
.withDescription("Anti flicker mode can be used to solve blinking issues of some lights. Quick mode makes the device respond faster."),
e.power_outage_count(),
e.device_temperature().withAccess(ea.STATE),
e.flip_indicator_light(),
e.power_outage_memory(),
e.action(["single_top", "single_bottom", "single_both", "double_top", "double_bottom", "double_both"]),
],
meta: { multiEndpoint: true },
endpoint: (device) => {
return { top: 1, bottom: 2 };
},
configure: async (device, coordinatorEndpoint) => {
await device
.getEndpoint(1)
.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.b1naus01"],
model: "WS-USC03",
vendor: "Aqara",
description: "Smart wall switch (with neutral, single rocker), US",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_power, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_power,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_flip_indicator_light,
],
exposes: [
e.switch(),
e.action(["single", "double"]),
e.flip_indicator_light(),
e.power_outage_count(),
e.device_temperature().withAccess(ea.STATE),
e.power().withAccess(ea.STATE_GET),
e.energy(),
e.voltage(),
e.power_outage_memory(),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode"),
],
configure: async (device, coordinatorEndpoint) => {
const endpoint1 = device.getEndpoint(1);
// set "event" mode
await endpoint1.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.b2naus01"],
model: "WS-USC04",
vendor: "Aqara",
description: "Smart wall switch (with neutral, double rocker), US",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_power, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_power,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_flip_indicator_light,
],
exposes: [
e.switch().withEndpoint("top"),
e.switch().withEndpoint("bottom"),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for top button").withEndpoint("top"),
e
.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"])
.withDescription("Decoupled mode for bottom button")
.withEndpoint("bottom"),
e.power_outage_count(),
e.device_temperature().withAccess(ea.STATE),
e.flip_indicator_light(),
e.power().withAccess(ea.STATE_GET),
e.energy(),
e.voltage(),
e.power_outage_memory(),
e.action(["single_top", "single_bottom", "single_both", "double_top", "double_bottom", "double_both"]),
],
meta: { multiEndpoint: true, multiEndpointSkip: ["power", "energy"] },
endpoint: (device) => {
return { top: 1, bottom: 2 };
},
configure: async (device, coordinatorEndpoint) => {
await device
.getEndpoint(1)
.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.l1acn1"],
model: "QBKG27LM",
vendor: "Aqara",
description: "Smart wall switch H1 (no neutral, single rocker)",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_specific, lumi.fromZigbee.lumi_action_multistate],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_led_disabled_night,
lumi.toZigbee.lumi_flip_indicator_light,
lumi.toZigbee.lumi_switch_mode_switch,
],
exposes: [
e.switch(),
e.device_temperature(),
e.power_outage_memory(),
e.led_disabled_night(),
e.flip_indicator_light(),
e.action(["single", "double"]),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode"),
e.power_outage_count(),
e
.enum("mode_switch", ea.ALL, ["anti_flicker_mode", "quick_mode"])
.withDescription("Anti flicker mode can be used to solve blinking issues of some lights. Quick mode makes the device respond faster."),
],
configure: async (device, coordinatorEndpoint) => {
await device
.getEndpoint(1)
.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.l2acn1"],
model: "QBKG28LM",
vendor: "Aqara",
description: "Smart wall switch H1 (no neutral, double rocker)",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_flip_indicator_light,
lumi.toZigbee.lumi_led_disabled_night,
lumi.toZigbee.lumi_switch_mode_switch,
],
meta: { multiEndpoint: true },
endpoint: (device) => {
return { left: 1, right: 2 };
},
exposes: [
e.switch().withEndpoint("left"),
e.switch().withEndpoint("right"),
e.device_temperature(),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for left button").withEndpoint("left"),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for right button").withEndpoint("right"),
e.action(["single_left", "double_left", "single_right", "double_right", "single_both", "double_both"]),
e.power_outage_memory(),
e.flip_indicator_light(),
e.led_disabled_night(),
e
.enum("mode_switch", ea.ALL, ["anti_flicker_mode", "quick_mode"])
.withDescription("Anti flicker mode can be used to solve blinking issues of some lights. Quick mode makes the device respond faster."),
],
configure: async (device, coordinatorEndpoint) => {
await device
.getEndpoint(1)
.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.l3acn1"],
model: "QBKG29LM",
vendor: "Aqara",
description: "Smart wall switch H1 (no neutral, triple rocker)",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_flip_indicator_light,
lumi.toZigbee.lumi_led_disabled_night,
lumi.toZigbee.lumi_switch_mode_switch,
],
meta: { multiEndpoint: true },
endpoint: (device) => ({ left: 1, center: 2, right: 3 }),
exposes: [
e.switch().withEndpoint("left"),
e.switch().withEndpoint("center"),
e.switch().withEndpoint("right"),
e.power_outage_memory(),
e.flip_indicator_light(),
e.led_disabled_night(),
e.power_outage_count(),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for left button").withEndpoint("left"),
e
.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"])
.withDescription("Decoupled mode for center button")
.withEndpoint("center"),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for right button").withEndpoint("right"),
e
.enum("mode_switch", ea.ALL, ["anti_flicker_mode", "quick_mode"])
.withDescription("Anti flicker mode can be used to solve blinking issues of some lights. Quick mode makes the device respond faster."),
e.device_temperature().withAccess(ea.STATE),
e.action([
"single_left",
"double_left",
"single_center",
"double_center",
"single_right",
"double_right",
"single_left_center",
"double_left_center",
"single_left_right",
"double_left_right",
"single_center_right",
"double_center_right",
"single_all",
"double_all",
]),
],
configure: async (device, coordinatorEndpoint) => {
await device
.getEndpoint(1)
.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.n1acn1"],
model: "QBKG30LM",
vendor: "Aqara",
description: "Smart wall switch H1 Pro (with neutral, single rocker)",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_power, lumi.fromZigbee.lumi_specific, lumi.fromZigbee.lumi_action_multistate],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_led_disabled_night,
lumi.toZigbee.lumi_flip_indicator_light,
],
exposes: [
e.switch(),
e.power(),
e.energy(),
e.voltage(),
e.device_temperature(),
e.power_outage_memory(),
e.led_disabled_night(),
e.flip_indicator_light(),
e.action(["single", "double"]),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode"),
e.power_outage_count(),
],
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.n2acn1"],
model: "QBKG31LM",
vendor: "Aqara",
description: "Smart wall switch H1 Pro (with neutral, double rocker)",
meta: { multiEndpoint: true, multiEndpointSkip: ["power", "energy"] },
endpoint: (device) => {
return { left: 1, right: 2 };
},
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_power, lumi.fromZigbee.lumi_specific, lumi.fromZigbee.lumi_action_multistate],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_led_disabled_night,
lumi.toZigbee.lumi_flip_indicator_light,
],
exposes: [
e.switch().withEndpoint("left"),
e.switch().withEndpoint("right"),
e.power(),
e.energy(),
e.voltage(),
e.device_temperature(),
e.power_outage_memory(),
e.led_disabled_night(),
e.flip_indicator_light(),
e.action(["single_left", "single_right", "single_both", "double_left", "double_right", "double_both"]),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for left button").withEndpoint("left"),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for right button").withEndpoint("right"),
e.power_outage_count(),
],
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.n3acn1"],
model: "QBKG32LM",
vendor: "Aqara",
description: "Smart wall switch H1 Pro (with neutral, triple rocker)",
meta: { multiEndpoint: true },
endpoint: (device) => {
return { left: 1, center: 2, right: 3 };
},
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_power, lumi.fromZigbee.lumi_specific, lumi.fromZigbee.lumi_action_multistate],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_led_disabled_night,
lumi.toZigbee.lumi_flip_indicator_light,
],
exposes: [
e.switch().withEndpoint("left"),
e.switch().withEndpoint("right"),
e.switch().withEndpoint("center"),
e.power(),
e.energy(),
e.voltage(),
e.device_temperature(),
e.power_outage_memory(),
e.led_disabled_night(),
e.flip_indicator_light(),
e.action([
"single_left",
"double_left",
"single_center",
"double_center",
"single_right",
"double_right",
"single_left_center",
"double_left_center",
"single_left_right",
"double_left_right",
"single_center_right",
"double_center_right",
"single_all",
"double_all",
]),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for left button").withEndpoint("left"),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for right button").withEndpoint("right"),
e
.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"])
.withDescription("Decoupled mode for center button")
.withEndpoint("center"),
e.power_outage_count(),
],
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.l1aeu1"],
model: "WS-EUK01",
vendor: "Aqara",
description: "Smart wall switch H1 EU (no neutral, single rocker)",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_flip_indicator_light,
lumi.toZigbee.lumi_led_disabled_night,
lumi.toZigbee.lumi_switch_mode_switch,
],
exposes: [
e.switch(),
e.action(["single", "double"]),
e.power_outage_memory(),
e.flip_indicator_light(),
e.led_disabled_night(),
e.power_outage_count(),
e.device_temperature().withAccess(ea.STATE),
e.operation_mode_select(["control_relay", "decoupled"]).withDescription("Switches between direct relay control and action sending only"),
e
.mode_switch_select(["anti_flicker_mode", "quick_mode"])
.withDescription("Features. Anti flicker mode can be used to solve blinking issues of some lights." +
"Quick mode makes the device respond faster."),
],
configure: async (device, coordinatorEndpoint) => {
const endpoint1 = device.getEndpoint(1);
// set "event" mode
await endpoint1.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.l2aeu1"],
model: "WS-EUK02",
vendor: "Aqara",
description: "Smart wall switch H1 EU (no neutral, double rocker)",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_flip_indicator_light,
lumi.toZigbee.lumi_led_disabled_night,
lumi.toZigbee.lumi_switch_mode_switch,
],
meta: { multiEndpoint: true },
endpoint: (_device) => {
return { left: 1, right: 2 };
},
exposes: [
e.switch().withEndpoint("left"),
e.switch().withEndpoint("right"),
e.power_outage_memory(),
e.flip_indicator_light(),
e.led_disabled_night(),
e.power_outage_count(),
e.device_temperature().withAccess(ea.STATE),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for left button").withEndpoint("left"),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for right button").withEndpoint("right"),
e
.enum("mode_switch", ea.ALL, ["anti_flicker_mode", "quick_mode"])
.withDescription("Anti flicker mode can be used to solve blinking issues of some lights. Quick mode makes the device respond faster."),
e.action(["single_left", "double_left", "single_right", "double_right", "single_both", "double_both"]),
],
configure: async (device, coordinatorEndpoint) => {
await device
.getEndpoint(1)
.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.n1aeu1"],
model: "WS-EUK03",
vendor: "Aqara",
description: "Smart wall switch H1 EU (with neutral, single rocker)",
fromZigbee: [fz.on_off, fz.electrical_measurement, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
tz.electrical_measurement_power,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_flip_indicator_light,
lumi.toZigbee.lumi_led_disabled_night,
],
exposes: [
e.switch(),
e.action(["single", "double"]),
e.power().withAccess(ea.STATE_GET),
e.energy(),
e.flip_indicator_light(),
e.power_outage_memory(),
e.device_temperature().withAccess(ea.STATE),
e.led_disabled_night(),
e.power_outage_count(),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode"),
],
configure: async (device, coordinatorEndpoint) => {
const endpoint1 = device.getEndpoint(1);
// set "event" mode
await endpoint1.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.switch.n2aeu1"],
model: "WS-EUK04",
vendor: "Aqara",
description: "Smart wall switch H1 EU (with neutral, double rocker)",
fromZigbee: [fz.on_off, lumi.fromZigbee.lumi_power, lumi.fromZigbee.lumi_action_multistate, lumi.fromZigbee.lumi_specific],
toZigbee: [
tz.on_off,
lumi.toZigbee.lumi_power,
lumi.toZigbee.lumi_switch_operation_mode_opple,
lumi.toZigbee.lumi_switch_power_outage_memory,
lumi.toZigbee.lumi_flip_indicator_light,
lumi.toZigbee.lumi_led_disabled_night,
],
meta: { multiEndpoint: true, multiEndpointSkip: ["power", "energy"] },
endpoint: (device) => {
return { left: 1, right: 2 };
},
exposes: [
e.switch().withEndpoint("left"),
e.switch().withEndpoint("right"),
e.power().withAccess(ea.STATE_GET),
e.energy(),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for left button").withEndpoint("left"),
e.enum("operation_mode", ea.ALL, ["control_relay", "decoupled"]).withDescription("Decoupled mode for right button").withEndpoint("right"),
e.action(["single_left", "double_left", "single_right", "double_right", "single_both", "double_both"]),
e.device_temperature().withAccess(ea.STATE),
e.power_outage_memory(),
e.flip_indicator_light(),
e.led_disabled_night(),
e.power_outage_count(),
],
configure: async (device, coordinatorEndpoint) => {
const endpoint1 = device.getEndpoint(1);
// set "event" mode
await endpoint1.write("manuSpecificLumi", { mode: 1 }, { manufacturerCode: manufacturerCode, disableResponse: true });
},
extend: [lumi.modernExtend.addManuSpecificLumiCluster(), lumiZigbeeOTA(), lumiPreventReset()],
},
{
zigbeeModel: ["lumi.ctrl_neutral1"],
model: "QBKG04LM",
vendor: "Aqara",
description: "Smart wall switch (no neutral, single rocker)",
fromZigbee: [lumi.fromZ