Zigbee2mqtt moes switch problem

I also have this problem. It appeared around a week ago.

They changed the structure of external converters in newer versions of zigbee2mqtt. We need to rewrite the given js files accordingly to the new template. Otherwise, downgrading the zigbee2mqtt to 1.28.1-1 version “solves” the issue.

For 1gang:

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 = {
    fingerprint: [{modelID: 'TS0011', manufacturerName: '_TZ3000_hhiodade'}],
    model: 'TS0011',
    vendor: 'Moes',
    description: 'Smart light switch - 1 gang without neutral wire',
    extend: tuya.extend.switch({switchType: true, backlightMode: true}),
    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'}],
    configure: async (device, coordinatorEndpoint, logger) => {
      await device.getEndpoint(1).read('genBasic', ['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 0xfffe]);
      await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']);
      device.powerSource = 'Mains (single phase)';
      device.save();  
    },
};

module.exports = definition;

For 2gang:

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 = {
    fingerprint: [{modelID: 'TS0012', manufacturerName: '_TZ3000_18ejxno0'}],
    model: 'TS0012',
    vendor: 'Moes',
    description: 'Smart light switch - 2 gang without neutral wire',
    extend: tuya.extend.switch({switchType: true, backlightMode: true, endpoints: ['left', 'right']}),
    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;

For 3gang, it works for me by default, so I didn’t do the external converter for it, guess you can tweak from 2 gang…

EDITED: made the backlight_mode values lowercase so HA can remember the setting.

1 Like

I had external converters for TS0011 and TS0012 switches. Before z2m version 1.28.4-1 this was working. I tried yours but it doesn’t expose back light mode any more.

My Zigbee2MQTT version = 1.28.4 commit: 52e545f.

Questions:

  1. Have you checked if the external converter entries (filenames) are being added to the configuration.yaml?
  2. Have you restarted z2m?

This is my configuration.yaml file

external_converters:
  - ext_converter_ts0011.js
  - ext_converter_ts0012.js

I restarted z2m even stop it and start it again but back light is not exposed on switches.
Edit:
This is what I have in z2m

Zigbee Model        TS0011
Zigbee Manufacturer     _TZ3000_hafsqare
Manufacturer     TuYa
Model    TS0011

Ah… I see where the issue might be now…

Try replacing the line fingerprint with zigbeeModel: ['TS0011'], I coded with fingerprint against my devices’ specs exactly. :sweat_smile:

2 Likes

Great, thank you. Now it is exposed.

Thanks for posting updated converters. My 3gang also works by default from now.

Hello, i changed the file as requested but still getting the error below:

/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?

I’ve already added the external converter entries to the configuration.yaml, restart z2m and clear cache as well.

Zigbee2mqtt version: [1.29.1]

Thanks

The posted solution above stopped forking for me in the newest Zigbee2mqtt as well.

External converters no longer needed in the newest zigbee2mqtt version, at least in my case. Power on and backlight features are working directly from pure z2m add-on.

Hello
I have the same issue only with the 3 gang Moes switch (Whenever I switch on/off one of the switches (left or right) the other side activates/deactivates too. )
I am very new so I post my changes because it doesn’t work for me. curiously my 2 gang Moes have no issue

So I change my config. yaml like this :

{
  "external_converters": [
  - ext_converter_ts0011.js
  - ext_converter_ts0012.js
  - ext_converter_ts0013.js],
  "devices": [
    "devices.yaml"
  ],
  "groups": [
    "groups.yaml"
  ],
  "homeassistant"``
and for  ext_converter_ts0013.js

`{\rtf1\ansi\ansicpg1252\cocoartf2639
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red255\green255\blue255;\red89\green98\blue106;
}
{\*\expandedcolortbl;;\cssrgb\c0\c1\c1;\cssrgb\c100000\c100000\c100000\c0;\cssrgb\c42493\c46033\c49065;
}
\paperw11900\paperh16840\margl1440\margr1440\vieww11520\viewh14380\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0

\f0\fs24 \cf0 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 = \{\
    fingerprint: [\{modelID: 'TS0013\'92, manufacturerName: '\cf2 \cb3 \expnd0\expndtw0\kerning0
_TZ3000_qewo8dlz\cf0 \cb1 \kerning1\expnd0\expndtw0 '\}],\
    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;}

I don’t know where I am wrong

Hi is there a way i can fix this issue with ZHA?

2 Likes

The inclusion in Mqtt is probably a part of the problem. I have change to ZHA (the issue was different) and then go back to Mqtt: now my 3 gang works well and my 2 gang have my previous 3gang problem. WTF

Hi, i have Moes 3gang touch switch EU, it’s identified as


is that ok?

How does the backlight work? I was hoping, it has two colors/LEDs on each button, one for backlight and one for enabled switch, but it does not seem to be the case.

only one light.
you can configure it but the default state is none for off and on for on

I’m experiencing the switching of both halves of a Moes 2-gang with ZHA too. Happy to experiment with a fix if someone can point to me to the relevant part of the HA source…

Chris

1 Like

yeah, so no two color light like on my wifi switches

I have the same problem, but, in my case I have the Skyconnect V 1.0 zigbee integration. Anyone knows how to solve the issue with this new integration?