core: MQTT: The unit of measurement `lux` is not valid

The problem

I was sent here by the MQTT Debug log: “Please update your configuration if your entity is manually configured, otherwise create a bug report at…”

I have a linknlink eMotion Pro device that’s reporting light levels (illuminance) in ‘lux’. It seems that HA wants to move to make this ‘lx’ The warning message is:

The unit of measurement luxis not valid together with device classilluminance. this will stop working in HA Core 2025.7.0

How do I manage this? What mechanism is in place for users to deal with autoconfig items for MQTT integrations where the manufacturer hasn’t/wont make changes to fix? Can I force the change on an autodiscovered sensor and if so what’s the method for doing so?

What version of Home Assistant Core has the issue?

core-2025.5.3

What was the last working version of Home Assistant Core?

core-2025.5.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

MQTT

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet


Anything in the logs that might be useful for us?


Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

I had the same error for a weather station that is configured with MQTT manually

The unit of measurement was set to lux, and that caused the error.

Changing that to lx made the error go away.

  - name: 'Sunlight'
    state_topic: 'xxxx/Vevor-7in1/xxxx'
    device_class: 'illuminance'
    unit_of_measurement: 'lx'
    value_template: >-
      {%- set v = int(value_json.light_lux) if is_number(value_json.light_lux) -%}
      {% if v >= 0 and v <= 160000 %}
      {{ v }}
      {% endif -%}

For Auto Discovery based devices only the manufacturer can fix this. So maybe the core team should reconsider this breaking change. I can imaging a work around in case it breaks:

  • lookup and copy the auto discovery code for the broken sensor via device->MQTT Info->MQTT discovery data->payload
  • disable the automatically added broken sensor
  • add a manual configured MQTT sensor to your YAML. Here you can adapt the unit and if needed the value calculation