Change device_class

Hello Community! I’m absolutely new to Home Assistant – but already loving it.

My current problem: I have an IoT device, which publishes auto discovery data to MQTT. However, the device_class of one sensor is wrong. I cannot change firmware.

How would I change it in HA? And: can I?

My current attempt is to add a customize section to configuration.yaml, however, this seems to be without effect.

homeassistant:
  customize:
    sensor.<my_sensor_name>:
      device_class: duration

Did you restart Home Assistant after making the change in configuration.yaml?

If you did and it failed to supercede the value set by MQTT Discovery then you don’t have any other easy options.

  1. You can contact the device’s manufacturer and ask to have it corrected.

  2. You can create your own MQTT Discovery configuration for the device and use it to overwrite the one produced by the device’s manufacturer.

Okay, thanks for your swift reply.

Is there any way to debug / find out, if the MQTT data is actually actively superseding the "customize"d values?

I initially also thought of 2.), however, soon gave up as the auto discovery data is a (more or less) complex JSON object, where I only need to change 1 key.

It’s the other way around; customize is supposed to overide the entity’s underlying integration. If it’s not happening then there’s no recourse. The reason why I had asked if you had restarted Home Assistant is because sometimes people forget to do it and their customizations aren’t loaded.

It’s admittedly a pain to have to duplicate the entire discovery payload just to change one key-value pair.