Statistics Error for utility_meter sensor - ' ' vs 'kWh'

Hi folks, thanks in advance for your help - always appreciate it.

I’m getting an error with the unit of a number of filtered sensors I use.
e.g. - sensor.daily_washing_machine

The unit ('') of the recorded statistics doesnt match the supported unit 'kWh' of device class 'energy'.

If I look this sensor up in Dev Tools, I see that in the sensor attributes …

unit_of_measurement: kWh
device_class: energy

… seem right.

This comes from a utility_meter that I have set up.

 washing_machine:
  unique_id: '8757D36F-002C-4AA2-91EC-F9635CCA54A3'
  source: sensor.washing_machine_filtered_electric_consumption
  name: Daily Washing Machine
  cycle: daily

This pulls from a filtered sensor - sensor.washing_machine_filtered_electric_consumption

- platform: filter
  name: "Washing Machine"
  entity_id: sensor.utility_room_washing_machine_electric_consumption_kwh
  unique_id: '0B37F558-504D-4802-AA6B-B4A3D981E052'
  filters:
    - filter: range
      lower_bound: 0 
    - filter: outlier
      window_size: 10
      radius: 4.0

… which when I look at in dev tools also says that …

unit_of_measurement: kWh
device_class: energy

This filtered sensor comes from my Z-Wave integration where my smart plug records my usage.
sensor.utility_room_washing_machine_electric_consumption_kwh

meter_type_name: ELECTRIC
unit_of_measurement: kWh
device_class: energy

Soooooo. TLDR version.

My sensor “sensor.daily_washing_machine”, says that the “unit (’’) of the recorded statistics doesnt match the supported unit ‘kWh’ of device class ‘energy’”. However, that sensor, and every sensor that comes before it has unit_of_measurement as “kWh”.

Could someone please point me at where I’m going wrong?

Thank you!

Go to Developer Tools → Statistics and click on the “FIX ISSUE” button next to the entity.

Hey @tom_l - thanks.

I’m sorry, I forgot to mention that I do the “FIX ISSUE” thing, but I get the error back a couple of days later. I assumed (wrongly?) that this was a short term fix and I needed to sort something out long term in yaml?

Is there a way I could have configured these sensors differently to have not got the error in the first place?

Hang on a minute.

The utility meter uses this entity: sensor.washing_machine_filtered_electric_consumption

However this filter sensor config:

would generate an entity_id like this: sensor.washing_machine from the name.

So you may have the wrong entity id in your utility meter.