Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zemismart Tuya Zigbee 3 Phase Electric Energy SPM02-D2TZ #18561

Closed
xstefa12 opened this issue Aug 8, 2023 · 9 comments
Closed

Zemismart Tuya Zigbee 3 Phase Electric Energy SPM02-D2TZ #18561

xstefa12 opened this issue Aug 8, 2023 · 9 comments
Labels
new device support New device support request

Comments

@xstefa12
Copy link

xstefa12 commented Aug 8, 2023

Link

https://www.zemismart.com/products/spm02-d2tz

Database entry

{"id":19,"type":"Router","ieeeAddr":"0x187a3efffe357a64","nwkAddr":33371,"manufId":4098,"manufName":"_TZE200_ves1ycwx","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"modelId":"TS0601","manufacturerName":"_TZE200_ves1ycwx","stackVersion":0,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":68,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1691524249775,"defaultSendRequestWhen":"immediate"}

Comments

Visually looks like Schneider Electric A9MEM1570 https://www.zigbee2mqtt.io/devices/A9MEM1570.html ...

External converter

No response

Supported color modes

No response

Color temperature range

No response

@xstefa12 xstefa12 added the new device support New device support request label Aug 8, 2023
@neosloter
Copy link

This device works with an external convector.
Added like this:
In addon settings:

external_converters:
   - TS0601_new.js

Create TS0601_new.js file in z2m folder with contents:

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: '_TZE200_ves1ycwx',
        },
    ],
        model: 'SPM02',
        vendor: 'TuYa',
        description: 'Smart energy monitor for 3P+N system',
        fromZigbee: [tuya.fz.datapoints],
        toZigbee: [tuya.tz.datapoints],
        configure: tuya.configureMagicPacket,
        exposes: [tuya.exposes.voltageWithPhase('X'), tuya.exposes.voltageWithPhase('Y'), tuya.exposes.voltageWithPhase('Z'),
            tuya.exposes.powerWithPhase('X'), tuya.exposes.powerWithPhase('Y'), tuya.exposes.powerWithPhase('Z'),
            tuya.exposes.currentWithPhase('X'), tuya.exposes.currentWithPhase('Y'), tuya.exposes.currentWithPhase('Z'),
            // Change the description according to the specifications of the device
            e.energy().withDescription('Total forward active energy'),
            e.produced_energy().withDescription('Total reverse active energy'),
        ],
    meta: {
        tuyaDatapoints: [
            [1, 'energy', tuya.valueConverter.divideBy100],
            [2, 'produced_energy', tuya.valueConverter.divideBy100],
            [6, null, tuya.valueConverter.phaseVariant2WithPhase('X')],
            [7, null, tuya.valueConverter.phaseVariant2WithPhase('Y')],
            [8, null, tuya.valueConverter.phaseVariant2WithPhase('Z')],
            ],
    },
};


module.exports = definition;

@xstefa12
Copy link
Author

Hello neosloter, thank you, it's working.! Is there any chance to read other parameters like on Schneider one?

@Koenkk
Copy link
Owner

Koenkk commented Aug 14, 2023

This device is supported now: Koenkk/zigbee-herdsman-converters#6076

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

@Koenkk Koenkk closed this as completed Aug 14, 2023
@almirus
Copy link

almirus commented Oct 10, 2023

Hi! @Koenkk Please add error code display, especially for overheating. Thank you.

{
                        "abilityId": 9,
                        "accessMode": "ro",
                        "code": "fault",
                        "description": "1,告警\\n2,大端模式,HEX,4字节\\n3,报文格式\\n按照完整4个字节,对应的告警位上报告警;bit位,1表示有告警,0表示无告警;如果没用的告警位,补0。高位无定义,也补0;\\n举例:0X00 00 00 09,表示当前发生了漏电自检不正常告警和短路告警,无其它告警。\\n4,通信逻辑\\n只要有1个告警发生,就完整4个字节上报给面板;只要有1个告警关闭,就完整4个字节上报给面板,更新面板显示。",
                        "extensions": {
                            "iconName": "icon-baojing",
                            "attribute": "128"
                        },
                        "name": "故障告警",
                        "typeSpec": {
                            "label": ["short_circuit_alarm", "surge_alarm", "overload_alarm", "leakagecurr_alarm", "temp_dif_fault", "fire_alarm", "high_power_alarm", "self_test_alarm", "ov_cr", "unbalance_alarm", "ov_vol", "undervoltage_alarm", "miss_phase_alarm", "outage_alarm", "magnetism_alarm", "credit_alarm", "no_balance_alarm"],
                            "maxlen": 17,
                            "type": "bitmap",
                            "typeDefaultValue": 0
                        }
                    },

image

⬇️⬇️⬇️

all DPs

{
        "modelId": "000002yenr",
        "services": [{
                "actions": [],
                "code": "",
                "description": "",
                "events": [],
                "name": "默认服务",
                "properties": [{
                        "abilityId": 1,
                        "accessMode": "ro",
                        "code": "total_forward_energy",
                        "description": "",
                        "extensions": {
                            "iconName": "icon-dp_lightning",
                            "attribute": "128"
                        },
                        "name": "累计正向有功电能",
                        "typeSpec": {
                            "max": 99999999,
                            "min": 0,
                            "scale": 2,
                            "step": 1,
                            "type": "value",
                            "typeDefaultValue": 0,
                            "unit": "kW·h"
                        }
                    }, {
                        "abilityId": 2,
                        "accessMode": "ro",
                        "code": "cur_neutral",
                        "description": "",
                        "extensions": {
                            "iconName": "icon-power1",
                            "attribute": "128"
                        },
                        "name": "累计反向有功电能",
                        "typeSpec": {
                            "max": 99999999,
                            "min": 0,
                            "scale": 2,
                            "step": 1,
                            "type": "value",
                            "typeDefaultValue": 0,
                            "unit": "kW.h"
                        }
                    }, {
                        "abilityId": 6,
                        "accessMode": "ro",
                        "code": "phase_a",
                        "description": "1,A相电压,电流及功率\\n2,大端模式,HEX格式,共8个字节\\n3,单位精度:电压,2字节,单位0.1V。电流,3字节,单位 0.001A 。A相有功功率,3字节,单位0.0001kW\\n4,报文格式\\n举例:08 80 00 03 E8 00 27 10 表示A相217.6V,A相电流1.000A,A相功率10.000KW\\n5,通信逻辑:\\n1)用户进面板,主动查询。用户进入面板,面板马上下发0x08到电表,电表上报数据到云平台,面板拿到数据,然后展示。 注:最新WIFI支持。   \\n2)电表基于一定周期上报数据。建议:在WIFI模式时,15秒上报一次。NB模式时,1个小时上报一次。",
                        "extensions": {
                            "iconName": "icon-dp_lightning",
                            "attribute": "128"
                        },
                        "name": "A相电压,电流及功率",
                        "typeSpec": {
                            "maxlen": 128,
                            "type": "raw"
                        }
                    }, {
                        "abilityId": 7,
                        "accessMode": "ro",
                        "code": "phase_b",
                        "description": "1,B相电压,电流及功率\\n2,大端模式,HEX格式,共8个字节\\n3,单位精度:电压,2字节,单位0.1V。电流,3字节,单位 0.001A 。B相有功功率,3字节,单位0.0001kW\\n4,报文格式\\n举例:08 80 00 03 E8 00 27 10 表示B相217.6V,B相电流1.000A,B相功率10.000KW\\n5,通信逻辑:\\n1)用户进面板,主动查询。用户进入面板,面板马上下发0x00到电表,电表上报数据到云平台,面板拿到数据,然后展示。    \\n2)电表基于一定周期上报数据。建议:在WIFI模式时,15秒上报一次。NB模式时,1个小时上报一次。",
                        "extensions": {
                            "iconName": "icon-dp_lightning",
                            "attribute": "128"
                        },
                        "name": "B相电压,电流及功率",
                        "typeSpec": {
                            "maxlen": 128,
                            "type": "raw"
                        }
                    }, {
                        "abilityId": 8,
                        "accessMode": "ro",
                        "code": "phase_c",
                        "description": "1,C相电压,电流及功率\\n2,大端模式,HEX格式,共8个字节\\n3,单位精度:电压,2字节,单位0.1V。电流,3字节,单位 0.001A 。C相有功功率,3字节,单位0.0001kW\\n4,报文格式\\n举例:08 80 00 03 E8 00 27 10 表示C相217.6V,C相电流1.000A,C相功率10.000KW\\n5,通信逻辑:\\n1)用户进面板,主动查询。用户进入面板,面板马上下发0x08到电表,电表上报数据到云平台,面板拿到数据,然后展示。    \\n2)电表基于一定周期上报数据。建议:在WIFI模式时,15秒上报一次。NB模式时,1个小时上报一次。",
                        "extensions": {
                            "iconName": "icon-dp_lightning",
                            "attribute": "128"
                        },
                        "name": "C相电压,电流及功率",
                        "typeSpec": {
                            "maxlen": 128,
                            "type": "raw"
                        }
                    }, {
                        "abilityId": 9,
                        "accessMode": "ro",
                        "code": "fault",
                        "description": "1,告警\\n2,大端模式,HEX,4字节\\n3,报文格式\\n按照完整4个字节,对应的告警位上报告警;bit位,1表示有告警,0表示无告警;如果没用的告警位,补0。高位无定义,也补0;\\n举例:0X00 00 00 09,表示当前发生了漏电自检不正常告警和短路告警,无其它告警。\\n4,通信逻辑\\n只要有1个告警发生,就完整4个字节上报给面板;只要有1个告警关闭,就完整4个字节上报给面板,更新面板显示。",
                        "extensions": {
                            "iconName": "icon-baojing",
                            "attribute": "128"
                        },
                        "name": "故障告警",
                        "typeSpec": {
                            "label": ["short_circuit_alarm", "surge_alarm", "overload_alarm", "leakagecurr_alarm", "temp_dif_fault", "fire_alarm", "high_power_alarm", "self_test_alarm", "ov_cr", "unbalance_alarm", "ov_vol", "undervoltage_alarm", "miss_phase_alarm", "outage_alarm", "magnetism_alarm", "credit_alarm", "no_balance_alarm"],
                            "maxlen": 17,
                            "type": "bitmap",
                            "typeDefaultValue": 0
                        }
                    }, {
                        "abilityId": 11,
                        "accessMode": "rw",
                        "code": "switch_prepayment",
                        "description": "",
                        "extensions": {
                            "iconName": "icon-dp_money",
                            "attribute": "1152"
                        },
                        "name": "预付费功能开关",
                        "typeSpec": {
                            "type": "bool",
                            "typeDefaultValue": false
                        }
                    }, {
                        "abilityId": 12,
                        "accessMode": "rw",
                        "code": "clear_energy",
                        "description": "",
                        "extensions": {
                            "iconName": "icon-dp_lightning",
                            "attribute": "1152"
                        },
                        "name": "余额清零",
                        "typeSpec": {
                            "type": "bool",
                            "typeDefaultValue": false
                        }
                    }, {
                        "abilityId": 13,
                        "accessMode": "ro",
                        "code": "balance_energy",
                        "description": "",
                        "extensions": {
                            "iconName": "icon-dp_lightning",
                            "attribute": "1152"
                        },
                        "name": "余额",
                        "typeSpec": {
                            "max": 99999999,
                            "min": 0,
                            "scale": 2,
                            "step": 1,
                            "type": "value",
                            "typeDefaultValue": 0,
                            "unit": "kW·h"
                        }
                    }, {
                        "abilityId": 14,
                        "accessMode": "rw",
                        "code": "charge_energy",
                        "description": "",
                        "extensions": {
                            "iconName": "icon-dp_money",
                            "attribute": "1152"
                        },
                        "name": "电量充值",
                        "typeSpec": {
                            "max": 999999,
                            "min": 0,
                            "scale": 2,
                            "step": 1,
                            "type": "value",
                            "typeDefaultValue": 0,
                            "unit": "kW·h"
                        }
                    }, {
                        "abilityId": 17,
                        "accessMode": "rw",
                        "code": "alarm_set_1",
                        "description": "1,告警阈值使能控制及设置2  \\n2,HEX格式,大端模式, 总告警的数量*4字节= 设置告警总长度。\\n3,报文格式\\n每个告警由4个字节组成,第1个字节(表示该告警存在);第2个字节(发生此告警时,断路器控制模式(0X01拉闸,0X00不动作只告警);第3、4字节:设置告警阈值\\n举例:0X01 01 00 00 03 01 00 14,表示该断路器支持短路告警,发生该告警时,自动跳闸,阀值补0。支持过载告警,发生该告警时,拉闸动作,动作阀值20KW。无其它告警。\\n4,通信逻辑\\nA,配网成功后,按照上面的格式,主动上报给云平台,面板知道哪些告警是断路器当前支持的。设置不成功,重新配网再上报。\\nB,断路器上电时,也上报一次。\\nC,面板根据协议下发告警设置。",
                        "extensions": {
                            "iconName": "icon-dp_warming",
                            "attribute": "128"
                        },
                        "name": "告警设置1",
                        "typeSpec": {
                            "maxlen": 128,
                            "type": "raw"
                        }
                    }, {
                        "abilityId": 18,
                        "accessMode": "rw",
                        "code": "alarm_set_2",
                        "description": "1,告警阈值使能控制及设置2  \\n2,HEX格式,大端模式\\n3,报文格式\\n每个告警由4个字节组成,第1个字节(表示该告警存在);第2个字节(发生此告警时,断路器控制模式(0X01拉闸,0X00不动作只告警);第3、4字节:设置告警阈值\\n举例:0X01 01 00 3C 03 01 00 F5,表示该断路器支持过流告警,发生该告警时,拉闸动作,动作阀值60A。支持过压告警,发生该告警时,拉闸动作,动作阀值245V\\n4,通信逻辑\\nA,配网成功后,按照上面的格式,主动上报给云平台,面板知道哪些告警是断路器当前支持的。设置不成功,重新配网再上报。\\nB,断路器上电时,也上报一次。\\nC,面板根据协议下发告警设置。",
                        "extensions": {
                            "iconName": "icon-dp_warming",
                            "attribute": "128"
                        },
                        "name": "告警设置2",
                        "typeSpec": {
                            "maxlen": 128,
                            "type": "raw"
                        }
                    }
                ]
            }
        ]
    }

@Koenkk
Copy link
Owner

Koenkk commented Oct 10, 2023

could you make a pr to add this?

@almirus
Copy link

almirus commented Oct 10, 2023

@Koenkk I'm sorry, I don't know TypeScript very well.

@elektrinis
Copy link

elektrinis commented Dec 7, 2023

Thank you for your work.
Currently it is reporting values every 5 seconds. Is it possible to change to 1s, etc?
Edit: also it reports negative power as positive.

@ishehov
Copy link

ishehov commented Jan 19, 2024

Is it possible to make it report values not that frequent though?

@almirus
Copy link

almirus commented Jan 19, 2024

@ishehov
image

Debounces messages of this device. When setting e.g. debounce: 1 and a message from a device is received, Zigbee2MQTT will not immediately publish this message. But it will combine it with other messages that are received max 1 seconds apart from each other. So there needs to be "N second of silence" from the device before the combined message is sent out.

For example debounce: 5 means that there needs to be "5 seconds of silence" from the device, before combined messages is sent out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device support New device support request
Projects
None yet
Development

No branches or pull requests

6 participants