Influxdb override_measurement by device_class

I have a working influxdb integration.
My issue is that both humidity and battery level show up in the “%” measurements.
I’d like to be able to override the measurement based on the device class, for instance:
device_class battery --> “% batt”
device_class hulidity --> “% hum”

I’m currently using component override:

component_config:
sensor.openclose_6_battery_level:
override_measurement: "% batt"

but it would be much more efficient to set those overrides at the device_class level.