Hi.
I have installed a Tuya Energy meter (one with a clamp) and I have installed this on my outgowing power from one of my Solar invertors (old one without network).
So far its great I can see in the Tuya app the power generated from that array and in HA I am able to see the live power being generated.
What I have tied to do is create an energy meter that will read from this so I can add it to my Energy Dash board, but so far I can not get this right.
This is what I have so far:
- sensor:
- name: "Growatt Solar Import"
unit_of_measurement: "Wh"
device_class: energy
state_class: total_increasing
state: "{{ states('sensor.current_energy_generation') }}"
But all it appears to do is match like for like what “‘sensor.current_energy_generation’” is showing, it isnt growing into a total number.
I also tried changing the state_class to just be “total” but it just grew and blew out to a huge number within hours.
Once I do get this working do I need to use an automation to reset it back to zero each night?
sensor.current_energy_generation has a unit of Wh indicating it is an energy sensor, not a power sensor.
Go to Developer Tools → States, copy the attributes of this sensor from the left column and post them here.
Also post a screenshot of this sensor’s history graph.
If this device is doing something stupid like reporting “instantaneous energy” or energy per minute your best course of action would be to calculate the energy yourself by multiplying the current and voltage sensors to get power in a template sensor, then integrating the power with the Riemann Sum approximation sensor to get energy.
It is an energy sensor from my understanding, my Invertor has a max of 2kw. All this is doing is reading the output from the invertor back to my “grid”. This is what it shows in the Tuya app if that helps.
Being a local tuya item I imported it myself so it is very possible I have set wrong data
Nope. Energy is not an instantaneous reading like that. It accumulates. Power is an instantaneous reading.
Your unit is wrong. It should be W not Wh.
Your Tuya app is showing a power graph (or it could be energy total per hour, it has no y-axis units so it is not easy to determine) and an energy total in the number above it.
If you can add Tuya energy meter to “Energy” dashboard it’s easy:
In configuration.yaml add:
sensor:
- platform: integration
source: sensor.wifi_smart_meter_power <--- your Tuya power sensor name
name: tuya_sensor_energy
unit_prefix: k
round: 2
max_sub_interval:
minutes: 5
Just add this and restart HA. After it, at Energy dasboard you can add sensor Tuya Sensor Energy as data source.