(EDGE Driver-Mc) Solar Energy. Zigbee Power/Meter Mc and Z-Wave Electric Meter Mc drivers

I have created this separate thread for the Zigbee Power/Meter Mc and Z-Wave Electric Meter Mc drivers for use with solar power in smartthing.

  • These drivers allow you to easily create and execute routines based on Active power:
    • Imported (consumed from the grid)
    • Exported (exported to the grid)

The clamp meter devices that allow you to do this are:

  • Aeotec HEM Gen5 with Z-Wave Electric Meter Mc driver
   {mfr = 0x0086, prod = 0x0102, model = 0x005F},  -- Aeotec Home Energy Meter (Gen5) US
   {mfr = 0x0086, prod = 0x0002, model = 0x005F},  -- Aeotec Home Energy Meter (Gen5) EU
  • Tuya Energy Bi-directional model PJ-2201, with Zigbee Power/Meter Mc driver.
  - id: "_TZE204_ac0fhfiq/TS0601"
    deviceLabel: Energy Monitor Bi-directional PJ-2201
    manufacturer: _TZE204_ac0fhfiq
    model: TS0601
    deviceProfileName: power-meter-energy-solar

https://a.aliexpress.com/_Ew2hqeD

Depending on the direction of the clamp arrow placement on the grid power supply line, Active Power will be displayed positive or negative, depending on the direction of the electric current flow.

  • In the zigbee model it has a preference that allows you to change the sign without having to change the clamp.

For Aeotec models this is the link to the original post.

The Tuya PJ-2201 device uses the EF00 cluster and I have based it on the DP’s of the driver code of @w35l3y and his help for the voltage and current DP’s, Thank you very much for your help.

This device is more talkative than the zwave aeotec, which only transmits messages exactly at the time set in preferences, I have it at 120 sec.

In this Tuya device I have added a preference to emit the events in a personalized way, but the device messages are every 5 or 10 sec, I have not seen that it creates any conflict in my zigbee network.

This driver allows you to easily create routines to turn on or off heating, cooling, water heaters, … etc, depending on the value of the excess solar energy dumped into the grid.

The device saves the total exported or imported energy in different DP’s and they are displayed separately in two different capbilities.

The total exported and imported energies can be reset by routines on a periodic basis, for example monthly.

driver version

───────────────────────────────────────────────────
 Name         Zigbee Power/Meter Mc
 Version      2024-08-23T16:54:00.668737084        
───────────────────────────────────────────────────
7 Likes

Hi I’m trying to use the Zigbee power/meter Mc driver however the device is coming up as a Zigbee thing. Please see the fingerprint if someone could assist me to get this device added correctly. Model is tuya pj-1203


Hi,

This device works with this driver.
Is unidirectional meter, always positive power is shown

Thank you, i got it to work but the power calculation and energy meter figures seems to be inaccurate. Is it using power factor to calculate the power. As for the Energy meter it’s starts from 0kwh then 35wh, 45wh and it’s now 19wh. I don’t have a direction load so I’m unsure why the kwh would decrease

I bought one a few months ago with one clamp, I don’t know if it will be like yours, and I tried it for a couple of days and returned it.
I didn’t like it because it didn’t give information about positive and negative power that I needed, although I think I remember that it should have information about the direction of the current flow and the addition and subtraction in the total energy depending on the direction of the current.

Could it be that you have changed the direction of the clamp or have changed the clamp from L to N or vice versa?

I believe they do use power factor to calculate power, I have a two clamp one running on Tuya app and it does display and use power factor for power calculations. I don’t know if this model will do that too.

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
7 Likes

@Mariano_Colmenarejo I tried to add a BTicino FC80GCS load management module to Smartthings. It is only detected as a β€œzigbee thing” without showing me anything. Is it possible to try installing one of these drivers to at least see the consumption?

If when the device is paired hub does not detect the cluster 0702 or 0B04, it means that it does not have it and that is why it assigns the zigbee thing driver.

If you pair with zigbee thing Mc, copy the htlm attribute deviceInfo in advanced user web and paste in the post, then i can see the supported clusters

Manufacturer: Legrand
Model: Smart shedder module
FingerPrinted_EndPoint.Id: 0x01
App Version: 0x00
ZCL Version: 0x08
Network ID: 0x76A2
Zigbee EUI: 00047400008F340E
Device ID: 3f5c50ff-c8a3-4472-9421-33b7ea4a7263

Server Cluster:
Ep: 0x01={ 0000,0003,0004,0005,FC01,0B04 }
Ep: 0xF2={ 0021 }

Client Clusters:
Ep: 0x01={ 0006,0000,FC01,0005,0019 }
Ep: 0xF2={ 0021 }

Signal Metrics:
LQI: 200 .... RSSI: -83 dbm

Added to this driver version as power meter without energy meter

You need install this driver version in your hub
uninstall device and add new device with search nearby option
Do not perform a driver change!

───────────────────────────────────────────────────
 Name         Zigbee Power/Meter Mc
 Version      2024-11-10T22:12:59.580441374
───────────────────────────────────────────────────
- id: "Legrand/Smart_module"
    deviceLabel: BTicino FC80GCS
    manufacturer: Legrand
    model: Smart shedder module
    deviceProfileName: power-meter-no-energy

Ok, now it works. The instantaneous consumption is seen, unfortunately it is not detected in the β€œenergy” section and this would have been great…is there a way to include it?

The ZigBee specification uses cluster 0702 and attribute 0000.
This device does not support it.

If it uses a manufacturer-specific cluster, I don’t know.

The manual will say what functions device supports.

in the proprietary Bticino application I can see the various usage statistics, the peaks in energy demand etc… I don’t know if this is what you meant, but if there was some possibility I would be happy to be able to do something, but unfortunately I don’t know what.

Hi @Mariano_Colmenarejo ,

May I request this fingerprint be added to this edge driver please?

https://www.aliexpress.us/item/3256806031661280.html?spm=a2g0o.order_list.order_list_main.5.720618025g3btA&gatewayAdapt=glo2usa

_TZE204_81yrt3lo
TS0601

Hi @johnconstantelo

This device is very different from the one I have integrated, the data points are totally different and the arithmetic operations that the firmware does with the powers and currents are also different.
On the other hand, this device with this firmware 74 (4A) has a problematic issue to be able to integrate it into the code.

I would recommend the same one that I am using, model: β€˜PC311-Z-TY’, it works well and even the message frequency is about 30 sec and the one you have is about 10 sec, according to koenkk.
You can use it with different configurations in the clamps to obtain the most types of use

EARU brand, https://a.aliexpress.com/_EyH7GDw

I wish you a happy new year

2 Likes

Thanks for letting me know @Mariano_Colmenarejo , much appreciated! I had no idea these were that bad. I wish I would have done a little more research, but at least this didn’t cost me very much (I got a great sale price).

I also wish you a happy new year!

2 Likes

With Tuya devices you never know which device you are actually going to receive, they all look the same until you connect them.

There are some, like fingerbots, that look the same and even in the Tuya App they work poorly or differently.

3 Likes

Hi @Mariano_Colmenarejo , I was looking at your Github repo for this device’s profile to see if the reporting interval is configurable. Is it just using β€œpower-energy-meter”? I didn’t see the profile defined in the fingerprint file in the Profiles folder.

Sorry, it’s not up to date.

The interval is not configurable and I haven’t found if it’s possible to configure it.
It’s about 30 sec and I haven’t noticed that it negatively affects the zigbee network with about 40 ZigBee devices in v2 hub.

1 Like

Happy New Year @Mariano_Colmenarejo,

I took your advice and purchased the PC311-Z-TY device, and it’s working very well. Thank you for telling me about that device!

I wanted to let you know that when I select the installation type as β€œClamp A & Clamp B Independent Data” that the main tile shows the value for A, but 0 for B, and then sometimes B just goes away altogether. Is that something you can look into once you have some time? Thank you for all your contributions to this community!

See the screenshots below.


Clamp B does record data: