Koenkk / zigbee2mqtt

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

[New device support]: Tuya ZigBee ZMB9-Z-4P 3-phase circuit breaker/power meter [TS0601 _TZE200_abatw3kj] #19598

Open xardas-eu opened 11 months ago

xardas-eu commented 11 months ago

Link

https://allegro.pl/oferta/bezpiecznik-nadpradowy-zigbee-4p-3-fazy-tuya-1-63a-12422973030

Database entry

{"id":50,"type":"Router","ieeeAddr":"0xa4c138d758167c4f","nwkAddr":52651,"manufId":4417,"manufName":"_TZE200_abatw3kj","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":"���,i���,i���,i���,i���,i���,i\b��,i","65506":54,"65508":0,"65534":0,"modelId":"TS0601","manufacturerName":"_TZE200_abatw3kj","powerSource":1,"zclVersion":3,"appVersion":70,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":70,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":-1440156621},"lastSeen":1699287930807,"defaultSendRequestWhen":"immediate"}

Comments

There was a ticket about this device already but it got no traction :( https://github.com/Koenkk/zigbee2mqtt/issues/14859

Creating this issue hoping that somebody has figured the device out (especially how to read per-phase power readings, both instant (W) and total (kWh)

The converter I use for testing produces this debug output:

2023-11-06 17:33:09zigbee-herdsman-converters:: NOT RECOGNIZED DP #19 with data {"seq":61187,"dpValues":[{"dp":19,"datatype":3,"data":{"type":"Buffer","data":[69,84,85,49,45,73,79,84,45,90,105,103,98,101,101,0]}}]} VALUE = ETU1-IOT-Zigbee 2023-11-06 17:33:09zigbee-herdsman-converters:: NOT RECOGNIZED DP #19 with data {"seq":61187,"dpValues":[{"dp":19,"datatype":3,"data":{"type":"Buffer","data":[69,84,85,49,45,73,79,84,45,90,105,103,98,101,101,0]}}]} VALUE = ETU1-IOT-Zigbee 2023-11-06 17:33:27zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":61955,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:33:27zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":61955,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:33:27zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":61955,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:33:27zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":61955,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:33:27zigbee-herdsman-converters:: NOT RECOGNIZED DP #18 with data {"seq":62467,"dpValues":[{"dp":18,"datatype":0,"data":{"type":"Buffer","data":[1,1,0,100,3,1,1,19,4,1,0,175]}}]} VALUE = d� 2023-11-06 17:33:27zigbee-herdsman-converters:: NOT RECOGNIZED DP #18 with data {"seq":62467,"dpValues":[{"dp":18,"datatype":0,"data":{"type":"Buffer","data":[1,1,0,100,3,1,1,19,4,1,0,175]}}]} VALUE = d� 2023-11-06 17:33:28zigbee-herdsman-converters:: NOT RECOGNIZED DP #19 with data {"seq":62723,"dpValues":[{"dp":19,"datatype":3,"data":{"type":"Buffer","data":[69,84,85,49,45,73,79,84,45,90,105,103,98,101,101,0]}}]} VALUE = ETU1-IOT-Zigbee 2023-11-06 17:33:28zigbee-herdsman-converters:: NOT RECOGNIZED DP #19 with data {"seq":62723,"dpValues":[{"dp":19,"datatype":3,"data":{"type":"Buffer","data":[69,84,85,49,45,73,79,84,45,90,105,103,98,101,101,0]}}]} VALUE = ETU1-IOT-Zigbee 2023-11-06 17:33:45zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":63491,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:33:45zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":63491,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:33:45zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":63491,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:33:45zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":63491,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:33:45zigbee-herdsman-converters:: NOT RECOGNIZED DP #18 with data {"seq":64003,"dpValues":[{"dp":18,"datatype":0,"data":{"type":"Buffer","data":[1,1,0,100,3,1,1,19,4,1,0,175]}}]} VALUE = d� 2023-11-06 17:33:45zigbee-herdsman-converters:: NOT RECOGNIZED DP #18 with data {"seq":64003,"dpValues":[{"dp":18,"datatype":0,"data":{"type":"Buffer","data":[1,1,0,100,3,1,1,19,4,1,0,175]}}]} VALUE = d� 2023-11-06 17:33:46zigbee-herdsman-converters:: NOT RECOGNIZED DP #19 with data {"seq":64259,"dpValues":[{"dp":19,"datatype":3,"data":{"type":"Buffer","data":[69,84,85,49,45,73,79,84,45,90,105,103,98,101,101,0]}}]} VALUE = ETU1-IOT-Zigbee 2023-11-06 17:34:03zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":65027,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:34:03zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":65027,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:34:03zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":65027,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:34:03zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":65027,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0 2023-11-06 17:34:03zigbee-herdsman-converters:: NOT RECOGNIZED DP #18 with data {"seq":4,"dpValues":[{"dp":18,"datatype":0,"data":{"type":"Buffer","data":[1,1,0,100,3,1,1,19,4,1,0,175]}}]} VALUE = d� 2023-11-06 17:34:03zigbee-herdsman-converters:: NOT RECOGNIZED DP #18 with data {"seq":4,"dpValues":[{"dp":18,"datatype":0,"data":{"type":"Buffer","data":[1,1,0,100,3,1,1,19,4,1,0,175]}}]} VALUE = d� 2023-11-06 17:34:04zigbee-herdsman-converters:: NOT RECOGNIZED DP #19 with data {"seq":260,"dpValues":[{"dp":19,"datatype":3,"data":{"type":"Buffer","data":[69,84,85,49,45,73,79,84,45,90,105,103,98,101,101,0]}}]} VALUE = ETU1-IOT-Zigbee

External converter

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

const fzLocal = {
    tuya_dinrail_switch: {
        cluster: 'manuSpecificTuya',
        type: ['commandDataResponse', 'commandDataReport'],
        convert: (model, msg, publish, options, meta) => {
            for (const dpValue of msg.data.dpValues) {
                const value = legacy.getDataValue(dpValue);
                const dp = dpValue.dp
                meta.logger.info(`RECEIVED DP #${dp} -- VALUE = ${value}`);

                switch (dp) {
                    case 16: // DPID that we added to common
                        return {
                            state: value ? 'ON' : 'OFF'
                        };
                    case 1:
                        return {
                            energy: value / 100
                        };
                    case 6:   
                     return {
                            current: (value[4] / 1000), voltage: (value[1]), power: value[7]
                        };
                    case 9:{
                        meta.logger.warn(`zigbee-herdsman-converters:: NOT RECOGNIZED DP ` +
                            `#${dp} with data ${JSON.stringify(msg.data)} VALUE = ${value}`);
                    };
                    case 17:{
                        meta.logger.warn(`zigbee-herdsman-converters:: NOT RECOGNIZED DP ` +
                            `#${dp} with data ${JSON.stringify(msg.data)} VALUE = ${value}`);
                    };
                    case 18:{
                        meta.logger.warn(`zigbee-herdsman-converters:: NOT RECOGNIZED DP ` +
                            `#${dp} with data ${JSON.stringify(msg.data)} VALUE = ${value}`);
                    };
                    default: {
                        meta.logger.warn(`zigbee-herdsman-converters:: NOT RECOGNIZED DP ` +
                            `#${dp} with data ${JSON.stringify(msg.data)} VALUE = ${value}`);
                    };
                }
            }
        },
    },
};

const tzLocal = {
    state: {
        key: ['state'],
        convertSet: async (entity, key, value, meta) => {
            await tuya.sendDataPointBool(entity, 16, value === 'ON');
        },
    },

};

const definition = {
    fingerprint: [{
        modelID: 'TS0601',
        manufacturerName: '_TZE200_abatw3kj'
    }],
    model: 'ZMB9-Z-4P',
    vendor: 'GOMEDIA',
    extend: extend.switch(),
    description: 'Circuit breaker 4P with meter',
    fromZigbee: [fzLocal.tuya_dinrail_switch, ],
    toZigbee: [tzLocal.state],
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
    },
    exposes: [e.switch().setAccess('state', ea.STATE_SET), e.voltage(), e.power(), e.current(), e.energy()],
};

module.exports = definition;

Supported color modes

No response

Color temperature range

No response

clumsy-stefan commented 7 months ago

Anyone made any progress on this? I have a similar device which identifies as _TZE200_wbhaespm.

Any help would be gratly appreciated!

xardas-eu commented 7 months ago

Yeah I figured it out but I don't have good news. This device is just not capable of metering the used energy, nor does it report the electric current

clumsy-stefan commented 7 months ago

I did some more debugging and received the manufacturer documentation (in chinese, machine translated to english). I succeeded in creating a template, with all the DP's, see details here I do get measurements for energy, voltage and current though..

EDIT:

Here's an example from the status, incl. the trip/alarm values, etc.:

{
    "alarm": 0,
    "alarm_set_1": {
        "0": 3,
        "1": 1,
        "2": 0,
        "3": 30,
        "4": 4,
        "5": 1,
        "6": 0,
        "7": 30,
        "8": 5,
        "9": 1,
        "10": 0,
        "11": 80
    },
    "alarm_set_2": {
        "0": 1,
        "1": 1,
        "2": 0,
        "3": 63,
        "4": 3,
        "5": 1,
        "6": 1,
        "7": 19,
        "8": 4,
        "9": 1,
        "10": 0,
        "11": 160,
        "12": 8,
        "13": 0,
        "14": 0,
        "15": 10
    },
    "current_a": 0,
    "current_b": 0,
    "current_c": 0,
    "energy": 2.5,
    "last_seen": "2024-03-10T20:12:46+01:00",
    "linkquality": 255,
    "power_a": 0,
    "power_b": 0,
    "power_c": 0,
    "remaining": 0,
    "serial": "0000000000",
    "state": "OFF",
    "temperature": 220,
    "voltage_a": 227,
    "voltage_b": 229.5,
    "voltage_c": 227.7,
    "device": {
        "applicationVersion": 70,
        "dateCode": "",
        "friendlyName": "ug_poolheizung",
        "hardwareVersion": 1,
        "ieeeAddr": "0xa4c138fb653cf22d",
        "manufacturerID": 4417,
        "manufacturerName": "_TZE200_wbhaespm",
        "model": "TS0601",
        "networkAddress": 17224,
        "powerSource": "Mains (single phase)",
        "stackVersion": 0,
        "type": "Router",
        "zclVersion": 3
    }
}
xardas-eu commented 7 months ago

I was able to do the similar thing for my device but the reported data seemed trash and there was no incremental count anywhere. The "current" was forever stuck at 1A and only voltage on the 1st phase seemed to be correct. Does your device produce more believable data?

On Sun, Mar 10, 2024 at 8:11 PM clumsy-stefan @.***> wrote:

I did some more debugging and received the manufacturer documentation (in chinese, machine translated to english). I succeeded in creating a template, with all the DP's, see details here https://github.com/Koenkk/zigbee-herdsman-converters/issues/7181

— Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee2mqtt/issues/19598#issuecomment-1987334683, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFC46Q5PXMU5FP7E62RBDTYXSV43AVCNFSM6AAAAAA67ZPNYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGMZTINRYGM . You are receiving this because you authored the thread.Message ID: @.***>

-- Pozdrawiam Bartłomiej Maciejowski

clumsy-stefan commented 7 months ago

I guess so yes, but it's only sent about once an hour for the three phases and once a day for the temperature... only DP's 1,9,16,19 are sent regularly (Energy, Alarm, Switch State, Serial-Nr).

I'm waiting for a tuya GW to connect the breaker to and sniff the data/change the reporting interval (which according to the documentation should be possible)...

After factory reset you need to. make sure that you have a network connection within 10s otherwise it seems to go into some low-power-mode, probably it won't send actively anymore then, as there seems to eb a command to request the actual data...

xardas-eu commented 7 months ago

Hmm, your device may be more capable than mine. Care to share a link where you got it?

niedz., 10 mar 2024, 20:20 użytkownik clumsy-stefan < @.***> napisał:

I guess so yes, but it's only sent about once an hour for the three phases and once a day for the temperature... only DP's 1,9,16,19 are sent regularly (Energy, Alarm, Switch State, Serial-Nr).

I'm waiting for a tuya GW to connect the breaker to and sniff the data/change the reporting interval (which according to the documentation should be possible)...

— Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee2mqtt/issues/19598#issuecomment-1987336848, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFC46TW4F7B4QJDBPVD74TYXSXADAVCNFSM6AAAAAA67ZPNYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGMZTMOBUHA . You are receiving this because you authored the thread.Message ID: @.***>

clumsy-stefan commented 7 months ago

Got it from Aliexpress: https://de.aliexpress.com/item/1005005749883633.html I have three 2P and one 4P. Only the 4P in use currently...

xardas-eu commented 7 months ago

Sweet! Looks like yours is indeed more capable. The one I got does not mention power metering specifically, I just assumed it would have it when I bought it :D

I'll be getting that unit, many thanks!

niedz., 10 mar 2024, 20:54 użytkownik clumsy-stefan < @.***> napisał:

Got it from Aliexpress: https://de.aliexpress.com/item/1005005749883633.html I have three 2P and one 4P. Only the 4P in use currently...

— Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee2mqtt/issues/19598#issuecomment-1987344576, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFC46WIPPXTPKI5E6NW4VLYXS27BAVCNFSM6AAAAAA67ZPNYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGM2DINJXGY . You are receiving this because you authored the thread.Message ID: @.***>

clumsy-stefan commented 7 months ago

I made some progress on mine, especially on the fault-results and some of the functions. Still trying to make the alarm-settings available in z2m, but some more debugging needed. Let me know if you need the latest version...

xardas-eu commented 7 months ago

@clumsy-stefan how does your energy usage data look like? is it believable? my only purpose for this device is to track the energy and I held off of buying it yet because I wanna make sure I don't waste my money. thanks!

clumsy-stefan commented 7 months ago

Currently yes, I think so, but I have little to nothing attached behind currently as I use it as a switch and leakage protection for special purposes. For this I still need some time to verify the readings...

I also have the TS011F_ TZ3000_lepzuhto in use (single phase) which works very well for exact this purpose (measurement and switching)...

However I made some progress on the RCBO again last night, by now I can set all the different triggers as in the original tuya app and get all values/alarms back. See here.

xardas-eu commented 7 months ago

Thanks for quick response! I pulled the trigger and ordered it, should get it early April :) Could you share your latest quirk? I am a developer (not too familiar with z2m ecosystem though) so I may be able to contribute in some way when I get the device.

clumsy-stefan commented 7 months ago

see above mentioned issue 7181, the complete running template is in there, just save it to a .js file and include it in configuration.yaml!

xardas-eu commented 6 months ago

@clumsy-stefan I got the device and connected it. Happy to report that it (and your converter) works as expected, although on z2m 1.33.0 I had to replace tuya with legacy.sendDataPointRaw

and on more recent version (1.36.0) it does not pick up the converter at all. do you know why might that be?

still, many thanks!

clumsy-stefan commented 6 months ago

I'm running 1.36.0 commit: 2a53b8e5 without issues... can't say why...

xardas-eu commented 6 months ago

Weird.. is the version posted here - https://github.com/Koenkk/zigbee-herdsman-converters/issues/7181 - the most recent or were there any changes since?

github-actions[bot] commented 1 week ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days