Skip to content

Instantly share code, notes, and snippets.

@Koenkk

Koenkk/ext.js Secret

Created July 16, 2023 06:28
Show Gist options
  • Save Koenkk/76b452f7564e8db2654989ea097442d7 to your computer and use it in GitHub Desktop.
Save Koenkk/76b452f7564e8db2654989ea097442d7 to your computer and use it in GitHub Desktop.
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const legacy = require('zigbee-herdsman-converters/lib/legacy');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['lumi.relay.c2acn01'],
model: 'LLKZMK11LM',
vendor: 'Xiaomi',
description: 'Aqara wireless relay controller',
fromZigbee: [fz.xiaomi_basic, fz.xiaomi_power, fz.ignore_multistate_report, fz.on_off, fz.xiaomi_basic_raw],
meta: {multiEndpoint: true},
toZigbee: [tz.on_off, tz.LLKZMK11LM_interlock, tz.xiaomi_power, tz.xiaomi_switch_power_outage_memory],
endpoint: (device) => {
return {'l1': 1, 'l2': 2};
},
exposes: [e.power().withAccess(ea.STATE_GET), e.energy(), e.device_temperature(), e.voltage(), e.current(),
e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'), e.power_outage_count(false),
e.power_outage_memory(),
e.binary('interlock', ea.STATE_SET, true, false)
.withDescription('Enabling prevents both relais being on at the same time'),
],
ota: ota.zigbeeOTA,
configure: async (device, coordinatorEndpoint, logger) => {
await device.getEndpoint(1).removeFromGroup(0);
device.powerSource = 'Mains (single phase)';
device.save();
},
};
module.exports = definition;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment