Error conversion watt to KWh

Hello,
I am using the latest version of the core “core-2021.11.4” and I am trying to create a sensor to convert the watt value of energy switch tuya in KWh.
Despite the fact the sensor being created, the value is much higher than that shown on the smart life app.
For example, for the fridge I have a monthly consumption of 15.93 KWh (smart life app) while the sensor I created shows me a value of 46,47 KWh.
This means that if I add the sensor in KWh to the energy monitor on the home assistant, the consumptions are out of order.

Instead the sensor of tuya in watt displays the correct value.

This is the code I am using to convert watt to KWh:

  - platform: integration
    source: sensor.fridge_power
    name: KWh frigo
    unit_prefix: k
    unit_time: h
    round: 2

Thanks !

How do you know which one is right?
Average consumption of a fridge is more in the 30-40kWh / month than in the 15, unless yours is special

The 15.93 kWh can’t be correct unless my maths is wrong.

15.93 kWh = 15930 watts so decided by 30 (average days in month) = 531 watts (a day) / 24 (hours in a day) would mean a little over 22 watts a hour average usage.

Average A+ rated fridge wattage would be somewhere between 40-120 (depends largely on how often you open it and therefore how often the compressor has to run)

So rough calculation.
70 watts (average) x 24 (hours) = 1680 x 30 (days) would = 50400 or 50.4 kWh

So I would be trusting the HA reading if I had to choose out of the two.

Thank you for your reply. I forgot to say that 15.93 KWh is the consumption of the fridge from 1st nov. until now.
Usually the value is around 40/45 KWh monthly which is correct in my opinion because I have a small fridge.
Anyway the value in watt is equal to what I see on app of smart life instead the value of KWh is too much different and I don’t know why.

Maybe you are right and hassio show me the real consumption in KWh.

Excuse my lack of knowledge with tuya (never used it) but I assume you have an entity that reports the watts?

If so can you try to make a template sensor to convert it and use that in energy?

image

Your point is valid but technically speaking you are confusing units of energy and power, the above should read:

15.93 kWh = 15930 Wh so decided by 30 (average days in month) = 531 Wh (a day) / 24 (hours in a day) would mean a little over 22 Wh an hour average usage.

1 Like

Please take note of this part of the documentation for the Riemann Sum integral:

Trapezoidal is the default and may not be the appropriate choice for your situation. Try the left method.

https://www.home-assistant.io/integrations/integration/#method

Method left is used for on/off devices anyway I will try with this method.

Thanks!

Trapezoidal should only be used for smoothly changing values. If your data is at all spikey or step like you should use left.

It does not work either with left or right. I wrote in the section of Energy Monitor to avoid to create confusion.

Did you solve it? I have one tuya smart plug with power monitoring and I have the same problem. The conversion to KWh is wrong… During last month the sensor is showing me more KWh than my actual energy bill.

1 Like