Hi,
- Add to configuration.yaml (inside zigbee2mqtt folder) this:
external_converters:
- ext_converter_ts0011.js
- ext_converter_ts0012.js
- ext_converter_ts0013.js
Is for 1, 2 or 3 gang respectively. The problem is with 2 o 3 gang switch, but i added also the config to 1 gang to have the new exposes (power on behavior and backlight_mode). See pic:
- Create 3 files (notepad, file editor, etc) and paste the following code:
File 1: ext_converter_ts0011.js :
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 e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['TS0011'],
model: 'TS0011',
vendor: 'Moes',
description: 'Smart light switch - 1 gang without neutral wire',
extend: extend.switch(),
toZigbee: extend.switch().toZigbee.concat([tz.moes_power_on_behavior, tz.tuya_backlight_mode]),
fromZigbee: extend.switch().fromZigbee.concat([tz.moes_power_on_behavior, tz.tuya_backlight_mode]),
exposes: [e.switch(),
exposes.enum('power_on_behavior', ea.ALL, Object.values(tuya.moesSwitch.powerOnBehavior)),
exposes.enum('backlight_mode', ea.ALL, ['LOW', 'MEDIUM', 'HIGH']).withDescription('Indicator light status: LOW: Off | MEDIUM: On| HIGH: Inverted')],
whiteLabel: [{vendor: 'TUYATEC', model: 'GDKES-01TZXD'}],
meta: {multiEndpoint: false},
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await device.getEndpoint(1).read('genBasic', ['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 0xfffe]);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
device.powerSource = 'Mains (single phase)';
device.save();
},
};
module.exports = definition;
File 2: ext_converter_ts0012.js :
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 e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['TS0012'],
model: 'TS0012',
vendor: 'Moes',
description: 'Smart light switch - 2 gang without neutral wire',
extend: extend.switch(),
toZigbee: extend.switch().toZigbee.concat([tz.moes_power_on_behavior, tz.tuya_backlight_mode]),
fromZigbee: extend.switch().fromZigbee.concat([tz.moes_power_on_behavior, tz.tuya_backlight_mode]),
exposes: [e.switch().withEndpoint('left'), e.switch().withEndpoint('right'),
exposes.enum('power_on_behavior', ea.ALL, Object.values(tuya.moesSwitch.powerOnBehavior)),
exposes.enum('backlight_mode', ea.ALL, ['LOW', 'MEDIUM', 'HIGH']).withDescription('Indicator light status: LOW: Off | MEDIUM: On| HIGH: Inverted')],
endpoint: (device) => {
return {'left': 1, 'right': 2};
},
whiteLabel: [{vendor: 'TUYATEC', model: 'GDKES-02TZXD'}],
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
await device.getEndpoint(1).read('genBasic', ['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 0xfffe]);
try {
for (const ID of [1, 2]) {
const endpoint = device.getEndpoint(ID);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
}
} catch (e) {
// Fails for some: https://github.com/Koenkk/zigbee2mqtt/issues/4872
}
device.powerSource = 'Mains (single phase)';
device.save();
},
};
module.exports = definition;
File 3: ext_converter_ts0013.js :
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 e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['TS0013'],
model: 'TS0013',
vendor: 'Moes',
description: 'Smart light switch - 3 gang without neutral wire',
extend: extend.switch(),
toZigbee: extend.switch().toZigbee.concat([tz.moes_power_on_behavior, tz.tuya_backlight_mode]),
fromZigbee: extend.switch().fromZigbee.concat([tz.moes_power_on_behavior, tz.tuya_backlight_mode]),
exposes: [e.switch().withEndpoint('left'), e.switch().withEndpoint('center'), e.switch().withEndpoint('right'),
exposes.enum('power_on_behavior', ea.ALL, Object.values(tuya.moesSwitch.powerOnBehavior)),
exposes.enum('backlight_mode', ea.ALL, ['LOW', 'MEDIUM', 'HIGH']).withDescription('Indicator light status: LOW: Off | MEDIUM: On| HIGH: Inverted')],
endpoint: (device) => {
return {'left': 1, 'center': 2, 'right': 3};
},
whiteLabel: [{vendor: 'TUYATEC', model: 'GDKES-03TZXD'}],
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
await device.getEndpoint(1).read('genBasic', ['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 0xfffe]);
try {
for (const ID of [1, 2, 3]) {
const endpoint = device.getEndpoint(ID);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
}
} catch (e) {
// Fails for some: https://github.com/Koenkk/zigbee2mqtt/issues/4872
}
device.powerSource = 'Mains (single phase)';
device.save();
},
};
module.exports = definition;
Restart Zigbee2MQTT and done!! you don’t need to pair again the switches.
In github only published a fix for 3 gang switch. I modified the code to adapt to 1 and 2 gang. For me, working without problem so far…
The 3 new files must be inside Zigbee2mqtt folder!!
Saludos!!