In HA I see 0.03 kWh and it is actually 30kWh

Hi Everyone,

I can’t figure out where is my mistake. Could you give me some help?

So, my Tesla App says yesterday I have used 34kWh during my charge.

Tesla Integration Sensor (Power) says I used 34kW during that period of time

I created this template to get the value in kWh

- platform: integration
  source: sensor.charger_power
  name: tesla-charger_kwh
  round: 2


- platform: statistics
  entity_id: sensor.tesla-charger_kwh
  state_characteristic: mean
  sampling_size: 20


      last_reset: '2024-01-13T00:00:00+00:00'
      device_class: energy
      unit_of_measurement: "kWh"
      state_class: total_increasing

But when I check the kWh entity I see yesterday I have used 0.03 kWh ! I can’t figure out why I don’t see 34 kWh.

Appreciate your help

It seems there is an issue with W vs KW. If you divide 34 kW by 1000 and round it by 2 you get 0.03.

Yep ! But I don’t why and what’s wrong ….

You cannot integrate kWh (well, you can, but it will have an odd unit of kWh^2 that I’ve never seen). If you want totals, use a utility meter with the appropriate period. Or, take the Tesla kW sensor, if there is one, and integrate that. That one you can compare with the integration’s one. Why are you duplicating what you already have?

Hi @parautenbach the Tesla Integration only has a Power Sensor in kW like other lights and plugs I have.

So what I am doing for all of them is to convert them in kW/h using the template I mentioned above as the Energy Dashboard requires kW/h.

Right, I see you’re integrating over power. I looked poorly the first time. One thing to do is to set the integration method to left.

1 Like

Hey Peter, everyone,

This “left” solved my problem. Thank you very much !!!

1 Like