Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.21k stars 1.68k forks source link

[New device support]: TS0601 _TZE204_rdapejm5 Heavy Duty Single Switch #22924

Open exxtreme5 opened 5 months ago

exxtreme5 commented 5 months ago

Link

https://www.aliexpress.com/item/1005005465432069.html?spm=a2g0o.order_list.order_list_main.70.a13d18029UHALL

Database entry

{"id":30,"type":"Router","ieeeAddr":"0xa4c1389231670a2d","nwkAddr":36777,"manufId":4417,"manufName":"_TZE204_rdapejm5","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[4,5,61184,0],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"stackVersion":0,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":74,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1717469377365}

Comments

I tried to add this device and show unsupported. After a lot of poking around with the external converters and with the endpoints, I still can't it to work. The debug doesn't show the log data of this switch so will be helpful if someone can help point me in the right direction. Thanks!

External definition

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

const definition = {
    fingerprint: [
        {
            modelID: 'TS0601',
            manufacturerName: '_TZE204_rdapejm5',
        },
    ],
    model: 'TS0601_new',
    vendor: 'Tuya',
    description: 'Heavy Duty Zigbee Switch 30A',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime,
    configure: tuya.configureMagicPacket,
    exposes: [
    ],
    meta: {
        tuyaDatapoints: [
        ],
    },
    extend: [
    ],
};

module.exports = definition;
tag1394 commented 2 months ago

try this

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 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 = { fingerprint: [ { modelID: 'TS0601', manufacturerName: '_TZE204_rdapejm5', }, ], model: 'TS0601', vendor: 'Tuya', description: '1 gang 30A smart switch', fromZigbee: [tuya.fz.datapoints], toZigbee: [tuya.tz.datapoints], onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime' configure: tuya.configureMagicPacket, exposes: [ e.switch().setAccess('state', ea.STATE_SET), tuya.exposes.backlightModeOffOn(), e.binary('child_lock', ea.STATE_SET, 'ON', 'OFF').withDescription('Child Lock'), e.power_on_behavior().withAccess(ea.STATE_SET), e.enum('indicator_light', ea.STATE_SET, ['presence', 'off', 'on']).withDescription('Controls when the indicator light is turned on'), ], meta: { // All datapoints go in here tuyaDatapoints: [ [1, 'state', tuya.valueConverter.onOff], [14, 'power_on_behavior', tuya.valueConverter.powerOnBehaviorEnum], [15, 'indicator_light', tuya.valueConverterBasic.lookup({presence: tuya.enum(0), off: tuya.enum(1), on: tuya.enum(2)})], [16,'backlight_mode', tuya.valueConverter.onOff], [101,'child_lock',tuya.valueConverter.onOff], ],

},
extend: [
    // A preferred new way of extending functionality.
],

};

module.exports = definition;