Skip to content

Instantly share code, notes, and snippets.

@Koenkk

Koenkk/ext.js Secret

Last active March 10, 2024 18:22
Show Gist options
  • Save Koenkk/8e665bf0c40a5c39a9dda421e1ba4345 to your computer and use it in GitHub Desktop.
Save Koenkk/8e665bf0c40a5c39a9dda421e1ba4345 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 {onOff, electricityMeter} = require('zigbee-herdsman-converters/lib/modernExtend');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['LDSENK02S'],
model: 'LDSENK02S',
vendor: 'ADEO',
description: 'ENKI LEXMAN 16A EU smart plug',
extend: extend.switch({exposes: [e.power(), e.energy(), e.voltage(), e.current()], fromZigbee: [fz.electrical_measurement, fz.metering]}),
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']);
await reporting.onOff(endpoint);
await reporting.activePower(endpoint);
await reporting.rmsVoltage(endpoint);
await reporting.rmsCurrent(endpoint);
await reporting.activePower(endpoint);
await reporting.currentSummDelivered(endpoint);
await reporting.readMeteringMultiplierDivisor(endpoint);
},
};
module.exports = definition;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment