Wrong unit (kkWh) for integration sensor

Hi,

I have set up an integration sensor to keep track of how much energy the electric car has consumed. I get a warning in the HA log every time at bootup that I cannot find out how to fix. Seems like the unit is kkWh (double k) even though I think it should be kWh.

Error message:

Source: components/sensor/recorder.py:259
Integration: Sensor (documentation, issues)
First occurred: 13:45:29 (1 occurrences)
Last logged: 13:45:29

sensor.energi_id4_laddning has unit kkWh which is unsupported for device_class energy

The sensor configuration:

  - platform: integration
    name: "Energi ID4 laddning"
    source: sensor.volkswagen_id_id_4_charge_power
    unit_time: h
    method: left

The source comes from an custom integration for the VW ID-family. If I look at it in the developer tools, it looks as follows:

As I understand the documentation, a sensor with unit “kW” fed into the integration component to be integrated over hours, should produce kWh. However, from somewhere I get an additional k.

Any ideas how to fix this? Could it be some old configuration that has been wrong which is still “stuck” in the recorder?

1 Like

Try with template sensor, convert sensor.volkswagen_id_id_4_charge_power wh to kwh:

     - platform: template
       sensors:
         general_kWh:
           value_template: "{{(states('sensor.volkswagen_id_id_4_charge_power') | float / 1000) | round(2) }}"
           unit_of_measurement: kWh
           friendly_name: "General kWh"

Another options:

- platform: integration
  source:  sensor.volkswagen_id_id_4_charge_power
  name: general_kw
  unit_prefix: k
  round: 2

I just bumped into this thread.

I am looking to read/calculate how much kWh actually went into the battery of the ID.4. Is there anyway to accomplish that?

The sensor above is, I think, limited to how much kWh went into the car, not specific into the battery, right?