TUYA 1 or 3 phase Energy Meter

Here is a video on how to install local tuya:

I created an issue in the HomeAssistant for this Tuya Power Clamp sensor show as unsupported · Issue #71054 · home-assistant/core · GitHub
Together with it also a patch-set that is pending review that partially adds support for it Add partial support for Tuya Power Clamp #71054 by dala318 · Pull Request #72202 · home-assistant/core · GitHub (only adds reading of Total Power which is provided through the Tuya API)

Hi dala318,

It will be great if your patch-set for the standard tuya integration gets accepted. We will keep fingers crossed…

Hello Guys, thank you for your follow up.
Here is what i have done.

  • Add in IOT Tuya
  • THen in H.A (automatically)

It shows as unsupported and « this device have no entity »

Any ides from your side please?

Lucius, so I followed your video.

  • create account IOT Tuya
  • add the power clamp
  • get the local key
  • install Local Tuya Integration
  • paste ThenKey and create entity as a Sensor
  • but I should have done something wrong because I get only one information: total KW/h (and wrong number)

Here are some copy screens:



When you add the power clamp with local tuya and select sensor, you should get many sensors. Not sure if the sensor numbers are always the same, but in my case the total energy consumption is under sensor “131” and the number has to be formated “0.01” and unit of measurement set to KWh.
Can you confirm that you get the options described above?

1 Like

Lucius, I try to get back to this configuration information I get first time I install, but cannot (if i do same process i get « Entity with this ID has already been configured.« Where can I get these infos or update them?
Also I wonder if I do not need to enter some info in my configuration yaml like.:.


localtuya:
  - host: 192.168.1.x
    device_id: xxxxx
    local_key: xxxxx
    friendly_name: Tuya Device
    protocol_version: "3.3"
    scan_interval: # optional, only needed if energy monitoring values are not updating
      seconds: 30 # Values less than 10 seconds may cause stability issues
    entities:

Ok Lucius, I played with Local Tuya INtegretion and click configure and add 131 then i get Kw/h and format it 0.01
So i need to add more sensor with different numbers, i just realise that the value (not formatted) is the one i get in my power clamp…so i continue and come back to you

Here we go :slight_smile:

Well I’m finally very happy to finally get all these info from my Tuya Power clamp…no need to buy a new Power Clamp as some people suggest :slight_smile:
This is good news.
Now I try to get this entity into my energy dashboard, but still cannot…any recommendation ?
Thank you again…I’m so happy to get these number from my clamp :slight_smile:

Anyone,can help me to add these data to energy board please? I,tried the same way I,had my Sonoff pow r2, but cannot :frowning:

To get the sensor to display in the Energy dashboard you need to add the following in the customize.yml

sensor.name_of_your_sensor:

unit_of_measurement: kWh

device_class: energy

state_class: total_increasing

icon: hass:counter

Lucius, thank you but I’m not sure to understand:

sensor.tuya_power_clamp:
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
icon: hass:counter

Like that?
I get this message

Thank you :slight_smile:

Not sure about what the error message means, but here a few things you neeed to check?

Did you add the lines in the customize.yaml? Does your configuration.yaml have a reference to the customize.yaml (i.e. customize: !include customize.yaml)

You need to refer to your sensor (not device). I am guessing “tuya_power_clamp” is your device, but you need to customize the sensor 131, which I am guessing is the one you named total energy P1-P2-P3

Finally, you need to format the lines correctly. this is from my customize.yaml and my sensor 131 is called “total_energy”:
image

The energy dashboard only displays energy consumption, so you can only show sensor 131 or the individual P1, P2 and P3 energy sensors (if you want to display P1,P2 and P3 you will need to customize them also)

Hope the above helps.

Lucius, thank you for your answer.
No I have no reference in Configuration yaml.
So i just have to add a line, as:
- customize: !include customize.yaml
(is the !) important?

So to resume, my entities :.

  • total energy P1-P2-P3 : sensor.tuya_power_clamp
  • P1 Energy: sensor.test1
  • P2 Energy: sensor.test_5
  • P3 Energy: sensor.test_8

Here is the error i h get by entering these information:

Integration error: customize - Integration ‘customize’ not found.

/config/customize.yaml

sensor.tuya_power_clamp:
  unit_of_measurement: kWh
  device_class: energy
  state_class: total_increasing
  icon: hass:counter

/config/configuration.yaml

customize: !include customize.yaml

1 Like

If you don’t have any other customizations, it is probably easier to add the customization in your main configuration.yaml

Check the yaml example in this section:

Basically under “homeassistant:” create a “customize:” section and add the customization for the power clamp that you have listed above.

1 Like

Lucius, here is the result, finally i wrote all in Customize.yaml.
It works perfectly.
THANK YOU !!!

No NEED to buy another power clamp, this one works fine thanks to your help
THANK YOU !!!

Glad you managed to get it to work yann1966!

Let me know if in the future you experience the same issue as myself:
“The energy consumption was displayed on the energy dashboards without any problems, but recently it stopped working. Somehow I get only a bar every 12 hours, instead of the energy consumption every hour. Has anybody experienced similar behaviour?”

I had to reset the power clamp and add it again into home assistant. Not a big deal, but certainly annoying…

Ok Lucius, for sure i will tell you if I have same issue
Have a nice day and thanks again ! :slight_smile:

Lucius, for now I’ve been monitoring and it is ok. Will see after a couple of days if something change I’ll tell you:-)

Hello, I have the same three-phase power clamp. Could you describe which sensor number corresponds to which measurement and relative scale ?

Auto-answer :slight_smile:

Libellé Phase Scale Unit
101 Tension 1 0.1 V
102 Courant 1 0.001 A
103 Puissance 1 1 W
104 Cos phi 1 0.01 1
106 Energie 1 0.01 kWh
111 Tension 2 0.1 V
112 Courant 2 0.001 A
113 Puissance 2 1 W
114 Cos phi 2 0.01 1
116 Energie 2 0.01 kWh
121 Tension 3 0.1 V
122 Courant 3 0.001 A
123 Puissance 3 1 W
124 Cos phi 3 0.01 1
126 Energie 3 0.01 kWh
131 Energie Total 0.01 kWh
132 Courant Total 0.001 A
133 Puissance Total 1 W
135 Frequence Total 1 Hz
136 Temperature Total 0.1 °C
4 Likes

I finally got mine to work. I got the Tuya 3 phase power clamp and it took me a few days to figure out how to show the data in the Energy dashboard. I’m using HA OS with KVM installation on Proxmox. I was stumbling with the Scaling but managed to get it to work. @Thierry34 , thanks for the table with the scale. I had difficulties entering the decimal points as the web GUI kept preventing me from going beyond .1 points. After a few tries, it works.

I was also getting the same error message in the configuration.yaml and had difficulties learning how to integrate with the customize.yaml. After learning for you guys, below is what I had with mine to get it to work.
configuration.yaml file:
'# Loads default set of integrations. Do not remove.
default_config:

'# Text to speech
tts:
’ - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

homeassistant:
customize: !include customize.yaml

customize.yaml file:
sensor.total_energy_consumed:
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing

I did not “discover” all the sensors in the Tuya power clamp, I only discovered 4 items, Active Power, Current, Total Energy, and Voltage. I will most likely play around with this and might discover the rest later.

It took a while for me to understand the usages of yaml files and sensors before I could get it to show up in my Energy dashboard. @Lucius , currently my dashboard is showing every hour, but I only have 3 hours right now. I’m going to let it run a few days before I do any modifications to see if the configurations is what I want. Will update again here if there is any significant changes.

Thanks everyone for contributing!! Helped me a lot !!

1 Like