How to support new device KnockoutX/Moes TS0601, _TZ3000_iv6ph5tr

Over at zigbee2mqtt on Github, I placed a request for a new device TS0601, _TZ3000_iv6ph5tr - KnockautX FMS2C017/maybe MOES ZRM-104B-MS with all needed details.

Zigbee2MQTT disregards this proposed converter and does not use it at all. Instead Z2M chooses, for no reason, the integrated converter “Tuya” “TS011F_plug_1” . With this, however, a completely wrong device is assigned to this module.


Surprisingly, in ZHA this module is recognised as “TS011F by _TZ3000_iv6ph5tr” and the quirk “zhaoquirks.tuya.ts011f_switch.Tuya_2G_Switch” is used. This allows me to switch the two channels on/off as needed. OK, the functions “Countdown” and “Restart status” are not recognised here either, but they don’t matter to me at the moment.

My question now is how to integrate this device into Z2M, whether and how to rewrite the ZHA Quirk into a working Z2M converter.

My other module KnockautX FMD2C018/maybe MOES ZM-105B-MS was successfully integrated with the Z2M converter.

Datapoint extracted according FAQ entry.

|DP|Decription|
| --- | --- |
|1|Switch 1|
|2|Switch 2|
|9|Countdown 1|
|10|Countdown 2|
|27|Restart status|

Standard Instruction Set from Device Debugging .

|Code|Type|Values|
| --- | --- | --- |
|switch_1|Boolean|"{true,false}"|
|switch_2|Boolean|"{true,false}"|
|countdown_1|Integer|{"unit": "s","min": 0,"max": 43200,"scale": 0,"step": 1}|
|countdown_2|Integer|{"unit": "s","min": 0,"max": 43200,"scale": 0,"step": 1}|
|relay_status|Enum|{"range": ["power_off","power_on","last"]}|

Used converter settings.
Version 1

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 e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    //fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_pmz6mjyu'}],
    fingerprint: tuya.fingerprint('TS011F', ['_TZ3000_pmz6mjyu']),
    model: 'FMS2C017',
    vendor: 'KnockautX Intelligent Home by Brelag AG Switzerland',
    description: 'Smart light switch module (2 gang)',
    extend: tuya.extend.switch({endpoints: ['l1', 'l2']}),
    meta: {multiEndpoint: true},
    endpoint: (device) => {
        return {l1: 1, l2: 2};
    },
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint1 = device.getEndpoint(1);
        await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff']);
        await reporting.onOff(endpoint1);
        const endpoint2 = device.getEndpoint(2);
        await reporting.bind(endpoint2, coordinatorEndpoint, ['genOnOff']);
        await reporting.onOff(endpoint2);
    },
};
module.exports = definition;

Version 2:

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 e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    //fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_pmz6mjyu'}],
    fingerprint: tuya.fingerprint('TS011F', ['_TZ3000_pmz6mjyu']),
    model: 'FMS2C017',
    vendor: 'KnockautX Intelligent Home by Brelag AG Switzerland',
    description: '2 gang switch',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
	onEvent: tuya.onEventSetTime, 
    configure: tuya.configureMagicPacket,
    exposes: [
        tuya.exposes.switch().withEndpoint('l1'),
        tuya.exposes.switch().withEndpoint('l2'),
        tuya.exposes.countdown().withEndpoint('l1'),
        tuya.exposes.countdown().withEndpoint('l2'),
        // Both of the following exposes do not work either
        // e.enum('power_on_behavior', ea.STATE_SET, ['off', 'on', 'previous']),
        // or
        // e.power_on_behavior(['off', 'on', 'previous']).withAccess(ea.STATE_SET),
    ],
    meta: {
        multiEndpoint: true,
        tuyaDatapoints: [
        	// Channel 1
            [1, 'state_l1', tuya.valueConverter.onOff],
            [9, 'countdown_l1', tuya.valueConverter.countdown],
            // Channel 2
            [2, 'state_l2', tuya.valueConverter.onOff,], 
            [10, 'countdown_l2', tuya.valueConverter.countdown],
            // All channels
            [27, 'Restart status', tuya.valueConverter.powerOnBehaviorEnum],
        ],
    },
    endpoint: (device) => {
        return {'l1': 1, 'l2': 1};
    },
};

// export default definitions;
module.exports = definition;

At first glance, the converter fingerprints don’t look like they have the proper manufacturer id.

This question has been solved through a new implementation of the new devices in question.