[New device support]: Tuya TS0601 TZE204_81yrt3lo
Link
https://www.aliexpress.com/item/1005005782430275.html
Database entry
{ "ieee": "a4:c1:38:b5:cd:41:32:70", "nwk": 7491, "status": 2, "lqi": "255", "rssi": "-55", "last_seen": "1690192304.159175", "node_descriptor": "01:40:8e:41:11:42:42:00:00:2a:42:00:00", "endpoints": [ { "id": 1, "status": 1, "device_type": 81, "profile_id": 260, "manufacturer": "_TZE204_81yrt3lo", "model": "TS0601", "output_clusters": [ { "id": 25, "name": "Ota", "attributes": [] }, { "id": 10, "name": "Time", "attributes": [] } ], "input_clusters": [ { "id": 4, "name": "Groups", "attributes": [] }, { "id": 5, "name": "Scenes", "attributes": [] }, { "id": 61184, "name": "Cluster", "attributes": [] }, { "id": 0, "name": "Basic", "attributes": [ { "id": 0, "name": "zcl_version", "value": 3 }, { "id": 1, "name": "app_version", "value": 74 }, { "id": 2, "name": "stack_version", "value": 0 }, { "id": 3, "name": "hw_version", "value": 1 }, { "id": 4, "name": "manufacturer", "value": "_TZE204_81yrt3lo" }, { "id": 5, "name": "model", "value": "TS0601" }, { "id": 6, "name": "date_code", "value": "" }, { "id": 7, "name": "power_source", "value": 1 } ] } ] }, { "id": 242, "status": 1, "device_type": 97, "profile_id": 41440, "manufacturer": null, "model": null, "output_clusters": [ { "id": 33, "name": "GreenPowerProxy", "attributes": [] } ], "input_clusters": [] } ], "signature": { "manufacturer": "_TZE204_81yrt3lo", "model": "TS0601", "node_desc": { "logical_type": 1, "complex_descriptor_available": 0, "user_descriptor_available": 0, "reserved": 0, "aps_flags": 0, "frequency_band": 8, "mac_capability_flags": 142, "manufacturer_code": 4417, "maximum_buffer_size": 66, "maximum_incoming_transfer_size": 66, "server_mask": 10752, "maximum_outgoing_transfer_size": 66, "descriptor_capability_field": 0 }, "endpoints": { "1": { "profile_id": 260, "device_type": 81, "input_clusters": [ 4, 5, 61184, 0 ], "output_clusters": [ 25, 10 ] }, "242": { "profile_id": 41440, "device_type": 97, "input_clusters": [], "output_clusters": [ 33 ] } } }, "class": "zigpy.device" }
Comments
Can you help to create a converter? I do not have the product, it'f for an other user Thanks
External converter
Thanks @samartandek and other for their contribution
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 tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;
const {Buffer} = require('buffer');
const valueConverter = {
divideBy10: tuya.valueConverterBasic.divideBy(10),
divideBy100: tuya.valueConverterBasic.divideBy(100),
divideBy1000: tuya.valueConverterBasic.divideBy(1000),
};
const definition = {
fingerprint: [
{
modelID: 'TS0601',
manufacturerName: '_TZE204_81yrt3lo',
},
],
model: 'TS0601_Bidirectional_Energy_Meter_with_80A_Current_Clamp',
vendor: 'TuYa',
description: 'Bidirectional Energy Meter with 80A Current Clamp',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
whiteLabel: [ tuya.whitelabel('Tuya', 'PJ-1203A', 'Bidirectional Energy Meter with 80A Current Clamp', ['_TZE204_81yrt3lo']), ],
// whiteLabel: [{vendor: 'MatSeePlus', model: 'PJ-1203A'}],
exposes: [ //only report data
e.ac_frequency(),
exposes.numeric('total_power_A', ea.STATE).withUnit('W').withDescription('Total power A'),
exposes.numeric('total_power_B', ea.STATE).withUnit('W').withDescription('Total power B'),
exposes.numeric('total_power_AB', ea.STATE).withUnit('W').withDescription('Total power A'),
exposes.numeric('voltage', ea.STATE).withUnit('V').withDescription('Voltage'),
exposes.numeric('current_A', ea.STATE).withUnit('A').withDescription('Current A'),
exposes.numeric('current_B', ea.STATE).withUnit('A').withDescription('Current B'),
exposes.numeric('power_factor_A', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor A'),
exposes.numeric('power_factor_B', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor B'),
exposes.numeric('power_direction A', ea.STATE).withDescription('Power direction A 0/1 for forward/reverse'),
exposes.numeric('power_direction B', ea.STATE).withDescription('Power direction B 0/1 for forward/reverse'),
exposes.numeric('energy_forward_A', ea.STATE).withUnit('kWh').withDescription('Total energy A forward'),
exposes.numeric('energy_forward_B', ea.STATE).withUnit('kWh').withDescription('Total energy B forward'),
exposes.numeric('energy_reverse_A', ea.STATE).withUnit('kWh').withDescription('Total energy A reverse'),
exposes.numeric('energy_reverse_B', ea.STATE).withUnit('kWh').withDescription('Total energy B reverse'),
exposes.numeric('update_frequency', ea.STATE).withUnit('sec').withDescription('Update frequency'),
],
meta: {
tuyaDatapoints: [//only report data
[111, 'ac_frequency', tuya.valueConverter.divideBy100],
[101, 'total_power_A', tuya.valueConverter.divideBy10],
[105, 'total_power_B', tuya.valueConverter.divideBy10],
[115, 'total_power_AB', tuya.valueConverter.divideBy10],
[112, 'voltage', tuya.valueConverter.divideBy10],
[113, 'current_A', tuya.valueConverter.divideBy1000],
[114, 'current_B', tuya.valueConverter.divideBy1000],
[110, 'power_factor_A', tuya.valueConverter.divideBy100],
[121, 'power_factor_B', tuya.valueConverter.divideBy100],
[102, 'power_direction A', tuya.valueConverter.raw],
[104, 'power_direction B', tuya.valueConverter.raw],
[106, 'energy_forward_A', tuya.valueConverter.divideBy100],
[108, 'energy_forward_B', tuya.valueConverter.divideBy100],
[107, 'energy_reverse_A', tuya.valueConverter.divideBy100],
[109, 'energy_reverse_B', tuya.valueConverter.divideBy100],
[129, 'update_frequency' , tuya.valueConverter.raw],
],
},
};
module.exports = definition;
Supported color modes
No response
Color temperature range
No response
@dams74 Today I receive Energy Meter with the same manufacturer name "_TZE204_81yrt3lo" "Tuya Smart ZigBee Energy Meter Bidirection 1, 2 Channel with Current Transformer Clamp App Monitor Power 80A 110V/240V 50/60Hz", are yours are the same ?
it's this one https://www.aliexpress.com/item/1005005782430275.html
I get this information from manufacturer:
| 1 | 115 | DPID_POWER_TOTAL_ID | only report | 4 | 1. report the total power (A+B)2. big-endian, 0.1W, X103. signed (32bits) |
|---|---|---|---|---|---|
| 2 | 101 | DPID_POWER_ID_A | only report | 4 | 1. report the total power (A)2. big-endian, 0.1W, X103. unsigned int (32bits) |
| 3 | 105 | DPID_POWER_ID_B | only report | 4 | 1. report the total power (B)2.big-endian, 0.1W, X103. unsigned int (32bits) |
| 4 | 102 | DPID_POWER_DIRECTION_ID_A | only report | 1 | 0: Forward, 1:Reverse |
| 5 | 104 | DPID_POWER_DIRECTION_ID_B | only report | 1 | 0: Forward, 1:Reverse |
| 6 | 106 | DPID_FORWARD_ENERGY_TOTAL_A | only report | 4 | 1. report the forward energy (A)2. big-endian, X100,0.01KWH3. unsigned int (32bits) |
| 7 | 107 | DPID_REVERSE_ENERGY_TOTAL_A | only report | 4 | 1. report the reverse energy (A)2. big-endian, X100, 0.01KWH3. unsigned int (32bits) |
| 8 | 108 | DPID_FORWARD_ENERGY_TOTAL_B | only report | 4 | 1. report the forward energy (B)2. big-endian, X100,0.01KWH3. unsigned int (32bits) |
| 9 | 109 | DPID_REVERSE_ENERGY_TOTAL_B | only report | 4 | 1. report the reverse energy (B)2. big-endian, X100, 0.01KWH3. unsigned int (32bits) |
| 10 | 110 | DPID_POWER_FACTOR_A | only report | 4 | 1. report the power factor (A)2. big-endian, X1003. unsigned int (32bits) |
| 11 | 121 | DPID_POWER_FACTOR_B | only report | 4 | 1. report the power factor (B)2. big-endian, X1003. unsigned int (32bits) |
| 12 | 111 | DPID_POWER_FREQ | only report | 4 | 1. report the AC freq 2. big-endian, X1003. unsigned int (32bits) |
| 13 | 112 | DPID_VOLTAGE_A | only report | 4 | 1. report the Voltage 2. big-endian, X1003. unsigned int (32bits) |
| 14 | 113 | DPID_CURRENT_A | only report | 4 | 1. report the Current(A) 2. big-endian, X1003. unsigned int (32bits) |
| 15 | 114 | DPID_CURRENT_B | only report | 4 | 1. report the Current(B) 2. big-endian, X1003. unsigned int (32bits) |
| 16 | 129 | DPID_UPDATE_RATE | report/setting | 4 | 1. report the update rate2. big-endian, (3-60s)3. unsigned int (32bits) |
| 17 | 116 | DPID_VOLTAGE_A_COEF | report/setting | 4 | 1. calibration Voltage2. big-endian, X10003. unsigned int (32bits) |
| 18 | 117 | DPID_CURRENT_A_COEF | report/setting | 4 | 1. Calibration current_A2. big-endian, X10003. unsigned int (32bits) |
| 19 | 118 | DPID_POWER_A_COEF | report/setting | 4 | 1. Calibration power_A2. big-endian, X10003. unsigned int (32bits) |
| 20 | 119 | DPID_ENERGY_A_COEF | report/setting | 4 | 1. Calibration forward energy_A2. big-endian, X10003. unsigned int (32bits) |
| 21 | 127 | DPID_ENERGY_A_COEF_REV | report/setting | 4 | 1. Calibration reverse energy_A2. big-endian, X10003. unsigned int (32bits) |
| 22 | 122 | DPID_FREQ_COEF | report/setting | 4 | 1. Calibration AC freq2. big-endian, X10003. unsigned int (32bits) |
| 23 | 123 | DPID_CURRENT_B_COEF | report/setting | 4 | 1. Calibration Current_B2. big-endian, X10003. unsigned int (32bits) |
| 24 | 124 | DPID_POWER_B_COEF | report/setting | 4 | 1. Calibration Power_B2. big-endian, X10003. unsigned int (32bits) |
| 25 | 125 | DPID_ENERGY_B_COEF | report/setting | 4 | 1. Calibration forward energy_B2. big-endian, X10003. unsigned int (32bits) |
| 26 | 128 | DPID_ENERGY_B_COEF_REV | report/setting | 4 | 1. Calibration Revese energy_B2. big-endian, X10003. unsigned int (32bits) |
Hi guys and Sophie Zhang :-), i have the same unit and i made external converter for it. It's first version but all data from report only DPid all covered. From report/setting pids are only Voltage calibration supported now by default in HA=>Zigbee2mqtt addon=>setting (specific).
I don't know how to config report/setting pids in external converter. I don't have tuya zigbee gateway, i switched debug on in zigbee2mqtt to test and verify is it working properly. If you know how to test it more and add support to report/setting pids give me sign.
I got only one bad info in zigbee2mqtt log: "No converter available for 'PJ-1203A' with cluster 'manuSpecificTuya' and type 'commandMcuSyncTime' and data '{"payloadSize":XXX}'" but it's known subject by koenkk.
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 tuya = require('zigbee-herdsman-converters/lib/tuya'); const utils = require('zigbee-herdsman-converters/lib/utils'); const e = exposes.presets; const ea = exposes.access; const {Buffer} = require('buffer');
const definition = {
fingerprint: [
{
modelID: 'TS0601',
manufacturerName: '_TZE204_81yrt3lo',
},
],
model: 'TS0601_Bidirectional_Energy_Meter_with_80A_Current_Clamp',
vendor: 'TuYa',
description: 'Bidirectional Energy Meter with 80A Current Clamp',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
whiteLabel: [ tuya.whitelabel('Tuya', 'PJ-1203A', 'Bidirectional Energy Meter with 80A Current Clamp', ['_TZE204_81yrt3lo']), ],
// whiteLabel: [{vendor: 'MatSeePlus', model: 'PJ-1203A'}],
exposes: [ //only report data
e.ac_frequency(),
exposes.numeric('total_power_A', ea.STATE).withUnit('W').withDescription('Total power A'),
exposes.numeric('total_power_B', ea.STATE).withUnit('W').withDescription('Total power B'),
exposes.numeric('total_power_AB', ea.STATE).withUnit('W').withDescription('Total power AB'),
e.voltage(),
exposes.numeric('current_A', ea.STATE).withUnit('A').withDescription('Current A'),
exposes.numeric('current_B', ea.STATE).withUnit('A').withDescription('Current B'),
exposes.numeric('power_factor_A', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor A'),
exposes.numeric('power_factor_B', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor B'),
exposes.numeric('power_direction A', ea.STATE).withDescription('Power direction A 0/1 for forward/reverse'),
exposes.numeric('power_direction B', ea.STATE).withDescription('Power direction B 0/1 for forward/reverse'),
exposes.numeric('energy_forward_A', ea.STATE).withUnit('kWh').withDescription('Total energy A forward'),
exposes.numeric('energy_forward_B', ea.STATE).withUnit('kWh').withDescription('Total energy B forward'),
exposes.numeric('energy_reverse_A', ea.STATE).withUnit('kWh').withDescription('Total energy A reverse'),
exposes.numeric('energy_reverse_B', ea.STATE).withUnit('kWh').withDescription('Total energy B reverse'),
exposes.numeric('update_frequency', ea.STATE).withUnit('sec').withDescription('Update frequency'),
],
meta: {
tuyaDatapoints: [//only report data
[111, 'ac_frequency', tuya.valueConverter.divideBy100],
[101, 'total_power_A', tuya.valueConverter.divideBy10],
[105, 'total_power_B', tuya.valueConverter.divideBy10],
[115, 'total_power_AB', tuya.valueConverter.divideBy10],
[112, 'voltage', tuya.valueConverter.divideBy10],
[113, 'current_A', tuya.valueConverter.divideBy1000],
[114, 'current_B', tuya.valueConverter.divideBy1000],
[110, 'power_factor_A', tuya.valueConverter.divideBy100],
[121, 'power_factor_B', tuya.valueConverter.divideBy100],
[102, 'power_direction A', tuya.valueConverter.raw],
[104, 'power_direction B', tuya.valueConverter.raw],
[106, 'energy_forward_A', tuya.valueConverter.divideBy100],
[108, 'energy_forward_B', tuya.valueConverter.divideBy100],
[107, 'energy_reverse_A', tuya.valueConverter.divideBy100],
[109, 'energy_reverse_B', tuya.valueConverter.divideBy100],
[129, 'update_frequency' , tuya.valueConverter.raw],
],
},
};
module.exports = definition;
screenshoots:
Hey @samartandek. I am new to Zigbee2MQTT and I would like to know, where I have to enter the code you send above. I have the same device and switched from ZHA to Zigbee2MQTT because of it.
Hey @samartandek. I am new to Zigbee2MQTT and I would like to know, where I have to enter the code you send above. I have the same device and switched from ZHA to Zigbee2MQTT because of it.
Found it!
But there is a error message... :-( Have no idea what's wrong.
can not read a block mapping entry; a multiline key may not be an implicit key (55:14)
52 | const ea = exposes.access;
53 | const {Buffer} = require('buffer');
54 | const valueConverter = {
55 | dvideBy10: tuya.valueConverterBasic.divi ...
-------------------^
56 | divideBy100: tuya.valueConverterBasic.di ...
Copy and past all code which i post to new file called Tuya_TZE204_81yrt3lo.js After that add 2 lines like that below to configuration.yaml where you has zigbe2mqtt installation directory. external_converters:
- Tuya_TZE204_81yrt3lo.js
You have error in line 55 because you ate one sign i must be divide not dvide
best regards smartandek
śr., 2 sie 2023, 18:55 użytkownik FlowFrank @.***> napisał:
Hey @samartandek https://github.com/samartandek. I am new to Zigbee2MQTT and I would like to know, where I have to enter the code you send above. I have the same device and switched from ZHA to Zigbee2MQTT because of it.
Found it!
But there is a error message... :-( Have no idea what's wrong.
can not read a block mapping entry; a multiline key may not be an implicit key (55:14)
52 | const ea = exposes.access; 53 | const {Buffer} = require('buffer'); 54 | const valueConverter = { 55 | dvideBy10: tuya.valueConverterBasic.divi ... -------------------^ 56 | divideBy100: tuya.valueConverterBasic.di ...
— Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee2mqtt/issues/18419#issuecomment-1662587103, or unsubscribe https://github.com/notifications/unsubscribe-auth/A45GFRYGGPI25BMA4S7ICRLXTKA6TANCNFSM6AAAAAA2V4HFN4 . You are receiving this because you were mentioned.Message ID: @.***>
Hi guys and Sophie Zhang :-), i have the same unit and i made external converter for it. It's first version but all data from report only DPid all covered. From report/setting pids are only Voltage calibration supported now by default in HA=>Zigbee2mqtt addon=>setting (specific).
I don't know how to config report/setting pids in external converter. I don't have tuya zigbee gateway, i switched debug on in zigbee2mqtt to test and verify is it working properly. If you know how to test it more and add support to report/setting pids give me sign.
I got only one bad info in zigbee2mqtt log: "No converter available for 'PJ-1203A' with cluster 'manuSpecificTuya' and type 'commandMcuSyncTime' and data '{"payloadSize":XXX}'" but it's known subject by koenkk.
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 tuya = require('zigbee-herdsman-converters/lib/tuya'); const utils = require('zigbee-herdsman-converters/lib/utils'); const e = exposes.presets; const ea = exposes.access; const {Buffer} = require('buffer');
const valueConverter = { divideBy10: tuya.valueConverterBasic.divideBy(10), divideBy100: tuya.valueConverterBasic.divideBy(100), };
const definition = { fingerprint: [ { modelID: 'TS0601', manufacturerName: '_TZE204_81yrt3lo', }, ], model: 'TS0601_Bidirectional_Energy_Meter_with_80A_Current_Clamp', vendor: 'TuYa', description: 'Bidirectional Energy Meter with 80A Current Clamp', fromZigbee: [tuya.fz.datapoints], //, fz.ignore_tuya_set_time not working for No converter available for friendly_name with cluster manuSpecificTuya and type commandMcuSyncTime and data {payloadSize:XXX} toZigbee: [tuya.tz.datapoints], onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime' configure: tuya.configureMagicPacket, whiteLabel: [ tuya.whitelabel('Tuya', 'PJ-1203A', 'Bidirectional Energy Meter with 80A Current Clamp', ['_TZE204_81yrt3lo']), ], // whiteLabel: [{vendor: 'MatSeePlus', model: 'PJ-1203A'}], exposes: [ //only report data e.ac_frequency(), exposes.numeric('total_power_A', ea.STATE).withUnit('W').withDescription('Total power A'), exposes.numeric('total_power_B', ea.STATE).withUnit('W').withDescription('Total power B'), exposes.numeric('total_power_AB', ea.STATE).withUnit('W').withDescription('Total power A'), exposes.numeric('voltage', ea.STATE).withUnit('V').withDescription('Voltage'), exposes.numeric('current_A', ea.STATE).withUnit('A').withDescription('Current A'), exposes.numeric('current_B', ea.STATE).withUnit('A').withDescription('Current B'), exposes.numeric('power_factor_A', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor A'), exposes.numeric('power_factor_B', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor B'), exposes.numeric('power_direction A', ea.STATE).withDescription('Power direction A 0/1 for forward/reverse'), exposes.numeric('power_direction B', ea.STATE).withDescription('Power direction B 0/1 for forward/reverse'), exposes.numeric('energy_forward_A', ea.STATE).withUnit('kWh').withDescription('Total energy A forward'), exposes.numeric('energy_forward_B', ea.STATE).withUnit('kWh').withDescription('Total energy B forward'), exposes.numeric('energy_reverse_A', ea.STATE).withUnit('kWh').withDescription('Total energy A reverse'), exposes.numeric('energy_reverse_B', ea.STATE).withUnit('kWh').withDescription('Total energy B reverse'), exposes.numeric('update_frequency', ea.STATE).withUnit('sec').withDescription('Update frequency'), ],
meta: { tuyaDatapoints: [//only report data [111, 'ac_frequency', tuya.valueConverter.divideBy100], [101, 'total_power_A', tuya.valueConverter.divideBy10], [105, 'total_power_B', tuya.valueConverter.divideBy10], [115, 'total_power_AB', tuya.valueConverter.divideBy10], [112, 'voltage', tuya.valueConverter.divideBy10], [113, 'current_A', tuya.valueConverter.divideBy100], [114, 'current_B', tuya.valueConverter.divideBy100], [110, 'power_factor_A', tuya.valueConverter.divideBy100], [121, 'power_factor_B', tuya.valueConverter.divideBy100], [102, 'power_direction A', tuya.valueConverter.raw], [104, 'power_direction B', tuya.valueConverter.raw], [106, 'energy_forward_A', tuya.valueConverter.divideBy100], [108, 'energy_forward_B', tuya.valueConverter.divideBy100], [107, 'energy_reverse_A', tuya.valueConverter.divideBy100], [109, 'energy_reverse_B', tuya.valueConverter.divideBy100], [129, 'update_frequency' , tuya.valueConverter.raw], ], },};
module.exports = definition;
screenshoots:
I have successfully implemented this as you... but I'm always getting 0 values and total powers... did you get real values?
It's working for me too. However, the measured values cannot be correct.
I checked returned values with different zigbee energy meter socket with 25w bulb. Different clamp dirrection on the same power line can return you Total power 0. Check values with only one clamp Connected to single power L wire.
czw., 3 sie 2023, 12:57 użytkownik FlowFrank @.***> napisał:
It's working for me too. However, the measured values cannot be correct.
— Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee2mqtt/issues/18419#issuecomment-1663773409, or unsubscribe https://github.com/notifications/unsubscribe-auth/A45GFR42RDCGKDCKB7AU54DXTN73JANCNFSM6AAAAAA2V4HFN4 . You are receiving this because you were mentioned.Message ID: @.***>
I checked returned values with different zigbee energy meter socket with 25w bulb. Different clamp dirrection on the same power line can return you Total power 0. Check values with only one clamp Connected to single power L wire. czw., 3 sie 2023, 12:57 użytkownik FlowFrank @.***> napisał: …
I Just find out the problem! I was using a 4w led lamp and that was too low to measure. Just tried it with a 40w and everything works as expected.
@SoulOnFire @FlowFrank @samartandek
Hello Thanks to do this samartandek It's the first time i do this. I'm new user of Zigbee2mqtt. If i understand:
- Make a new file called Tuya_TZE204_81yrt3lo.js with this inside: (where put this file?)
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 tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;
const {Buffer} = require('buffer');
const valueConverter = {
divideBy10: tuya.valueConverterBasic.divideBy(10),
divideBy100: tuya.valueConverterBasic.divideBy(100),
};
const definition = {
fingerprint: [
{
modelID: 'TS0601',
manufacturerName: '_TZE204_81yrt3lo',
},
],
model: 'TS0601_Bidirectional_Energy_Meter_with_80A_Current_Clamp',
vendor: 'TuYa',
description: 'Bidirectional Energy Meter with 80A Current Clamp',
fromZigbee: [tuya.fz.datapoints], //, fz.ignore_tuya_set_time not working for No converter available for friendly_name with cluster manuSpecificTuya and type commandMcuSyncTime and data {payloadSize:XXX}
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
configure: tuya.configureMagicPacket,
whiteLabel: [ tuya.whitelabel('Tuya', 'PJ-1203A', 'Bidirectional Energy Meter with 80A Current Clamp', ['_TZE204_81yrt3lo']), ],
// whiteLabel: [{vendor: 'MatSeePlus', model: 'PJ-1203A'}],
exposes: [ //only report data
e.ac_frequency(),
exposes.numeric('total_power_A', ea.STATE).withUnit('W').withDescription('Total power A'),
exposes.numeric('total_power_B', ea.STATE).withUnit('W').withDescription('Total power B'),
exposes.numeric('total_power_AB', ea.STATE).withUnit('W').withDescription('Total power A'),
exposes.numeric('voltage', ea.STATE).withUnit('V').withDescription('Voltage'),
exposes.numeric('current_A', ea.STATE).withUnit('A').withDescription('Current A'),
exposes.numeric('current_B', ea.STATE).withUnit('A').withDescription('Current B'),
exposes.numeric('power_factor_A', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor A'),
exposes.numeric('power_factor_B', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor B'),
exposes.numeric('power_direction A', ea.STATE).withDescription('Power direction A 0/1 for forward/reverse'),
exposes.numeric('power_direction B', ea.STATE).withDescription('Power direction B 0/1 for forward/reverse'),
exposes.numeric('energy_forward_A', ea.STATE).withUnit('kWh').withDescription('Total energy A forward'),
exposes.numeric('energy_forward_B', ea.STATE).withUnit('kWh').withDescription('Total energy B forward'),
exposes.numeric('energy_reverse_A', ea.STATE).withUnit('kWh').withDescription('Total energy A reverse'),
exposes.numeric('energy_reverse_B', ea.STATE).withUnit('kWh').withDescription('Total energy B reverse'),
exposes.numeric('update_frequency', ea.STATE).withUnit('sec').withDescription('Update frequency'),
],
meta: {
tuyaDatapoints: [//only report data
[111, 'ac_frequency', tuya.valueConverter.divideBy100],
[101, 'total_power_A', tuya.valueConverter.divideBy10],
[105, 'total_power_B', tuya.valueConverter.divideBy10],
[115, 'total_power_AB', tuya.valueConverter.divideBy10],
[112, 'voltage', tuya.valueConverter.divideBy10],
[113, 'current_A', tuya.valueConverter.divideBy100],
[114, 'current_B', tuya.valueConverter.divideBy100],
[110, 'power_factor_A', tuya.valueConverter.divideBy100],
[121, 'power_factor_B', tuya.valueConverter.divideBy100],
[102, 'power_direction A', tuya.valueConverter.raw],
[104, 'power_direction B', tuya.valueConverter.raw],
[106, 'energy_forward_A', tuya.valueConverter.divideBy100],
[108, 'energy_forward_B', tuya.valueConverter.divideBy100],
[107, 'energy_reverse_A', tuya.valueConverter.divideBy100],
[109, 'energy_reverse_B', tuya.valueConverter.divideBy100],
[129, 'update_frequency' , tuya.valueConverter.raw],
],
},
};
module.exports = definition;
- Add 2 lines in to configuration.yaml where is zigbe2mqtt installation directory.
external_converters:
- Tuya_TZE204_81yrt3lo.js
Is it correct?
Dams74
Hi Thanks @samartandek
In my case i had to change "[113, 'current_A', tuya.valueConverter.divideBy1000]" because current_A was displayed wrong
Hi Thanks @samartandek
In my case i had to change "[113, 'current_A', tuya.valueConverter.divideBy1000]" because current_A was displayed wrong
I also added this line but I don't know if it was necessary
Hi guys Divideby(1000) is not nessesary in my opinion because divide by 1000 not used by report data in pids table. I have pids table from another/correct source and reports only pids use only divider by 10 and 100. But you can put your values as you want. niedz., 6 sie 2023, 10:59 użytkownik anonymous66va @.> napisał: … Hi Thanks @samartandek https://github.com/samartandek In my case i had to change "[113, 'current_A', tuya.valueConverter.divideBy1000]" because current_A was displayed wrong I also added this line but I don't know if it was necessary [image: 2023-08-06_10-56-38] https://user-images.githubusercontent.com/85165779/258631765-ec561c3d-7398-43a7-80ff-d8e72dd84192.png — Reply to this email directly, view it on GitHub <#18419 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A45GFR3XX3MT3WJGRVXFORLXT5MGBANCNFSM6AAAAAA2V4HFN4 . You are receiving this because you were mentioned.Message ID: @.>
This was the status before divide by 1000 Let me thank you for your great job!! Ohm said W=V x I In this case the power is ok but not the amperage
This is what it looks like when I changed it to 1000
tuyaDatapoints: [//only report data
[111, 'ac_frequency', tuya.valueConverter.divideBy100],
[101, 'total_power_A', tuya.valueConverter.divideBy10],
[105, 'total_power_B', tuya.valueConverter.divideBy10],
[115, 'total_power_AB', tuya.valueConverter.divideBy10],
[112, 'voltage', tuya.valueConverter.divideBy10],
[113, 'current_A', tuya.valueConverter.divideBy1000],
[114, 'current_B', tuya.valueConverter.divideBy1000],
[110, 'power_factor_A', tuya.valueConverter.divideBy100],
[121, 'power_factor_B', tuya.valueConverter.divideBy100],
and as it is in the original, i.e. 100
As you can see the current_A are distorted
Sorry guys, specially for anonymous66va and Toma82. You have totally right, current A & B must by divided by 1000 because Ohm rules.
I got table with pids from manufacturer with wrong divider for current. I updated my post with external converter. Thank for your alert.
Sorry guys, specially for anonymous66va and Toma82. You have totally right, current A & B must by divided by 1000 because Ohm rules.
I got table with pids from manufacturer with wrong divider for current. I updated my post with external converter. Thank for your alert.
Ottimo lavoro !
Dear @samartandek , could you modify the external converter file to adjust the powers calibrations / coefficients (118,124)? It would be great if we can adjust them from the z2m settings (specific )interface. many thanks
Hi guys and Sophie Zhang :-), i have the same unit and i made external converter for it. It's first version but all data from report only DPid all covered. From report/setting pids are only Voltage calibration supported now by default in HA=>Zigbee2mqtt addon=>setting (specific).
I don't know how to config report/setting pids in external converter. I don't have tuya zigbee gateway, i switched debug on in zigbee2mqtt to test and verify is it working properly. If you know how to test it more and add support to report/setting pids give me sign.
I got only one bad info in zigbee2mqtt log: "No converter available for 'PJ-1203A' with cluster 'manuSpecificTuya' and type 'commandMcuSyncTime' and data '{"payloadSize":XXX}'" but it's known subject by koenkk.
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 tuya = require('zigbee-herdsman-converters/lib/tuya'); const utils = require('zigbee-herdsman-converters/lib/utils'); const e = exposes.presets; const ea = exposes.access; const {Buffer} = require('buffer');
const valueConverter = { divideBy10: tuya.valueConverterBasic.divideBy(10), divideBy100: tuya.valueConverterBasic.divideBy(100), divideBy1000: tuya.valueConverterBasic.divideBy(1000), };
const definition = { fingerprint: [ { modelID: 'TS0601', manufacturerName: '_TZE204_81yrt3lo', }, ], model: 'TS0601_Bidirectional_Energy_Meter_with_80A_Current_Clamp', vendor: 'TuYa', description: 'Bidirectional Energy Meter with 80A Current Clamp', fromZigbee: [tuya.fz.datapoints], toZigbee: [tuya.tz.datapoints], onEvent: tuya.onEventSetTime, configure: tuya.configureMagicPacket, whiteLabel: [ tuya.whitelabel('Tuya', 'PJ-1203A', 'Bidirectional Energy Meter with 80A Current Clamp', ['_TZE204_81yrt3lo']), ], // whiteLabel: [{vendor: 'MatSeePlus', model: 'PJ-1203A'}], exposes: [ //only report data e.ac_frequency(), exposes.numeric('total_power_A', ea.STATE).withUnit('W').withDescription('Total power A'), exposes.numeric('total_power_B', ea.STATE).withUnit('W').withDescription('Total power B'), exposes.numeric('total_power_AB', ea.STATE).withUnit('W').withDescription('Total power A'), exposes.numeric('voltage', ea.STATE).withUnit('V').withDescription('Voltage'), exposes.numeric('current_A', ea.STATE).withUnit('A').withDescription('Current A'), exposes.numeric('current_B', ea.STATE).withUnit('A').withDescription('Current B'), exposes.numeric('power_factor_A', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor A'), exposes.numeric('power_factor_B', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor B'), exposes.numeric('power_direction A', ea.STATE).withDescription('Power direction A 0/1 for forward/reverse'), exposes.numeric('power_direction B', ea.STATE).withDescription('Power direction B 0/1 for forward/reverse'), exposes.numeric('energy_forward_A', ea.STATE).withUnit('kWh').withDescription('Total energy A forward'), exposes.numeric('energy_forward_B', ea.STATE).withUnit('kWh').withDescription('Total energy B forward'), exposes.numeric('energy_reverse_A', ea.STATE).withUnit('kWh').withDescription('Total energy A reverse'), exposes.numeric('energy_reverse_B', ea.STATE).withUnit('kWh').withDescription('Total energy B reverse'), exposes.numeric('update_frequency', ea.STATE).withUnit('sec').withDescription('Update frequency'), ],
meta: { tuyaDatapoints: [//only report data [111, 'ac_frequency', tuya.valueConverter.divideBy100], [101, 'total_power_A', tuya.valueConverter.divideBy10], [105, 'total_power_B', tuya.valueConverter.divideBy10], [115, 'total_power_AB', tuya.valueConverter.divideBy10], [112, 'voltage', tuya.valueConverter.divideBy10], [113, 'current_A', tuya.valueConverter.divideBy1000], [114, 'current_B', tuya.valueConverter.divideBy1000], [110, 'power_factor_A', tuya.valueConverter.divideBy100], [121, 'power_factor_B', tuya.valueConverter.divideBy100], [102, 'power_direction A', tuya.valueConverter.raw], [104, 'power_direction B', tuya.valueConverter.raw], [106, 'energy_forward_A', tuya.valueConverter.divideBy100], [108, 'energy_forward_B', tuya.valueConverter.divideBy100], [107, 'energy_reverse_A', tuya.valueConverter.divideBy100], [109, 'energy_reverse_B', tuya.valueConverter.divideBy100], [129, 'update_frequency' , tuya.valueConverter.raw], ], },};
module.exports = definition;
screenshoots:
Works like a charm on my device thank you !!





