Koenkk / zigbee2mqtt

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

[New device support]: Zemismart TB26-4 new fingerprint #20944

Closed willrnsantana closed 7 months ago

willrnsantana commented 7 months ago

Link

https://www.zemismart.com/products/tb26-4

Database entry

{"id":4,"type":"Router","ieeeAddr":"0xa4c138860c91aa63","nwkAddr":12001,"manufId":4417,"manufName":"_TZE204_shkxsgis","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":{"65503":"\u0007\u0000\u0000\u0000\u0012\u0006\u0000\u0000\u0000e\u0007\u0000\u0000\u0000\u0012\u0006\u0000\u0000\u0000e\u0007\u0000\u0000\u0000\u0012\u0006\u0000\u0000\u0000e\u0007\u0000\u0000\u0000\u0012\u0006\u0000\u0000\u0000e","65506":56,"65508":0,"65534":0,"modelId":"TS0601","manufacturerName":"_TZE204_shkxsgis","powerSource":1,"zclVersion":3,"appVersion":74,"stackVersion":0,"hwVersion":1,"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":{"configured":-708457359},"lastSeen":1705938019097,"defaultSendRequestWhen":"immediate"}

Comments

I was able to add the device creating a converter. It was necessary despite the device was shown as supported (https://www.zigbee2mqtt.io/devices/TB26-4.html) It seems there's a new fingerprint starting with 204

External defintion

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 = {
    // Since a lot of TuYa devices use the same modelID, but use different datapoints
    // it's necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE204_shkxsgis',
        },
    ],
    model: 'TB26-4 ',
    vendor: 'Zemismart',
    description: '4-gang smart wall switch with neutral wire',
    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: [
        // Here you should put all functionality that your device exposes
        tuya.exposes.switch().withEndpoint('l1'),
        tuya.exposes.switch().withEndpoint('l2'),
        tuya.exposes.switch().withEndpoint('l3'),
        tuya.exposes.switch().withEndpoint('l4'),
    ],
    endpoint: (device) => {
            return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1};
        },
    meta: {
        // All datapoints go in here
        multiEndpoint: true,
        tuyaDatapoints: [
            [1, 'state_l1', tuya.valueConverter.onOff],
            [2, 'state_l2', tuya.valueConverter.onOff],
            [3, 'state_l3', tuya.valueConverter.onOff],
            [4, 'state_l4', tuya.valueConverter.onOff],
        ],
    },
};

module.exports = definition;
Koenkk commented 7 months ago

Added, thanks!

Changes will be available in the dev branch tomorrow