Skip to content

Instantly share code, notes, and snippets.

@Koenkk
Last active December 23, 2022 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Koenkk/e4c1baa313af39ccd3ac8e5cf5d48675 to your computer and use it in GitHub Desktop.
Save Koenkk/e4c1baa313af39ccd3ac8e5cf5d48675 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 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: ['TS0012'],
model: 'TS0012',
vendor: 'TuYa',
description: 'Smart light switch - 2 gang',
whiteLabel: [{vendor: 'Vrey', model: 'VR-X712U-0013'}, {vendor: 'TUYATEC', model: 'GDKES-02TZXD'},
{vendor: 'Earda', model: 'ESW-2ZAA-EU'}],
extend: tuya.extend.switch({backlightMode: true, endpoints: ['left', 'right']}),
endpoint: (device) => {
return {'left': 1, 'right': 2};
},
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']);
await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']);
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