Zigbee2mqtt moes switch problem

I have a couple of 2-Gang MOES switches, although the touch version. Yes, they work without capacitors. But on some LED lamps not as they should (if the load is too little).

I had a conversation with Moes CS some time ago about the latter. They send me capacitors thereafter although those switches were also promoted as “No capacitor needed”. After installing the capacitors all went to normal.

Note: If you have a neutral line going to the switches you obviously don’t need capacitors!

As Daniel already has pointed it out, be careful to wire them correctly! If you by mistake connect L to L1 or L2 they will instantly break and show signs like you are describing. If this happens, they are only good for the trash bin.

I don’t have neutral wire except on stairs. And I had to hire electrician to do that. I have also moes and bseed zigbee switches. They are based on the same chip, also touch ones and I never had a problem with led bulb. And some of the bulbs are really cheap ones.

Lucky you :+1:t3:

Hi, the problem is with the new firmware versión 1.1.0. The switch work ok with tuya or smart life app, but no with zb2mqtt. The problem affect the 2 and 3 gang versión. I started with the problem after upgrade the firmware (app smartlife suggested the update).

The solution is posted in zb2mqtt github. You have to add a external converter file/script to zb2mqtt config folder. Works perfect for me with TS0012 and TS0013 switch. Even add some extra config like power on behavior and backlight status (indicator of light status)

I can post the steps to follow if you need in a other post (now I go to sleep)…

I would appreciate it if you could post the steps.

I wired them accordingly to the pinout. Today I received another two switches. After pairing, they behave like the previous ones.

Look at Rodrigo’s post. I suspect the culprit is the firmare version of their newer devices (1.1.0).

I saw it, tried to find the answer on GitHub as he mentioned but I can’t find it.

Maybe this

Hi,

  1. 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:

  1. 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!!

9 Likes

Thank you very much for the answer. I’m going to test the solution right now.

1 Like

I can confirm this solution repairs the switches. Thank you very much, I really appreciate your help. Also, big thanks to everyone here who spent some time trying to help me debugging the issue.

1 Like

good to hear that the fix worked!!

Thank you for sharing. I will try this allthough I don’t experience problems.

The backlight mode happened to be very useful. I set up an automation which makes the switches light up during the night so I can see where the switches are. When morning comes, the backlight is being turned off.

You saved me so much head scratching, thank you! For once this is exactly what I was googling for!

Is there a similar procedure for zha?

1 Like

same question for ZHA I would love to be able to have the blue light on all the time to help find the switch in the dark.

Hi,

when trying to add an external converter, zigbee2mqtt stops loading and there is an error in the logs:
/app/node_modules/zigbee-herdsman-converters/index.js:91
if (converter.options) {
^
TypeError: Cannot read properties of undefined (reading ‘options’)
at Object.addDefinition [as addDeviceDefinition] (/app/node_modules/zigbee-herdsman-converters/index.js:91:23)
at new ExternalConverters (/app/lib/extension/externalConverters.ts:15:17)
at new Controller (/app/lib/controller.ts:84:58)
at start(/app/index.js:106:18)

What could be wrong?