Zigbee Power/Meter Mc Edge Driver: added the Dual-Bidirectional Energy Meter Tuya PC311-Z-TY device
- It is a metering device that can monitor two circuits and, being bidirectional, can be used to monitor photovoltaic generation installations and to be able to perform routines with solar surpluses to control different heating, cooling, etc. systems in the home.
If the installation has a battery, with 2 clamps the energy stored in it will not be controlled.
This device sends information from the two circuits every 30 seconds, with 16 different Tuya data points, one datapoint every second.
Always in this datapoint sequence:
1,2,101,103,102,104,106,107,110,108,111,9,109,112,113,105
From Koenkk github, Thanks !
--[[tuyaDatapoints: [
[113, (x71)'ac_frequency', tuya.valueConverter.raw],
[108, (x6C)'power_a', tuya.valueConverter.raw],
[111, (x6F)'power_b', tuya.valueConverter.raw],
[009, (x09)'power', tuya.valueConverter.raw],
[106, (x6A)'voltage', tuya.valueConverter.divideBy10],
[107, (x6B)'current_a', tuya.valueConverter.divideBy1000],
[110, (x6E)'current_b', tuya.valueConverter.divideBy1000],
[105, (x69)'current', tuya.valueConverter.divideBy1000],
[109, (x60)'power_factor_a', tuya.valueConverter.raw],% , for 0 to 1 range divide by 100
[112, (x70)'power_factor_b', tuya.valueConverter.raw],% , for 0 to 1 range divide by 100
[001, (x01)'energy', tuya.valueConverter.divideBy100],
[101, (x65)'energy_a', tuya.valueConverter.divideBy100],
[103, (x67)'energy_b', tuya.valueConverter.divideBy100],
[102, (x66)'energy_produced_a', tuya.valueConverter.divideBy100],
[104, (x68)'energy_produced_b', tuya.valueConverter.divideBy100],
[002, (x02)'energy_produced', tuya.valueConverter.divideBy100],
],]]
The driver offers 3 different profiles to display useful data depending on the type of installation that the user can perform.
It is very important that the installation setup matches the examples so that the profile displays the data correctly. If you use a setup with an incorrect profile, there may be errors in the data.
This is the explanation to understand the setups and the data:
-
This device stores the instantaneous power data that circulates in each direction of clamp A and B as a positive or negative value in the datapoints (0x6C and 0x6F) and sum up them algebraically in the datapoint (0x09)
-
It saves the current of clamps A and B in the datapoints (0x6B and 0x6E) and sum up them in the datapoint (0x69). The current is always sent as a positive value.
-
The energy measured in the direction of the arrow of clamps A and B is stored as energy consumed in the data points (0x65 and 0x67) and is sum up in the data point (0x01)
-
The energy measured in the opposite direction of the arrow of clamps A and B is stored as energy produced in the data points (0x66 and 0x68) and is sum up in the data point (0x02)
-
The power factors (phase shift between voltage and current) measured in each clamp are stored in the data points (0x6D and 0x70). When the load is totally resistive the value = 1. (the device sends a value of 100%)
When the load is not totally resistive (capacitive or inductive part) there is a phase shift between voltage and current, the power factor would be the cosine of that phase shift angle: 0ΒΊ = 1, 90ΒΊ = 0.
The screenshots show a power factor = 0.5, which would be about 60ΒΊ of phase shift with a 9w led bulb and it shows a current of 67 mA that if it were purely resistive would be equivalent to 16w and the device shows 8w due to power factor.
If I use an incandescent bulb the power factor is shown very close to 1 (0.97). It shows a power of 56w and the bulb is 60w.
The power factor is important when looking at the performance of our inverter. If low power factors are detected in the clamp that controls solar production, something may be wrong with the installation.
-
βClamp-A=Export & Clamp-B=Productionβ:
- Installation with the A clamp connected to the grid power line of the house to show Solar Surplus (+) and grid consumption (-)
- Installation with the B clamp connected to the line from the inverter to the House input to show Solar production (+)
- It is the default profile and has 3 components:
- Solar Energy Exported:
- Power W: Surplus, W(+) and Grid Consumption W(-)
- Energy Exported, Kwh
- Voltage, Current, Frequency and Power Factor Clamp A. values ( 0 to 1)
- Power & Energy Consumption (Grid):
- Power W: Grid Consumption, W(+)
- Energy Consumed from the grid, Kwh
- Current (A) and Power Factor Clamp B ( 0 to 1)
- Solar Energy Production:
- Power W: Produced, W(+)
- Energy Produced total, Kwh
- Current Produced, (A)
βClamp-A=Export & Clamp-B=Consumptionβ:
- Installation with the clamp A connected to the grid power line of the house to show Solar Surplus (+) and grid consumption (-)
- Installation with the clamp B connected to the power input for the consumption of the house to show its consumption (+)
- The profile has 3 components:
- Solar Energy Exported:
- Power W: Surplus, W(+) and Grid Consumption W(-)
- Energy Exported, Kwh
- Voltage, Current, Frequency and Power Factor Clamp A ( 0 to 1)
- Power (Grid+Solar) & (Grid) Energy Consumption:
- Power W: Instantaneous Solar Consumption + Grid Consumption, W
- Energy Consumed from the grid, Kwh
- Current (A) and Power Factor Clamp B, value ( 0 to 1)
- Solar Energy Production:
- Power W: Produced, W(+)
- Energy Produced, Kwh
- Current Produced, (A)
βClamp-A & Clamp-B Independent Dataβ:
- Used to independently measure the data from Camp A and Camp B. They can be installations like these:
- The profile has 6 components:
-
Energy Consumption Clamp A:
- Power W: Instantaneous consumption A, W(+) , W(-)
- Energy Consumed Clamp A, Kwh
- Voltage, Current, Frequency and Power Factor Clamp A, value ( 0 to 1)
-
Energy Consumption Clamp B:
- Power W: Instantaneous consumption Clam B, W(+) , W(-)
- Energy Consumed Clamp B, Kwh
- Voltage, Current, Frequency and Power Factor Clamp B ( 0 to 1)
-
Energy Consumption A + B:
- Power W: Consumption instantaneous A + B, W(+), W(-)
- Energy Consumed A + B, Kwh
- Current clamp A + clamp B, (A)
-
Energy Production Clamp A:
- Energy Production Clamp A, Kwh
-
Energy Production Clamp B:
- Energy Production Clamp B, Kwh
-
Energy Production A + B:
- Energy Production Clamp A + B, Kwh
I used it for several months in a Tuya App installation and it works well with a βClamp-A=Export & Clamp-B=Comsuptionβ type installation.
It also works well now with smartThings
The energy data shown in the screenshots are those stored in each datapoint by the device during tuya installation and cannot be physically deleted.
In the smartthings App, you can reset each energy data of the profile component used. This data is stored in permanent memory and is subtracted from the values ββthat the device sends from the moment of the reset. This is how it is done in smartthings with zigbee devices.
If a driver change or uninstallation and reinstallation is made, the energy data stored in the datapoints will appear again.
I hope this driver and the post are useful to understand how to use this popular Tuya device, it is a bit complex and it has cost me many hours of work and debugging and there may be something that is not completely correct, if anyone detects any data that does not work well, please let me know and I will try to correct it.
This is the driver version
βββββββββββββββββββββββββββββββββββββββββββββββββββ
Name Zigbee Power/Meter Mc
Version 2024-11-04T17:39:22.767559526
βββββββββββββββββββββββββββββββββββββββββββββββββββ
- id: "_TZE200_rks0sgb7/TS0601"
deviceLabel: Energy Monitor Dual Bi-directional PC311-Z-TY
manufacturer: _TZE200_rks0sgb7
model: TS0601
deviceProfileName: power-meter-energy-solar-dual-exp-prod