Strange error in config/energy

Hello all,
I’m struggling trying to fix this error:
Screenshot_20230128_214424
I’ve searched and modified, in every file I can think of, the occurrance of kWhh, and restarted but the error pop up and also I’ve found some other error in the log.
Do you know how can I fix this without loosing my stats ?
The sensor is defined in configuration.yaml in this way:

sensor:
  - platform: integration
    source: sensor.iot_en_mon
    name: energy_spent
    unit_prefix: k
    round: 2

and the source is:

sensor:
    - name: IoT-En-Mon
      state_topic: "homeassistant/sensor/IoTEnMon/state"
      unit_of_measurement: "Wh"
      unique_id: mqtt_iotenmon
      device_class: power
      value_template: "{{ value_json.power }}"

the mosquitto return ( to HASS ) this kind of lines:

homeassistant/sensor/IoTEnMon/state {"power":2078}

without any units.

Do you have any idea ?

T.I.A.

Pierluigi

Good, now go to Developer Tools → Statistics. Find the entity and press the “Fix Issue” button next to it to fix historical Long Term Statistics with the wrong unit.

Hello Tom,
as I said, although there is no occurence of thw kWhh unit anywhere in the configuration and in the DB (home-assistant_v2.db), after the restart the error pop up again and the fix, in the Statistics page change again the kWh in kWhh all around.

Any other idea ?
Maybe the problem is in the unit of measurement of the iot sensor ? Maybe it should be “W” and not “Wh” ?

Pierluigi

Yeah, this should be W for power, not Wh.

It seems that this made it work.
I will check but for now it’s working as expected.
Thanks a lot !

1 Like