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

[New device support]: Unsupported Zigbee device model 'TS0601' and manufacturer name '_TZE200_rks0sgb7' #18734

Closed
1vanj0 opened this issue Aug 25, 2023 · 34 comments
Labels
new device support New device support request

Comments

@1vanj0
Copy link

1vanj0 commented Aug 25, 2023

Link

https://es.aliexpress.com/item/1005005931365212.html

Database entry

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

Comments

I'm having issues with Z2M to recognise this device. I haven't found info about this manufacturer in Google. No info.
I try to add the external converters to the config file following the first comment of Koenkk of this thread:

#14571

But after that the addon of Z2M don't load.

Any help would be welcome. Thanks.

Regards,

External converter

No response

Supported color modes

No response

Color temperature range

No response

@1vanj0 1vanj0 added the new device support New device support request label Aug 25, 2023
@1vanj0 1vanj0 changed the title [New device support]: Unsupported Zigbee device model 'TS0601' and manufacturer name '_TZE200_TZE200_rks0sgb7' [New device support]: Unsupported Zigbee device model 'TS0601' and manufacturer name '_TZE200_rks0sgb7' Aug 25, 2023
@Deub31
Copy link

Deub31 commented Aug 26, 2023

Hi.
Same thing for me.
I also tried with ZHA and nothing too.
This device is not currently supported by HA ...
If anyone can help us that would be great, thanks !

@drug123
Copy link

drug123 commented Sep 14, 2023

This clam energy meter resembles _TZE204_81yrt3lo (TuYa PJ-1203A) implemented in Z2M. I have no confirmation whether data points for these two are the same at the moment but if anyone wants try this could be starting point.

@1vanj0
Copy link
Author

1vanj0 commented Sep 15, 2023

This clam energy meter resembles _TZE204_81yrt3lo (TuYa PJ-1203A) implemented in Z2M. I have no confirmation whether data points for these two are the same at the moment but if anyone wants try this could be starting point.

Thanks a lot!! Searching the web I found on a thread the config of the external converter of the Tuya PJ-1203A and I adapted it to my device as follows:

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: '_TZE200_rks0sgb7',
},
],
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', ['_TZE200_rks0sgb7']), ],
// whiteLabel: [{vendor: 'EARU', 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;

And Z2M integred it perfectly.

Thanks again!

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Sep 16, 2023
@Koenkk
Copy link
Owner

Koenkk commented Sep 16, 2023

@1vanj0 thanks, added!

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)

@alexsahka
Copy link

alexsahka commented Oct 1, 2023

This clam energy meter resembles _TZE204_81yrt3lo (TuYa PJ-1203A) implemented in Z2M. I have no confirmation whether data points for these two are the same at the moment but if anyone wants try this could be starting point.

Thanks a lot!! Searching the web I found on a thread the config of the external converter of the Tuya PJ-1203A and I adapted it to my device as follows:

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: '_TZE200_rks0sgb7',
},
],
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', ['_TZE200_rks0sgb7']), ],
// whiteLabel: [{vendor: 'EARU', 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;

And Z2M integred it perfectly.

Thanks again!

Can you please confirm if this power monitor displays voltage and AC frequency?
My power monitor is showing 0 for some reason.

image

@steennick
Copy link

steennick commented Oct 4, 2023

I have been trying to get this to work as well, both with the external converter as with the latest zigbee-herdsman-converters (> 15.77.0). It does report as being a known device in both situations, so that's not an issue, but the reported values are off. The only value with reasonable output is the power B value, but even that one is not correct.

{
    "ac_frequency": 0.43,
    "current_A": 0.05,
    "energy_forward_A": 23.37,
    "energy_forward_B": 0.42,
    "energy_reverse_A": 13.4,
    "energy_reverse_B": 0.13,
    "linkquality": 174,
    "power_direction A": 585,
    "power_direction B": 563,
    "power_factor_A": 13.46,
    "total_power_A": 94.1,
    "total_power_B": 263,
    "voltage": 1.3,
    "current_B": null,
    "power_factor_B": null,
    "total_power_AB": null,
    "update_frequency": null
}

In these screenshots you can see the difference in value. The 'Power Consumption' sensor is an Eastron SDM230-Mod meter, the 0xb43a31fffe66d1be is the _TZE204_81yrt3lo B value measuring on the same power line.

Power_comparison_1

@alexsahka
Copy link

alexsahka commented Oct 4, 2023

I've been working on the external converter for a while now, and everything seems to be working except for the power direction and update frequency converter. Here is the code:

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: '_TZE200_rks0sgb7',
},
],
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', ['_TZE200_rks0sgb7']), ],
// whiteLabel: [{vendor: 'EARU', model: 'PJ-1203A'}],
exposes: [ //only report data
e.ac_frequency(),
exposes.numeric('power_1', ea.STATE).withUnit('kW').withDescription('Power 1'),
exposes.numeric('power_2', ea.STATE).withUnit('kW').withDescription('Power 2'),
exposes.numeric('total_power_1-2', ea.STATE).withUnit('W').withDescription('Total power 1-2'),
exposes.numeric('voltage', ea.STATE).withUnit('V').withDescription('Voltage'),
exposes.numeric('current_1', ea.STATE).withUnit('A').withDescription('Current 1'),
exposes.numeric('current_2', ea.STATE).withUnit('A').withDescription('Current 2'),
exposes.numeric('power_factor_1', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor 1'),
exposes.numeric('power_factor_2', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor 2'),
exposes.numeric('power_direction_1', ea.STATE).withDescription('Power direction 1 0/1 for forward/reverse'),
exposes.numeric('power_direction_2', ea.STATE).withDescription('Power direction 2 0/1 for forward/reverse'),
exposes.numeric('energy_forward_1', ea.STATE).withUnit('kWh').withDescription('Total energy 1 forward'),
exposes.numeric('energy_forward_2', ea.STATE).withUnit('kWh').withDescription('Total energy 2 forward'),
exposes.numeric('energy_reverse_1', ea.STATE).withUnit('kWh').withDescription('Total energy 1 reverse'),
exposes.numeric('energy_reverse_2', ea.STATE).withUnit('kWh').withDescription('Total energy 2 reverse'),
exposes.numeric('update_frequency', ea.STATE).withUnit('sec').withDescription('Update frequency'),
],

meta: {
    tuyaDatapoints: [//only report data
      [101, 'energy_forward_1', tuya.valueConverter.divideBy100],
      [102, 'energy_reverse_1', tuya.valueConverter.divideBy100],
      [103, 'energy_forward_2', tuya.valueConverter.divideBy100],
      [104, 'energy_reverse_2', tuya.valueConverter.divideBy100],
      [105, 'total_power_1-2', tuya.valueConverter.divideBy10],
      [106, 'voltage', tuya.valueConverter.divideBy10],
      [107, 'current_1', tuya.valueConverter.divideBy1000],
      [108, 'power_1', tuya.valueConverter.divideBy1000],
      [109, 'power_factor_1', tuya.valueConverter.raw],
      [110, 'current_2', tuya.valueConverter.divideBy1000],
      [111, 'power_2', tuya.valueConverter.divideBy1000],
      [112, 'power_factor_2', tuya.valueConverter.raw],
      [113, 'ac_frequency', tuya.valueConverter.raw],
      [114, 'power_direction_1', tuya.valueConverter.raw],
      [115, 'power_direction_2', tuya.valueConverter.raw],
      [116, 'update_frequency', tuya.valueConverter.raw],
    ],
},
};

module.exports = definition;

@Koenkk
Copy link
Owner

Koenkk commented Oct 5, 2023

@alexsahka could you make a pull request to add it here? https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/src/devices/tuya.ts

@alexsahka
Copy link

alexsahka commented Oct 7, 2023

I'm having trouble understanding how to set the power direction and update frequency.

image

Also Voltage precision not adjusting.
image
image

@Koenkk
Copy link
Owner

Koenkk commented Oct 7, 2023

  • If you go to the z2m frontend -> device -> state tab, what shows up?
  • You can only reduce the precision, not increase it (the device simply doesn't report more)

@alexsahka
Copy link

Setting the voltage precision to 0 results in the voltage being displayed with no digit after the decimal point. Increasing the voltage precision to 1 or more only displays one digit after the decimal point. I understand now that the device only reports voltage precision to one digit after the decimal point by design.

Thank you for explaining.

@steennick
Copy link

steennick commented Oct 8, 2023

I have noticed in the logs that datapoints 1, 2 and 9 are also being reported. I tried these values as raw, but they do not give any sensible result to update frequency of power direction (oftentimes values >1000). Other datapoints seem to return null, so I'm also not sure where to look for these values in the data supplied by the module.

@alexsahka I never thanked you for the effort!

@KPfff
Copy link

KPfff commented Oct 31, 2023

@Koenkk Managed to get this one working and posted converter here zigpy/zha-device-handlers#2650 (comment)

@alexsahka Do you really own https://es.aliexpress.com/item/1005005931365212.html 2 clamp version of the device? Because your posted converters were not working for this exact device.

I don't have further experience in preparing PRs or anything like that so help would be appreciated.

Thanks!

@KPfff
Copy link

KPfff commented Oct 31, 2023

@steennick, check zigpy/zha-device-handlers#2650 (comment) - all my findings and updated converter is posted there.

DPs 1, 2 and 9 are for energy_forward_AB, energy_reverse_AB and total_power_AB respectively ;)

@alexsahka
Copy link

Here is an actual picture of my device with two clamps. It has been working great for the past three weeks.
image

@KPfff
Copy link

KPfff commented Oct 31, 2023

@alexsahka Seems to be the same one (I just closed the mains box so no picture :D ) but you can see that I have completely different DPs to your above comment - (#18734 (comment))

And it matches what @steennick said about seeing some additional DPs (as in 1, 2 & 9)

@alexsahka
Copy link

@alexsahka Seems to be the same one (I just closed the mains box so no picture :D ) but you can see that I have completely different DPs to your above comment - (#18734 (comment))

And it matches what @steennick said about seeing some additional DPs (as in 1, 2 & 9)

Here is a screenshot from Z2M, but I still can't figure out the power direction and update frequency.

image

@KPfff
Copy link

KPfff commented Oct 31, 2023

@alexsahka, it is because update frequency is not reported - it is simply ~once per second. And Power direction is not there also, because it has completely separate values for reverse energy and Power readings simply go negative. (You can test that by installing clamp backwards)

Anyhow, test the converter I posted here. I think you will find it is working perfectly for you too ;)

Details:

  • I own double clamp Zigbee version from here https://es.aliexpress.com/item/1005005931365212.html
  • Reporting tested and working on my local mains!
  • Checked multiple DPs to find right ones, didn't find any more DPs with any values reported
  • Reverse energy tested by installing clamps backwards
  • Power readings goes negative with reverse load (see screenshot)
  • Summed "AB" values are coming with a delay and are not always 1+1 accurate
  • Reporting frequency seems to be fixed at once per second

NOTE: Readings accuracy is directly impacted by distance from other wires!!! One clamp was left without wire passing through, just wire next to it and it was showing 7W consumption.

Working converter below: `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: '_TZE200_rks0sgb7', }, ], 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', 'PC311-Z-TY', 'Bidirectional Energy Meter with 80A Current Clamp', ['_TZE200_rks0sgb7']), ], // whiteLabel: [{vendor: 'EARU', model: 'PC311-Z-TY'}], 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'), 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('current_AB', ea.STATE).withUnit('A').withDescription('Total Current'), 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('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('energy_reverse_AB', ea.STATE).withUnit('kWh').withDescription('Total energy AB 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_forward_AB', ea.STATE).withUnit('kWh').withDescription('Total energy AB forward'), ],

meta:{ tuyaDatapoints: [//only report data [113, 'ac_frequency', tuya.valueConverter.raw], [108, 'total_power_A', tuya.valueConverter.raw], [111, 'total_power_B', tuya.valueConverter.raw], [9, 'total_power_AB', tuya.valueConverter.raw], [106, 'voltage', tuya.valueConverter.divideBy10], [107, 'current_A', tuya.valueConverter.divideBy1000], [110, 'current_B', tuya.valueConverter.divideBy1000], [105, 'current_AB', tuya.valueConverter.divideBy1000], [109, 'power_factor_A', tuya.valueConverter.raw], [112, 'power_factor_B', tuya.valueConverter.raw], [102, 'energy_reverse_A', tuya.valueConverter.divideBy100], [104, 'energy_reverse_B', tuya.valueConverter.divideBy100], [2, 'energy_reverse_AB', tuya.valueConverter.divideBy100], [101, 'energy_forward_A', tuya.valueConverter.divideBy100], [103, 'energy_forward_B', tuya.valueConverter.divideBy100], [1, 'energy_forward_AB' , tuya.valueConverter.divideBy100], ], }, };

module.exports = definition;`

Exposed values

@alexsahka
Copy link

alexsahka commented Oct 31, 2023

The green marks match my converter, but the only difference is that I call them 1 and 2, while you call them A and B. However, if you look on the device, the labels say Circuit 1 and 2, not A and B.
image
image

@KPfff
Copy link

KPfff commented Oct 31, 2023

Soo.. where to begin.

  • I used A and B simply because I liked it better
  • red DPs are the ones that you were missing + you can see that I removed some and changed some descriptions too (Power direction was actually energy reverse)
  • Edit: Ah, you have those circuits 1 & 2 all over the place but not mixed. apologies :)

So here they are side by side, also check names not just DPs:
image

@KPfff
Copy link

KPfff commented Oct 31, 2023

Anyhow, @alexsahka you can test my converter - I have all values working and tested forward + reverse.

Note: 105 is total current and not power ;)

@alexsahka
Copy link

alexsahka commented Oct 31, 2023

105 is The total power between Circuit 1 and Circuit 2.

@KPfff
Copy link

KPfff commented Nov 1, 2023

No it is not! :D Have you even done the math?! There is no such parameter as power difference on this device!

Here are the stats with DPs used. Issue is that those SUM DPs are not being updated exactly at the same time always and they can have a slight delay.
But even with that you can clearly see that DP:105 is a SUM of Current A & B (especially from my example)

And moreover, screenshot you posted with your values does not support your above claim.

image
image

@KPfff
Copy link

KPfff commented Nov 1, 2023

Anyhow, I did the homework and posted a working and TESTED converter for EARU PC311-Z-TY. Hope it is used and I managed to help others.

Bit of constructive challenge is OK but this is getting frustrating and introducing confusion. I will not be participating in this discussion anymore as anyone who would test the values and do the math would see that my proposed mapping is correct.

Thanks and take care! :)

@rfenouil
Copy link

rfenouil commented Nov 6, 2023

Hi, thank you so much @KPfff for all this !!
It looks like I have the exact same symptoms as described by @steennick (issuecomment-1746262210) (and maybe yours if I understand properly), from an aliexpress "earu double clamp 80A meter".

It is detected as Tuya PJ-1203A and I get unusable values from it.

EDIT: Ok got it working following your instructions here, thank you !!

However I still don't understand why it's needed if the proper model is detected. Is it because it is a different model but description/specification has been duplicated and needs to be updated ?

Can we hope to get it integrated without the need of a converter in a future release ?

Thank you again for you patience :)

@fmnamado
Copy link

fmnamado commented Nov 8, 2023

Hello to all,

Thank you for this external converter.
All was displaying 0 (0V, 0Hz…), I was thinking into returning this.
As it paired, I thought it was correctly recognized. But now I know, it can be recognized but in a wrong way.

As I was saying, with this converter I can see Hz and Voltage.
But as my loads are small, at least this test ones, and as a personal preference, i would like to see power in Watts and not in kiloWatts. Can someone please adapt the converter in this way?
I already tried but with no luck.

I have some other questions:
-When will this be recognized without this external converter? Any version planned?
-Can this module be used to count only the power of two channels independently? I bought this model because of lack of space in my installation, I couldn’t understand at the time of buying of the possibility of related measures of channel A and B, which I don’t even understand what are meant for.

Thank you!!!

@rfenouil
Copy link

rfenouil commented Nov 8, 2023

Hi @fmnamado, maybe my configuration differs from yours but I get power in Watts in Zigbee2MQTT (and home assistant), energy is in kWh.

It seems to me that both channels are indeed independent, not sure about the combined reading, I will probably not use it... Also don't understand why it does not sum properly, maybe because sampling is not synchronous...

Other than that I basically have same questions as yours :)

@fmnamado
Copy link

fmnamado commented Nov 8, 2023

I was using a converter posted in this thread that used kW.
I have tried so many configurations that I am confused...

Right now I am using the converter from @KPfff, but as I wasn't getting an image, I changed it a bit.

I don't know it this impact the measurment or not.
I highlighted the change in the model name between /////.

I am still not sure it this is working: the Hz and Voltage are working, but I still don't have readings in Watts but I know my loiad is very small, so I am not sure if the problem is the load or the converter...

// zigpy/zha-device-handlers#2650 (comment)
// KPfff commented Oct 31, 2023 •

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: '_TZE200_rks0sgb7',
},
],
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', ['_TZE200_rks0sgb7']), ],
// whiteLabel: [{vendor: 'EARU', 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'),
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('current_AB', ea.STATE).withUnit('A').withDescription('Total Current'),
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('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('energy_reverse_AB', ea.STATE).withUnit('kWh').withDescription('Total energy AB 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_forward_AB', ea.STATE).withUnit('kWh').withDescription('Total energy AB forward'),
],

meta:{
tuyaDatapoints: [//only report data
[113, 'ac_frequency', tuya.valueConverter.raw],
[108, 'total_power_A', tuya.valueConverter.raw],
[111, 'total_power_B', tuya.valueConverter.raw],
[9, 'total_power_AB', tuya.valueConverter.raw],
[106, 'voltage', tuya.valueConverter.divideBy10],
[107, 'current_A', tuya.valueConverter.divideBy1000],
[110, 'current_B', tuya.valueConverter.divideBy1000],
[105, 'current_AB', tuya.valueConverter.divideBy1000],
[109, 'power_factor_A', tuya.valueConverter.raw],
[112, 'power_factor_B', tuya.valueConverter.raw],
[102, 'energy_reverse_A', tuya.valueConverter.divideBy100],
[104, 'energy_reverse_B', tuya.valueConverter.divideBy100],
[2, 'energy_reverse_AB', tuya.valueConverter.divideBy100],
[101, 'energy_forward_A', tuya.valueConverter.divideBy100],
[103, 'energy_forward_B', tuya.valueConverter.divideBy100],
[1, 'energy_forward_AB' , tuya.valueConverter.divideBy100],
],
},
};

module.exports = definition;

EDIT: BTW, I bought this one https://www.aliexpress.com/item/1005005931365212.html it seems exactly the same of @KPfff

@fmnamado
Copy link

fmnamado commented Nov 8, 2023

So just a quick update, I finally managed to get a load big enough to appear.
It is a small fan, with a consumption below 60W.
As you can see, I connected it to the first channel.

z2m_fan

I didn't pay attention to the orientation of the clamp, it was just for testing.
I just need to invert it.

To test the "accuracy", I used a zigbee plug, also connected to the same zigbee2mqtt coordinator/instance:
z2m_plug

So at least regarding to voltage, frequency, current and power, the above coordinator seems to be working, thank you everyone and specially @KPfff .

The power factor also seems to be accurate.

With time I will check the other values when I connect to other channel, other load.

But it seems I can use the channels independently, I just ignore the values that are taken in account both channels (differences and sums...)

Thank you!!!

@OwlBawl
Copy link

OwlBawl commented Jan 9, 2024

is there any way to reset consumtion data kWt/h of the clamp meter?

@alexsahka
Copy link

TuYa PJ-1203A

Not tested but saw this method on the website: https://smarthomescene.com/reviews/tuya-zigbee-single-clamp-energy-meter-review/

You can send a reset payload through MQTT:
Publish to: zigbee2mqtt/DEVICE_NAME/set
Payload {"reset":""}

@rfenouil
Copy link

rfenouil commented Jan 9, 2024

is there any way to reset consumtion data kWt/h of the clamp meter?

If same as mine:

  1. Press button for five seconds, it will blink red 3 times (it's a simple reset).
  2. Press again 5 seconds then it will blink green/red 3 times (it is a full reset) and every counter will be 0.

Must not wait more than 10 seconds between the two operations.

@wjansenw
Copy link

Hi guys,
As the official integration was not showing correct readings, I started from this post (some weeks ago); probably took some random pieces here and there from the post without reading to the bottom, so in the end I have my "own" converter (but tnx to all that posted here; my converter is really the same as already posted). (Is there a PR to make this the official converter?)

However - I observe a strange effect here...

  • One clamp is connected to the cable coming from the grid. So it takes the total consumption/production from the grid.
  • 2nd clamp is connected to my outdoor spa.

Everything was working correctly for the 1st clamp. Was not using my outdoor spa, so no consumption over there. Filled my spa over the weekend, and turned it on. I got readings on that clamp (~1kW - which matches with the specs), so was happy. But, for some reason, over the night, my 1st clamp - which measures as mentioned total consumption) was getting 2kWh readings in total per hour (noticed that this morning on the HA energy dashboard). I know my idle consumption during the night is in the 0.2-0.3kWh per hour (so 2-300W).

So - it seems like the readings of the 2nd clamp (little less than 1kWh) are added to the actual consumption of the 1st clamp (1kWh of the spa + 0.2kWh idle consumption) , giving a total of 1kWh+1kWh+0.2kWh = 2.2kWh. Which is 1kWh too much.

I see this both on the power readings as on the energy meters: currently, I'm consuming according to the 1st clamp 2kW, were the only powered on device is the spa (next to the idle consumption).

I guess this is a issue on the firmware of the device, right? Only way to solve this is by changing things in the converter, or by having Home Assistant do the compensation, right?

Anyone else that has observed similar behavior?

Regards,
Wim

@Koenkk
Copy link
Owner

Koenkk commented Feb 7, 2024

Added in #20095

Changes will be available in the dev branch in a few hours from now.

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